util/stream_util library
Classes
-
SplitStreams<
K, E> - Splits a stream into multiple streams based on the classification function. The streams are closed when the last element in the source stream is emitted. If the source stream ends with an error, it is propagated to all streams not yet closed.
Functions
-
cancelOnInterrupt<
T> (Stream< T> source, Stream<void> interrupt) → Stream<T> -
Returns a stream that forwards events from
sourceuntilinterruptemits, then cancelssourceand completes with StreamInterruptedException. -
withFallback<
T> (Stream< T> stream, T fallbackElement) → Stream<T> - Returns a stream that emits the events from the given stream, or the fallback element if the stream is empty.
Exceptions / Errors
- StreamInterruptedException
- Thrown when a stream wrapped with cancelOnInterrupt is cancelled by an interrupt signal.