mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-17 23:47: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
|
val startDestination = Hottest
|
||||||
|
|
||||||
fun getDestinationFromRoute(route: String): Destination {
|
fun getDestinationFromRoute(route: String): Destination {
|
||||||
values().forEach {
|
return values().firstOrNull { it.route == route } ?: error("Incorrect route password")
|
||||||
if (it.route == route) {
|
|
||||||
return it
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw IllegalStateException("Incorrect route passed")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue