SwitchIfEmptyExtension<T> extension

Extend the Stream class with the ability to return an alternative Stream if the initial Stream completes with no items.

  • Stream<T>


switchIfEmpty(Stream<T> fallbackStream) → Stream<T>
When the original Stream emits no items, this operator subscribes to the given fallback stream and emits items from that Stream instead. [...]