StreamUtils<T> extension
Extension for safely retrieving the first element from a Stream<T>
.
This prevents errors when calling .first
on an empty stream.
- on
-
- Stream<
T>
- Stream<
Methods
-
firstOrNull(
) → Future< T?> -
Available on Stream<
Returns the first element of the stream, orT> , provided by the StreamUtils extensionnull
if the stream is empty.