firstNotNullOfOrNull

inline fun <T, R : Any> Sequence<T>.firstNotNullOfOrNull(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 null if no non-null value was produced.

The operation is terminal.

Since Kotlin

1.5

Samples