mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-18 00:57:02 +05:30
Simplify getDestinationFromRoute
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
703957e2b7
commit
98866ee407
1 changed files with 1 additions and 7 deletions
|
@ -20,13 +20,7 @@ enum class Destination(
|
|||
val startDestination = Hottest
|
||||
|
||||
fun getDestinationFromRoute(route: String): Destination {
|
||||
values().forEach {
|
||||
if (it.route == route) {
|
||||
return it
|
||||
}
|
||||
}
|
||||
|
||||
throw IllegalStateException("Incorrect route passed")
|
||||
return values().firstOrNull { it.route == route } ?: error("Incorrect route password")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue