August 2018
Beginner
178 pages
4h 56m
English
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 }
Read now
Unlock full access