August 2018
Beginner
178 pages
4h 56m
English
This function is the same as first, but if no item satisfies the predicate then null is returned instead of throwing an exception:
val numbers = listOf(1, 2, 3, 4, 5)val firstLargerThan10 = numbers.firstOrNull { n -> n > 10 }
Read now
Unlock full access