firstOrNull

Returns the first element, including null, or null when empty. Stops after that element.


inline fun <T> Sequence<T>.firstOrNull(predicate: (T) -> Boolean): T?(source)

Returns the first matching element, including null, or null when none matches. Stops immediately at a match. The immediate inline predicate admits non-local returns.