This function returns the first item that satisfies the given predicate function or throws NoSuchElementException if no item satisfies the predicate:
val numbers = listOf(1, 2, 3, 4, 5)
val firstEven = numbers.first { n -> n % 2 == 0 }
This function returns the first item that satisfies the given predicate function or throws NoSuchElementException if no item satisfies the predicate:
val numbers = listOf(1, 2, 3, 4, 5)
val firstEven = numbers.first { n -> n % 2 == 0 }
3.17.179.239