Given: ```enum class SomeEnum { A, B } data class ...
# announcements
d
Given:
Copy code
enum class SomeEnum { A, B }
data class SomeVariant(val a: Int, val b: SomeEnum)
data class SomeThing(val a: Int, val b: SomeEnum)

val variantList = listOf(...)
val thing = SomeThing(..)
I want to be able to compare an instance of
SomeThing
to find the best variant (if there is) so I need two criteria:
maxOf(variantList.filter { it.a < thing.a })
AND
SomeEnum.values().filter { it <= thing.b }.toList().max()
, what would be the most efficient way to do this?