The opposite of firstOrNull, this function returns the last item that satisfies the predicate or null in case of no items matching the predicate:
val numbers = listOf(1, 2, 3, 4, 5)
val lastLargerThan10 = numbers.lastOrNull { n -> n > 10 }
The opposite of firstOrNull, this function returns the last item that satisfies the predicate or null in case of no items matching the predicate:
val numbers = listOf(1, 2, 3, 4, 5)
val lastLargerThan10 = numbers.lastOrNull { n -> n > 10 }
3.17.179.239