SwitchMapExtension<T> extension

Extends the Stream with the ability to convert one stream into a new Stream whenever the source emits an item. Every time a new Stream is created, the previous Stream is discarded.

on

Methods

switchMap<S>(Stream<S> mapper(T value)) Stream<S>
Converts each emitted item into a Stream using the given mapper function. The newly created Stream will be be listened to and begin emitting items, and any previously created Stream will stop emitting.