firstNotNullOf

inline fun <T, R : Any> Sequence<T>.firstNotNullOf(transform: (T) -> R?): R(source)

Returns the first non-null value produced by transform function being applied to elements of this sequence in iteration order, or throws NoSuchElementException if no non-null value was produced.

The operation is terminal.

Since Kotlin

1.5

Samples