FlatMapBatchesStreamExtension<T> extension

Extends the Stream class with the ability to convert each element to a Stream, then listen to at most size Stream at a time and outputs their results in size-sized batches, while maintaining order within each batch — subsequent batches of Streams are only listened to when the batch before it successfully completes.

on

Methods

flatMapBatches<R>(Stream<R> transform(T value), int size) Stream<List<R>>
Convert each element to a Stream, then listen to at most size Stream at a time and outputs their results in size-sized batches, while maintaining order within each batch — subsequent batches of Streams are only listened to when the batch before it successfully completes. Errors will be forwarded downstream.
flatMapBatchesSingle<R>(Single<R> transform(T value), int size) Single<List<R>>
Similar to flatMapBatches, but collect all output result batches into a List, and emit final result as a Single when source Stream emits done event.