public abstract class

Flowable

extends Object
implements Publisher<T>
java.lang.Object
   ↳ io.reactivex.Flowable<T>
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

The Flowable class that implements the Reactive-Streams Pattern and offers factory methods, intermediate operators and the ability to consume reactive dataflows.

Reactive-Streams operates with Publishers which Flowable extends. Many operators therefore accept general Publishers directly and allow direct interoperation with other Reactive-Streams implementations.

The Flowable hosts the default buffer size of 128 elements for operators, accessible via bufferSize(), that can be overridden globally via the system parameter rx2.buffer-size. Most operators, however, have overloads that allow setting their internal buffer size explicitly.

The documentation for this class makes use of marble diagrams. The following legend explains these diagrams:

For more information see the ReactiveX documentation.

Summary

Public Constructors
Flowable()
Public Methods
final Single<Boolean> all(Predicate<? super T> predicate)
Returns a Single that emits a Boolean that indicates whether all of the items emitted by the source Publisher satisfy a condition.
static <T> Flowable<T> amb(Iterable<? extends Publisher<? extends T>> sources)
Mirrors the one Publisher in an Iterable of several Publishers that first either emits an item or sends a termination notification.
static <T> Flowable<T> ambArray(Publisher...<? extends T> sources)
Mirrors the one Publisher in an array of several Publishers that first either emits an item or sends a termination notification.
final Flowable<T> ambWith(Publisher<? extends T> other)
Mirrors the Publisher (current or provided) that first either emits an item or sends a termination notification.
final Single<Boolean> any(Predicate<? super T> predicate)
Returns a Single that emits true if any item emitted by the source Publisher satisfies a specified condition, otherwise false.
final T blockingFirst(T defaultItem)
Returns the first item emitted by this Flowable, or a default value if it emits no items.
final T blockingFirst()
Returns the first item emitted by this Flowable, or throws NoSuchElementException if it emits no items.
final void blockingForEach(Consumer<? super T> onNext)
Invokes a method on each item emitted by this Flowable and blocks until the Flowable completes.
final Iterable<T> blockingIterable(int bufferSize)
Converts this Flowable into an Iterable.
final Iterable<T> blockingIterable()
Converts this Flowable into an Iterable.
final T blockingLast()
Returns the last item emitted by this Flowable, or throws NoSuchElementException if this Flowable emits no items.
final T blockingLast(T defaultItem)
Returns the last item emitted by this Flowable, or a default value if it emits no items.
final Iterable<T> blockingLatest()
Returns an Iterable that returns the latest item emitted by this Flowable, waiting if necessary for one to become available.
final Iterable<T> blockingMostRecent(T initialItem)
Returns an Iterable that always returns the item most recently emitted by this Flowable.
final Iterable<T> blockingNext()
Returns an Iterable that blocks until this Flowable emits another item, then returns that item.
final T blockingSingle(T defaultItem)
If this Flowable completes after emitting a single item, return that item; if it emits more than one item, throw an IllegalArgumentException; if it emits no items, return a default value.
final T blockingSingle()
If this Flowable completes after emitting a single item, return that item, otherwise throw a NoSuchElementException.
final void blockingSubscribe(Consumer<? super T> onNext)
Subscribes to the source and calls the given callbacks on the current thread.
final void blockingSubscribe(Consumer<? super T> onNext, Consumer<? super Throwable> onError)
Subscribes to the source and calls the given callbacks on the current thread.
final void blockingSubscribe()
Runs the source observable to a terminal event, ignoring any values and rethrowing any exception.
final void blockingSubscribe(Consumer<? super T> onNext, Consumer<? super Throwable> onError, Action onComplete)
Subscribes to the source and calls the given callbacks on the current thread.
final void blockingSubscribe(Subscriber<? super T> subscriber)
Subscribes to the source and calls the Subscriber methods on the current thread.
final <U extends Collection<? super T>> Flowable<U> buffer(long timespan, long timeskip, TimeUnit unit, Scheduler scheduler, Callable<U> bufferSupplier)
Returns a Flowable that emits buffers of items it collects from the source Publisher.
final <B> Flowable<List<T>> buffer(Callable<? extends Publisher<B>> boundaryIndicatorSupplier)
Returns a Flowable that emits buffers of items it collects from the source Publisher.
final Flowable<List<T>> buffer(long timespan, long timeskip, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits buffers of items it collects from the source Publisher.
final <U extends Collection<? super T>> Flowable<U> buffer(int count, Callable<U> bufferSupplier)
Returns a Flowable that emits buffers of items it collects from the source Publisher.
final <B, U extends Collection<? super T>> Flowable<U> buffer(Publisher<B> boundaryIndicator, Callable<U> bufferSupplier)
Returns a Flowable that emits non-overlapping buffered items from the source Publisher each time the specified boundary Publisher emits an item.
final <B> Flowable<List<T>> buffer(Publisher<B> boundaryIndicator, int initialCapacity)
Returns a Flowable that emits non-overlapping buffered items from the source Publisher each time the specified boundary Publisher emits an item.
final Flowable<List<T>> buffer(long timespan, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits buffers of items it collects from the source Publisher.
final Flowable<List<T>> buffer(int count)
Returns a Flowable that emits buffers of items it collects from the source Publisher.
final Flowable<List<T>> buffer(long timespan, long timeskip, TimeUnit unit)
Returns a Flowable that emits buffers of items it collects from the source Publisher.
final <TOpening, TClosing> Flowable<List<T>> buffer(Flowable<? extends TOpening> openingIndicator, Function<? super TOpening, ? extends Publisher<? extends TClosing>> closingIndicator)
Returns a Flowable that emits buffers of items it collects from the source Publisher.
final Flowable<List<T>> buffer(long timespan, TimeUnit unit, Scheduler scheduler, int count)
Returns a Flowable that emits buffers of items it collects from the source Publisher.
final Flowable<List<T>> buffer(long timespan, TimeUnit unit)
Returns a Flowable that emits buffers of items it collects from the source Publisher.
final <U extends Collection<? super T>> Flowable<U> buffer(long timespan, TimeUnit unit, Scheduler scheduler, int count, Callable<U> bufferSupplier, boolean restartTimerOnMaxSize)
Returns a Flowable that emits buffers of items it collects from the source Publisher.
final Flowable<List<T>> buffer(int count, int skip)
Returns a Flowable that emits buffers of items it collects from the source Publisher.
final <B> Flowable<List<T>> buffer(Publisher<B> boundaryIndicator)
Returns a Flowable that emits non-overlapping buffered items from the source Publisher each time the specified boundary Publisher emits an item.
final <TOpening, TClosing, U extends Collection<? super T>> Flowable<U> buffer(Flowable<? extends TOpening> openingIndicator, Function<? super TOpening, ? extends Publisher<? extends TClosing>> closingIndicator, Callable<U> bufferSupplier)
Returns a Flowable that emits buffers of items it collects from the source Publisher.
final <B, U extends Collection<? super T>> Flowable<U> buffer(Callable<? extends Publisher<B>> boundaryIndicatorSupplier, Callable<U> bufferSupplier)
Returns a Flowable that emits buffers of items it collects from the source Publisher.
final Flowable<List<T>> buffer(long timespan, TimeUnit unit, int count)
Returns a Flowable that emits buffers of items it collects from the source Publisher.
final <U extends Collection<? super T>> Flowable<U> buffer(int count, int skip, Callable<U> bufferSupplier)
Returns a Flowable that emits buffers of items it collects from the source Publisher.
static int bufferSize()
Returns the default internal buffer size used by most async operators.
final Flowable<T> cache()
Returns a Flowable that subscribes to this Publisher lazily, caches all of its events and replays them, in the same order as received, to all the downstream subscribers.
final Flowable<T> cacheWithInitialCapacity(int initialCapacity)
Returns a Flowable that subscribes to this Publisher lazily, caches all of its events and replays them, in the same order as received, to all the downstream subscribers.
final <U> Flowable<U> cast(Class<U> clazz)
Returns a Flowable that emits the items emitted by the source Publisher, converted to the specified type.
final <U> Single<U> collect(Callable<? extends U> initialItemSupplier, BiConsumer<? super U, ? super T> collector)
Collects items emitted by the source Publisher into a single mutable data structure and returns a Single that emits this structure.
final <U> Single<U> collectInto(U initialItem, BiConsumer<? super U, ? super T> collector)
Collects items emitted by the source Publisher into a single mutable data structure and returns a Single that emits this structure.
static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> Flowable<R> combineLatest(Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Publisher<? extends T6> source6, Publisher<? extends T7> source7, Publisher<? extends T8> source8, Publisher<? extends T9> source9, Function9<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? extends R> combiner)
Combines nine source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.
static <T, R> Flowable<R> combineLatest(Publisher[]<? extends T> sources, Function<? super Object[], ? extends R> combiner)
Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.
static <T, R> Flowable<R> combineLatest(Iterable<? extends Publisher<? extends T>> sources, Function<? super Object[], ? extends R> combiner)
Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.
static <T1, T2, T3, T4, T5, T6, T7, T8, R> Flowable<R> combineLatest(Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Publisher<? extends T6> source6, Publisher<? extends T7> source7, Publisher<? extends T8> source8, Function8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R> combiner)
Combines eight source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.
static <T1, T2, R> Flowable<R> combineLatest(Publisher<? extends T1> source1, Publisher<? extends T2> source2, BiFunction<? super T1, ? super T2, ? extends R> combiner)
Combines two source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from either of the source Publishers, where this aggregation is defined by a specified function.
static <T1, T2, T3, R> Flowable<R> combineLatest(Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Function3<? super T1, ? super T2, ? super T3, ? extends R> combiner)
Combines three source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.
static <T1, T2, T3, T4, R> Flowable<R> combineLatest(Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Function4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> combiner)
Combines four source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.
static <T1, T2, T3, T4, T5, R> Flowable<R> combineLatest(Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Function5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> combiner)
Combines five source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.
static <T, R> Flowable<R> combineLatest(Publisher[]<? extends T> sources, Function<? super Object[], ? extends R> combiner, int bufferSize)
Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.
static <T, R> Flowable<R> combineLatest(Function<? super Object[], ? extends R> combiner, Publisher...<? extends T> sources)
Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.
static <T1, T2, T3, T4, T5, T6, T7, R> Flowable<R> combineLatest(Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Publisher<? extends T6> source6, Publisher<? extends T7> source7, Function7<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? extends R> combiner)
Combines seven source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.
static <T, R> Flowable<R> combineLatest(Iterable<? extends Publisher<? extends T>> sources, Function<? super Object[], ? extends R> combiner, int bufferSize)
Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.
static <T1, T2, T3, T4, T5, T6, R> Flowable<R> combineLatest(Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Publisher<? extends T6> source6, Function6<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? extends R> combiner)
Combines six source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.
static <T, R> Flowable<R> combineLatestDelayError(Function<? super Object[], ? extends R> combiner, int bufferSize, Publisher...<? extends T> sources)
Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publisher, where this aggregation is defined by a specified function and delays any error from the sources until all source Publishers terminate.
static <T, R> Flowable<R> combineLatestDelayError(Publisher[]<? extends T> sources, Function<? super Object[], ? extends R> combiner)
Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.
static <T, R> Flowable<R> combineLatestDelayError(Publisher[]<? extends T> sources, Function<? super Object[], ? extends R> combiner, int bufferSize)
Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function and delays any error from the sources until all source Publishers terminate.
static <T, R> Flowable<R> combineLatestDelayError(Iterable<? extends Publisher<? extends T>> sources, Function<? super Object[], ? extends R> combiner)
Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function and delays any error from the sources until all source Publishers terminate.
static <T, R> Flowable<R> combineLatestDelayError(Iterable<? extends Publisher<? extends T>> sources, Function<? super Object[], ? extends R> combiner, int bufferSize)
Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function and delays any error from the sources until all source Publishers terminate.
static <T, R> Flowable<R> combineLatestDelayError(Function<? super Object[], ? extends R> combiner, Publisher...<? extends T> sources)
Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function and delays any error from the sources until all source Publishers terminate.
final <R> Flowable<R> compose(FlowableTransformer<? super T, ? extends R> composer)
Transform a Publisher by applying a particular Transformer function to it.
static <T> Flowable<T> concat(Publisher<? extends T> source1, Publisher<? extends T> source2, Publisher<? extends T> source3)
Returns a Flowable that emits the items emitted by three Publishers, one after the other, without interleaving them.
static <T> Flowable<T> concat(Iterable<? extends Publisher<? extends T>> sources)
Concatenates elements of each Publisher provided via an Iterable sequence into a single sequence of elements without interleaving them.
static <T> Flowable<T> concat(Publisher<? extends T> source1, Publisher<? extends T> source2, Publisher<? extends T> source3, Publisher<? extends T> source4)
Returns a Flowable that emits the items emitted by four Publishers, one after the other, without interleaving them.
static <T> Flowable<T> concat(Publisher<? extends Publisher<? extends T>> sources, int prefetch)
Returns a Flowable that emits the items emitted by each of the Publishers emitted by the source Publisher, one after the other, without interleaving them.
static <T> Flowable<T> concat(Publisher<? extends Publisher<? extends T>> sources)
Returns a Flowable that emits the items emitted by each of the Publishers emitted by the source Publisher, one after the other, without interleaving them.
static <T> Flowable<T> concat(Publisher<? extends T> source1, Publisher<? extends T> source2)
Returns a Flowable that emits the items emitted by two Publishers, one after the other, without interleaving them.
static <T> Flowable<T> concatArray(Publisher...<? extends T> sources)
Concatenates a variable number of Publisher sources.
static <T> Flowable<T> concatArrayDelayError(Publisher...<? extends T> sources)
Concatenates a variable number of Publisher sources and delays errors from any of them till all terminate.
static <T> Flowable<T> concatArrayEager(int maxConcurrency, int prefetch, Publisher...<? extends T> sources)
Concatenates a sequence of Publishers eagerly into a single stream of values.
static <T> Flowable<T> concatArrayEager(Publisher...<? extends T> sources)
Concatenates a sequence of Publishers eagerly into a single stream of values.
static <T> Flowable<T> concatDelayError(Publisher<? extends Publisher<? extends T>> sources, int prefetch, boolean tillTheEnd)
Concatenates the Publisher sequence of Publishers into a single sequence by subscribing to each inner Publisher, one after the other, one at a time and delays any errors till the all inner and the outer Publishers terminate.
static <T> Flowable<T> concatDelayError(Iterable<? extends Publisher<? extends T>> sources)
Concatenates the Iterable sequence of Publishers into a single sequence by subscribing to each Publisher, one after the other, one at a time and delays any errors till the all inner Publishers terminate.
static <T> Flowable<T> concatDelayError(Publisher<? extends Publisher<? extends T>> sources)
Concatenates the Publisher sequence of Publishers into a single sequence by subscribing to each inner Publisher, one after the other, one at a time and delays any errors till the all inner and the outer Publishers terminate.
static <T> Flowable<T> concatEager(Iterable<? extends Publisher<? extends T>> sources)
Concatenates a sequence of Publishers eagerly into a single stream of values.
static <T> Flowable<T> concatEager(Publisher<? extends Publisher<? extends T>> sources, int maxConcurrency, int prefetch)
Concatenates a Publisher sequence of Publishers eagerly into a single stream of values.
static <T> Flowable<T> concatEager(Publisher<? extends Publisher<? extends T>> sources)
Concatenates a Publisher sequence of Publishers eagerly into a single stream of values.
static <T> Flowable<T> concatEager(Iterable<? extends Publisher<? extends T>> sources, int maxConcurrency, int prefetch)
Concatenates a sequence of Publishers eagerly into a single stream of values.
final <R> Flowable<R> concatMap(Function<? super T, ? extends Publisher<? extends R>> mapper, int prefetch)
Returns a new Flowable that emits items resulting from applying a function that you supply to each item emitted by the source Publisher, where that function returns a Publisher, and then emitting the items that result from concatenating those resulting Publishers.
final <R> Flowable<R> concatMap(Function<? super T, ? extends Publisher<? extends R>> mapper)
Returns a new Flowable that emits items resulting from applying a function that you supply to each item emitted by the source Publisher, where that function returns a Publisher, and then emitting the items that result from concatenating those resulting Publishers.
final <R> Flowable<R> concatMapDelayError(Function<? super T, ? extends Publisher<? extends R>> mapper, int prefetch, boolean tillTheEnd)
Maps each of the items into a Publisher, subscribes to them one after the other, one at a time and emits their values in order while delaying any error from either this or any of the inner Publishers till all of them terminate.
final <R> Flowable<R> concatMapDelayError(Function<? super T, ? extends Publisher<? extends R>> mapper)
Maps each of the items into a Publisher, subscribes to them one after the other, one at a time and emits their values in order while delaying any error from either this or any of the inner Publishers till all of them terminate.
final <R> Flowable<R> concatMapEager(Function<? super T, ? extends Publisher<? extends R>> mapper)
Maps a sequence of values into Publishers and concatenates these Publishers eagerly into a single Publisher.
final <R> Flowable<R> concatMapEager(Function<? super T, ? extends Publisher<? extends R>> mapper, int maxConcurrency, int prefetch)
Maps a sequence of values into Publishers and concatenates these Publishers eagerly into a single Publisher.
final <R> Flowable<R> concatMapEagerDelayError(Function<? super T, ? extends Publisher<? extends R>> mapper, boolean tillTheEnd)
Maps a sequence of values into Publishers and concatenates these Publishers eagerly into a single Publisher.
final <R> Flowable<R> concatMapEagerDelayError(Function<? super T, ? extends Publisher<? extends R>> mapper, int maxConcurrency, int prefetch, boolean tillTheEnd)
Maps a sequence of values into Publishers and concatenates these Publishers eagerly into a single Publisher.
final <U> Flowable<U> concatMapIterable(Function<? super T, ? extends Iterable<? extends U>> mapper)
Returns a Flowable that concatenate each item emitted by the source Publisher with the values in an Iterable corresponding to that item that is generated by a selector.
final <U> Flowable<U> concatMapIterable(Function<? super T, ? extends Iterable<? extends U>> mapper, int prefetch)
Returns a Flowable that concatenate each item emitted by the source Publisher with the values in an Iterable corresponding to that item that is generated by a selector.
final Flowable<T> concatWith(Publisher<? extends T> other)
Returns a Flowable that emits the items emitted from the current Publisher, then the next, one after the other, without interleaving them.
final Single<Boolean> contains(Object item)
Returns a Single that emits a Boolean that indicates whether the source Publisher emitted a specified item.
final Single<Long> count()
Returns a Single that counts the total number of items emitted by the source Publisher and emits this count as a 64-bit Long.
static <T> Flowable<T> create(FlowableOnSubscribe<T> source, BackpressureStrategy mode)
Provides an API (via a cold Flowable) that bridges the reactive world with the callback-style, generally non-backpressured world.
final Flowable<T> debounce(long timeout, TimeUnit unit)
Returns a Flowable that mirrors the source Publisher, except that it drops items emitted by the source Publisher that are followed by newer items before a timeout value expires.
final Flowable<T> debounce(long timeout, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that mirrors the source Publisher, except that it drops items emitted by the source Publisher that are followed by newer items before a timeout value expires on a specified Scheduler.
final <U> Flowable<T> debounce(Function<? super T, ? extends Publisher<U>> debounceIndicator)
Returns a Flowable that mirrors the source Publisher, except that it drops items emitted by the source Publisher that are followed by another item within a computed debounce duration.
final Flowable<T> defaultIfEmpty(T defaultItem)
Returns a Flowable that emits the items emitted by the source Publisher or a specified default item if the source Publisher is empty.
static <T> Flowable<T> defer(Callable<? extends Publisher<? extends T>> supplier)
Returns a Flowable that calls a Publisher factory to create a Publisher for each new Subscriber that subscribes.
final Flowable<T> delay(long delay, TimeUnit unit, boolean delayError)
Returns a Flowable that emits the items emitted by the source Publisher shifted forward in time by a specified delay.
final <U, V> Flowable<T> delay(Publisher<U> subscriptionIndicator, Function<? super T, ? extends Publisher<V>> itemDelayIndicator)
Returns a Flowable that delays the subscription to and emissions from the source Publisher via another Publisher on a per-item basis.
final Flowable<T> delay(long delay, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits the items emitted by the source Publisher shifted forward in time by a specified delay.
final Flowable<T> delay(long delay, TimeUnit unit, Scheduler scheduler, boolean delayError)
Returns a Flowable that emits the items emitted by the source Publisher shifted forward in time by a specified delay.
final <U> Flowable<T> delay(Function<? super T, ? extends Publisher<U>> itemDelayIndicator)
Returns a Flowable that delays the emissions of the source Publisher via another Publisher on a per-item basis.
final Flowable<T> delay(long delay, TimeUnit unit)
Returns a Flowable that emits the items emitted by the source Publisher shifted forward in time by a specified delay.
final <U> Flowable<T> delaySubscription(Publisher<U> subscriptionIndicator)
Returns a Flowable that delays the subscription to this Publisher until the other Publisher emits an element or completes normally.
final Flowable<T> delaySubscription(long delay, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that delays the subscription to the source Publisher by a given amount of time, both waiting and subscribing on a given Scheduler.
final Flowable<T> delaySubscription(long delay, TimeUnit unit)
Returns a Flowable that delays the subscription to the source Publisher by a given amount of time.
final <T2> Flowable<T2> dematerialize()
Returns a Flowable that reverses the effect of materialize by transforming the Notification objects emitted by the source Publisher into the items or notifications they represent.
final Flowable<T> distinct()
Returns a Flowable that emits all items emitted by the source Publisher that are distinct.
final <K> Flowable<T> distinct(Function<? super T, K> keySelector)
Returns a Flowable that emits all items emitted by the source Publisher that are distinct according to a key selector function.
final <K> Flowable<T> distinct(Function<? super T, K> keySelector, Callable<? extends Collection<? super K>> collectionSupplier)
Returns a Flowable that emits all items emitted by the source Publisher that are distinct according to a key selector function.
final Flowable<T> distinctUntilChanged(BiPredicate<? super T, ? super T> comparer)
Returns a Flowable that emits all items emitted by the source Publisher that are distinct from their immediate predecessors when compared with each other via the provided comparator function.
final <K> Flowable<T> distinctUntilChanged(Function<? super T, K> keySelector)
Returns a Flowable that emits all items emitted by the source Publisher that are distinct from their immediate predecessors, according to a key selector function.
final Flowable<T> distinctUntilChanged()
Returns a Flowable that emits all items emitted by the source Publisher that are distinct from their immediate predecessors.
final Flowable<T> doAfterNext(Consumer<? super T> onAfterNext)
Calls the specified consumer with the current item after this item has been emitted to the downstream.
final Flowable<T> doAfterTerminate(Action onAfterTerminate)
Registers an Action to be called when this Publisher invokes either onComplete or onError.
final Flowable<T> doFinally(Action onFinally)
Calls the specified action after this Flowable signals onError or onCompleted or gets cancelled by the downstream.
final Flowable<T> doOnCancel(Action onCancel)
Calls the cancel Action if the downstream cancels the sequence.
final Flowable<T> doOnComplete(Action onComplete)
Modifies the source Publisher so that it invokes an action when it calls onComplete.
final Flowable<T> doOnEach(Consumer<? super Notification<T>> onNotification)
Modifies the source Publisher so that it invokes an action for each item it emits.
final Flowable<T> doOnEach(Subscriber<? super T> subscriber)
Modifies the source Publisher so that it notifies a Subscriber for each item and terminal event it emits.
final Flowable<T> doOnError(Consumer<? super Throwable> onError)
Modifies the source Publisher so that it invokes an action if it calls onError.
final Flowable<T> doOnLifecycle(Consumer<? super Subscription> onSubscribe, LongConsumer onRequest, Action onCancel)
Calls the appropriate onXXX method (shared between all Subscribers) for the lifecycle events of the sequence (subscription, cancellation, requesting).
final Flowable<T> doOnNext(Consumer<? super T> onNext)
Modifies the source Publisher so that it invokes an action when it calls onNext.
final Flowable<T> doOnRequest(LongConsumer onRequest)
Modifies the source Publisher so that it invokes the given action when it receives a request for more items.
final Flowable<T> doOnSubscribe(Consumer<? super Subscription> onSubscribe)
Modifies the source Publisher so that it invokes the given action when it is subscribed from its subscribers.
final Flowable<T> doOnTerminate(Action onTerminate)
Modifies the source Publisher so that it invokes an action when it calls onComplete or onError.
final Single<T> elementAt(long index, T defaultItem)
Returns a Flowable that emits the item found at a specified index in a sequence of emissions from this Flowable, or a default item if that index is out of range.
final Maybe<T> elementAt(long index)
Returns a Maybe that emits the single item at a specified index in a sequence of emissions from this Flowable or completes if this Flowable sequence has fewer elements than index.
final Single<T> elementAtOrError(long index)
Returns a Flowable that emits the item found at a specified index in a sequence of emissions from this Flowable or signals a NoSuchElementException if this Flowable has fewer elements than index.
static <T> Flowable<T> empty()
Returns a Flowable that emits no items to the Subscriber and immediately invokes its onComplete method.
static <T> Flowable<T> error(Callable<? extends Throwable> supplier)
Returns a Flowable that invokes a Subscriber's onError method when the Subscriber subscribes to it.
static <T> Flowable<T> error(Throwable throwable)
Returns a Flowable that invokes a Subscriber's onError method when the Subscriber subscribes to it.
final Flowable<T> filter(Predicate<? super T> predicate)
Filters items emitted by a Publisher by only emitting those that satisfy a specified predicate.
final Single<T> first(T defaultItem)
Returns a Single that emits only the very first item emitted by this Flowable, or a default item if this Flowable completes without emitting anything.
final Maybe<T> firstElement()
Returns a Maybe that emits only the very first item emitted by this Flowable or completes if this Flowable is empty.
final Single<T> firstOrError()
Returns a Single that emits only the very first item emitted by this Flowable or signals a NoSuchElementException if this Flowable is empty.
final <R> Flowable<R> flatMap(Function<? super T, ? extends Publisher<? extends R>> onNextMapper, Function<Throwable, ? extends Publisher<? extends R>> onErrorMapper, Callable<? extends Publisher<? extends R>> onCompleteSupplier, int maxConcurrency)
Returns a Flowable that applies a function to each item emitted or notification raised by the source Publisher and then flattens the Publishers returned from these functions and emits the resulting items, while limiting the maximum number of concurrent subscriptions to these Publishers.
final <U, R> Flowable<R> flatMap(Function<? super T, ? extends Publisher<? extends U>> mapper, BiFunction<? super T, ? super U, ? extends R> combiner, boolean delayErrors, int maxConcurrency)
Returns a Flowable that emits the results of a specified function to the pair of values emitted by the source Publisher and a specified collection Publisher, while limiting the maximum number of concurrent subscriptions to these Publishers.
final <U, R> Flowable<R> flatMap(Function<? super T, ? extends Publisher<? extends U>> mapper, BiFunction<? super T, ? super U, ? extends R> combiner, int maxConcurrency)
Returns a Flowable that emits the results of a specified function to the pair of values emitted by the source Publisher and a specified collection Publisher, while limiting the maximum number of concurrent subscriptions to these Publishers.
final <R> Flowable<R> flatMap(Function<? super T, ? extends Publisher<? extends R>> mapper, boolean delayErrors, int maxConcurrency)
Returns a Flowable that emits items based on applying a function that you supply to each item emitted by the source Publisher, where that function returns a Publisher, and then merging those resulting Publishers and emitting the results of this merger, while limiting the maximum number of concurrent subscriptions to these Publishers.
final <R> Flowable<R> flatMap(Function<? super T, ? extends Publisher<? extends R>> mapper, int maxConcurrency)
Returns a Flowable that emits items based on applying a function that you supply to each item emitted by the source Publisher, where that function returns a Publisher, and then merging those resulting Publishers and emitting the results of this merger, while limiting the maximum number of concurrent subscriptions to these Publishers.
final <U, R> Flowable<R> flatMap(Function<? super T, ? extends Publisher<? extends U>> mapper, BiFunction<? super T, ? super U, ? extends R> combiner)
Returns a Flowable that emits the results of a specified function to the pair of values emitted by the source Publisher and a specified collection Publisher.
final <U, R> Flowable<R> flatMap(Function<? super T, ? extends Publisher<? extends U>> mapper, BiFunction<? super T, ? super U, ? extends R> combiner, boolean delayErrors, int maxConcurrency, int bufferSize)
Returns a Flowable that emits the results of a specified function to the pair of values emitted by the source Publisher and a specified collection Publisher, while limiting the maximum number of concurrent subscriptions to these Publishers.
final <R> Flowable<R> flatMap(Function<? super T, ? extends Publisher<? extends R>> mapper, boolean delayErrors)
Returns a Flowable that emits items based on applying a function that you supply to each item emitted by the source Publisher, where that function returns a Publisher, and then merging those resulting Publishers and emitting the results of this merger.
final <U, R> Flowable<R> flatMap(Function<? super T, ? extends Publisher<? extends U>> mapper, BiFunction<? super T, ? super U, ? extends R> combiner, boolean delayErrors)
Returns a Flowable that emits the results of a specified function to the pair of values emitted by the source Publisher and a specified collection Publisher.
final <R> Flowable<R> flatMap(Function<? super T, ? extends Publisher<? extends R>> onNextMapper, Function<? super Throwable, ? extends Publisher<? extends R>> onErrorMapper, Callable<? extends Publisher<? extends R>> onCompleteSupplier)
Returns a Flowable that applies a function to each item emitted or notification raised by the source Publisher and then flattens the Publishers returned from these functions and emits the resulting items.
final <R> Flowable<R> flatMap(Function<? super T, ? extends Publisher<? extends R>> mapper)
Returns a Flowable that emits items based on applying a function that you supply to each item emitted by the source Publisher, where that function returns a Publisher, and then merging those resulting Publishers and emitting the results of this merger.
final <R> Flowable<R> flatMap(Function<? super T, ? extends Publisher<? extends R>> mapper, boolean delayErrors, int maxConcurrency, int bufferSize)
Returns a Flowable that emits items based on applying a function that you supply to each item emitted by the source Publisher, where that function returns a Publisher, and then merging those resulting Publishers and emitting the results of this merger, while limiting the maximum number of concurrent subscriptions to these Publishers.
final Completable flatMapCompletable(Function<? super T, ? extends CompletableSource> mapper)
Maps each element of the upstream Flowable into CompletableSources, subscribes to them and waits until the upstream and all CompletableSources complete.
final Completable flatMapCompletable(Function<? super T, ? extends CompletableSource> mapper, boolean delayErrors, int maxConcurrency)
Maps each element of the upstream Flowable into CompletableSources, subscribes to them and waits until the upstream and all CompletableSources complete, optionally delaying all errors.
final <U> Flowable<U> flatMapIterable(Function<? super T, ? extends Iterable<? extends U>> mapper, int bufferSize)
Returns a Flowable that merges each item emitted by the source Publisher with the values in an Iterable corresponding to that item that is generated by a selector.
final <U, V> Flowable<V> flatMapIterable(Function<? super T, ? extends Iterable<? extends U>> mapper, BiFunction<? super T, ? super U, ? extends V> resultSelector)
Returns a Flowable that emits the results of applying a function to the pair of values from the source Publisher and an Iterable corresponding to that item that is generated by a selector.
final <U> Flowable<U> flatMapIterable(Function<? super T, ? extends Iterable<? extends U>> mapper)
Returns a Flowable that merges each item emitted by the source Publisher with the values in an Iterable corresponding to that item that is generated by a selector.
final <U, V> Flowable<V> flatMapIterable(Function<? super T, ? extends Iterable<? extends U>> mapper, BiFunction<? super T, ? super U, ? extends V> resultSelector, int prefetch)
Returns a Flowable that merges each item emitted by the source Publisher with the values in an Iterable corresponding to that item that is generated by a selector, while limiting the number of concurrent subscriptions to these Publishers.
final <R> Flowable<R> flatMapMaybe(Function<? super T, ? extends MaybeSource<? extends R>> mapper, boolean delayErrors, int maxConcurrency)
Maps each element of the upstream Flowable into MaybeSources, subscribes to them and waits until the upstream and all MaybeSources complete, optionally delaying all errors.
final <R> Flowable<R> flatMapMaybe(Function<? super T, ? extends MaybeSource<? extends R>> mapper)
Maps each element of the upstream Flowable into MaybeSources, subscribes to them and waits until the upstream and all MaybeSources complete.
final <R> Flowable<R> flatMapSingle(Function<? super T, ? extends SingleSource<? extends R>> mapper, boolean delayErrors, int maxConcurrency)
Maps each element of the upstream Flowable into SingleSources, subscribes to them and waits until the upstream and all SingleSources complete, optionally delaying all errors.
final <R> Flowable<R> flatMapSingle(Function<? super T, ? extends SingleSource<? extends R>> mapper)
Maps each element of the upstream Flowable into SingleSources, subscribes to them and waits until the upstream and all SingleSources complete.
final Disposable forEach(Consumer<? super T> onNext)
Subscribes to the Publisher and receives notifications for each element.
final Disposable forEachWhile(Predicate<? super T> onNext, Consumer<? super Throwable> onError, Action onComplete)
Subscribes to the Publisher and receives notifications for each element and the terminal events until the onNext Predicate returns false.
final Disposable forEachWhile(Predicate<? super T> onNext, Consumer<? super Throwable> onError)
Subscribes to the Publisher and receives notifications for each element and error events until the onNext Predicate returns false.
final Disposable forEachWhile(Predicate<? super T> onNext)
Subscribes to the Publisher and receives notifications for each element until the onNext Predicate returns false.
static <T> Flowable<T> fromArray(T... items)
Converts an Array into a Publisher that emits the items in the Array.
static <T> Flowable<T> fromCallable(Callable<? extends T> supplier)
Returns a Flowable that, when a Subscriber subscribes to it, invokes a function you specify and then emits the value returned from that function.
static <T> Flowable<T> fromFuture(Future<? extends T> future, Scheduler scheduler)
Converts a Future, operating on a specified Scheduler, into a Publisher.
static <T> Flowable<T> fromFuture(Future<? extends T> future, long timeout, TimeUnit unit, Scheduler scheduler)
Converts a Future into a Publisher, with a timeout on the Future.
static <T> Flowable<T> fromFuture(Future<? extends T> future, long timeout, TimeUnit unit)
Converts a Future into a Publisher, with a timeout on the Future.
static <T> Flowable<T> fromFuture(Future<? extends T> future)
Converts a Future into a Publisher.
static <T> Flowable<T> fromIterable(Iterable<? extends T> source)
Converts an Iterable sequence into a Publisher that emits the items in the sequence.
static <T> Flowable<T> fromPublisher(Publisher<? extends T> source)
Converts an arbitrary Reactive-Streams Publisher into a Flowable if not already a Flowable.
static <T, S> Flowable<T> generate(Callable<S> initialState, BiFunction<S, Emitter<T>, S> generator, Consumer<? super S> disposeState)
Returns a cold, synchronous, stateful and backpressure-aware generator of values.
static <T, S> Flowable<T> generate(Callable<S> initialState, BiFunction<S, Emitter<T>, S> generator)
Returns a cold, synchronous, stateful and backpressure-aware generator of values.
static <T, S> Flowable<T> generate(Callable<S> initialState, BiConsumer<S, Emitter<T>> generator)
Returns a cold, synchronous, stateful and backpressure-aware generator of values.
static <T, S> Flowable<T> generate(Callable<S> initialState, BiConsumer<S, Emitter<T>> generator, Consumer<? super S> disposeState)
Returns a cold, synchronous, stateful and backpressure-aware generator of values.
static <T> Flowable<T> generate(Consumer<Emitter<T>> generator)
Returns a cold, synchronous, stateless and backpressure-aware generator of values.
final <K> Flowable<GroupedFlowable<K, T>> groupBy(Function<? super T, ? extends K> keySelector, boolean delayError)
Groups the items emitted by a Publisher according to a specified criterion, and emits these grouped items as GroupedFlowables.
final <K> Flowable<GroupedFlowable<K, T>> groupBy(Function<? super T, ? extends K> keySelector)
Groups the items emitted by a Publisher according to a specified criterion, and emits these grouped items as GroupedFlowables.
final <K, V> Flowable<GroupedFlowable<K, V>> groupBy(Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector)
Groups the items emitted by a Publisher according to a specified criterion, and emits these grouped items as GroupedFlowables.
final <K, V> Flowable<GroupedFlowable<K, V>> groupBy(Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector, boolean delayError)
Groups the items emitted by a Publisher according to a specified criterion, and emits these grouped items as GroupedFlowables.
final <K, V> Flowable<GroupedFlowable<K, V>> groupBy(Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector, boolean delayError, int bufferSize)
Groups the items emitted by a Publisher according to a specified criterion, and emits these grouped items as GroupedFlowables.
final <TRight, TLeftEnd, TRightEnd, R> Flowable<R> groupJoin(Publisher<? extends TRight> other, Function<? super T, ? extends Publisher<TLeftEnd>> leftEnd, Function<? super TRight, ? extends Publisher<TRightEnd>> rightEnd, BiFunction<? super T, ? super Flowable<TRight>, ? extends R> resultSelector)
Returns a Flowable that correlates two Publishers when they overlap in time and groups the results.
final Flowable<T> hide()
Hides the identity of this Flowable and its Subscription.
final Completable ignoreElements()
Ignores all items emitted by the source Publisher and only calls onComplete or onError.
static Flowable<Long> interval(long period, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits a sequential number every specified interval of time, on a specified Scheduler.
static Flowable<Long> interval(long period, TimeUnit unit)
Returns a Flowable that emits a sequential number every specified interval of time.
static Flowable<Long> interval(long initialDelay, long period, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits a 0L after the initialDelay and ever increasing numbers after each period of time thereafter, on a specified Scheduler.
static Flowable<Long> interval(long initialDelay, long period, TimeUnit unit)
Returns a Flowable that emits a 0L after the initialDelay and ever increasing numbers after each period of time thereafter.
static Flowable<Long> intervalRange(long start, long count, long initialDelay, long period, TimeUnit unit, Scheduler scheduler)
Signals a range of long values, the first after some initial delay and the rest periodically after.
static Flowable<Long> intervalRange(long start, long count, long initialDelay, long period, TimeUnit unit)
Signals a range of long values, the first after some initial delay and the rest periodically after.
final Single<Boolean> isEmpty()
Returns a Single that emits true if the source Publisher is empty, otherwise false.
final <TRight, TLeftEnd, TRightEnd, R> Flowable<R> join(Publisher<? extends TRight> other, Function<? super T, ? extends Publisher<TLeftEnd>> leftEnd, Function<? super TRight, ? extends Publisher<TRightEnd>> rightEnd, BiFunction<? super T, ? super TRight, ? extends R> resultSelector)
Correlates the items emitted by two Publishers based on overlapping durations.
static <T> Flowable<T> just(T item1, T item2, T item3, T item4, T item5, T item6)
Converts six items into a Publisher that emits those items.
static <T> Flowable<T> just(T item1, T item2)
Converts two items into a Publisher that emits those items.
static <T> Flowable<T> just(T item1, T item2, T item3, T item4)
Converts four items into a Publisher that emits those items.
static <T> Flowable<T> just(T item)
Returns a Flowable that emits a single item and then completes.
static <T> Flowable<T> just(T item1, T item2, T item3, T item4, T item5)
Converts five items into a Publisher that emits those items.
static <T> Flowable<T> just(T item1, T item2, T item3, T item4, T item5, T item6, T item7)
Converts seven items into a Publisher that emits those items.
static <T> Flowable<T> just(T item1, T item2, T item3, T item4, T item5, T item6, T item7, T item8)
Converts eight items into a Publisher that emits those items.
static <T> Flowable<T> just(T item1, T item2, T item3, T item4, T item5, T item6, T item7, T item8, T item9)
Converts nine items into a Publisher that emits those items.
static <T> Flowable<T> just(T item1, T item2, T item3, T item4, T item5, T item6, T item7, T item8, T item9, T item10)
Converts ten items into a Publisher that emits those items.
static <T> Flowable<T> just(T item1, T item2, T item3)
Converts three items into a Publisher that emits those items.
final Single<T> last(T defaultItem)
Returns a Single that emits only the last item emitted by this Flowable, or a default item if this Flowable completes without emitting any items.
final Maybe<T> lastElement()
Returns a Maybe that emits the last item emitted by this Flowable or completes if this Flowable is empty.
final Single<T> lastOrError()
Returns a Single that emits only the last item emitted by this Flowable or signals a NoSuchElementException if this Flowable is empty.
final <R> Flowable<R> lift(FlowableOperator<? extends R, ? super T> lifter)
This method requires advanced knowledge about building operators; please consider other standard composition methods first; Lifts a function to the current Publisher and returns a new Publisher that when subscribed to will pass the values of the current Publisher through the Operator function.
final <R> Flowable<R> map(Function<? super T, ? extends R> mapper)
Returns a Flowable that applies a specified function to each item emitted by the source Publisher and emits the results of these function applications.
final Flowable<Notification<T>> materialize()
Returns a Flowable that represents all of the emissions and notifications from the source Publisher into emissions marked with their original types within Notification objects.
static <T> Flowable<T> merge(Publisher<? extends Publisher<? extends T>> sources)
Flattens a Publisher that emits Publishers into a single Publisher that emits the items emitted by those Publishers, without any transformation.
static <T> Flowable<T> merge(Publisher<? extends T> source1, Publisher<? extends T> source2, Publisher<? extends T> source3)
Flattens three Publishers into a single Publisher, without any transformation.
static <T> Flowable<T> merge(Publisher<? extends Publisher<? extends T>> sources, int maxConcurrency)
Flattens a Publisher that emits Publishers into a single Publisher that emits the items emitted by those Publishers, without any transformation, while limiting the maximum number of concurrent subscriptions to these Publishers.
static <T> Flowable<T> merge(Iterable<? extends Publisher<? extends T>> sources, int maxConcurrency)
Flattens an Iterable of Publishers into one Publisher, without any transformation, while limiting the number of concurrent subscriptions to these Publishers.
static <T> Flowable<T> merge(Publisher<? extends T> source1, Publisher<? extends T> source2)
Flattens two Publishers into a single Publisher, without any transformation.
static <T> Flowable<T> merge(Iterable<? extends Publisher<? extends T>> sources)
Flattens an Iterable of Publishers into one Publisher, without any transformation.
static <T> Flowable<T> merge(Publisher<? extends T> source1, Publisher<? extends T> source2, Publisher<? extends T> source3, Publisher<? extends T> source4)
Flattens four Publishers into a single Publisher, without any transformation.
static <T> Flowable<T> merge(Iterable<? extends Publisher<? extends T>> sources, int maxConcurrency, int bufferSize)
Flattens an Iterable of Publishers into one Publisher, without any transformation, while limiting the number of concurrent subscriptions to these Publishers.
static <T> Flowable<T> mergeArray(Publisher...<? extends T> sources)
Flattens an Array of Publishers into one Publisher, without any transformation.
static <T> Flowable<T> mergeArray(int maxConcurrency, int bufferSize, Publisher...<? extends T> sources)
Flattens an Iterable of Publishers into one Publisher, without any transformation, while limiting the number of concurrent subscriptions to these Publishers.
static <T> Flowable<T> mergeArrayDelayError(int maxConcurrency, int bufferSize, Publisher...<? extends T> sources)
Flattens an array of Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from each of the source Publishers without being interrupted by an error notification from one of them, while limiting the number of concurrent subscriptions to these Publishers.
static <T> Flowable<T> mergeArrayDelayError(Publisher...<? extends T> sources)
Flattens an array of Publishers into one Flowable, in a way that allows a Subscriber to receive all successfully emitted items from each of the source Publishers without being interrupted by an error notification from one of them.
static <T> Flowable<T> mergeDelayError(Publisher<? extends T> source1, Publisher<? extends T> source2, Publisher<? extends T> source3)
Flattens three Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from all of the source Publishers without being interrupted by an error notification from one of them.
static <T> Flowable<T> mergeDelayError(Publisher<? extends Publisher<? extends T>> sources, int maxConcurrency)
Flattens a Publisher that emits Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from all of the source Publishers without being interrupted by an error notification from one of them, while limiting the number of concurrent subscriptions to these Publishers.
static <T> Flowable<T> mergeDelayError(Publisher<? extends Publisher<? extends T>> sources)
Flattens a Publisher that emits Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from all of the source Publishers without being interrupted by an error notification from one of them.
static <T> Flowable<T> mergeDelayError(Iterable<? extends Publisher<? extends T>> sources, int maxConcurrency, int bufferSize)
Flattens an Iterable of Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from each of the source Publishers without being interrupted by an error notification from one of them, while limiting the number of concurrent subscriptions to these Publishers.
static <T> Flowable<T> mergeDelayError(Publisher<? extends T> source1, Publisher<? extends T> source2)
Flattens two Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from each of the source Publishers without being interrupted by an error notification from one of them.
static <T> Flowable<T> mergeDelayError(Iterable<? extends Publisher<? extends T>> sources, int maxConcurrency)
Flattens an Iterable of Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from each of the source Publishers without being interrupted by an error notification from one of them, while limiting the number of concurrent subscriptions to these Publishers.
static <T> Flowable<T> mergeDelayError(Iterable<? extends Publisher<? extends T>> sources)
Flattens an Iterable of Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from each of the source Publishers without being interrupted by an error notification from one of them.
static <T> Flowable<T> mergeDelayError(Publisher<? extends T> source1, Publisher<? extends T> source2, Publisher<? extends T> source3, Publisher<? extends T> source4)
Flattens four Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from all of the source Publishers without being interrupted by an error notification from one of them.
final Flowable<T> mergeWith(Publisher<? extends T> other)
Flattens this and another Publisher into a single Publisher, without any transformation.
static <T> Flowable<T> never()
Returns a Flowable that never sends any items or notifications to a Subscriber.
final Flowable<T> observeOn(Scheduler scheduler, boolean delayError)
Modifies a Publisher to perform its emissions and notifications on a specified Scheduler, asynchronously with a bounded buffer and optionally delays onError notifications.
final Flowable<T> observeOn(Scheduler scheduler)
Modifies a Publisher to perform its emissions and notifications on a specified Scheduler, asynchronously with a bounded buffer of bufferSize() slots.
final Flowable<T> observeOn(Scheduler scheduler, boolean delayError, int bufferSize)
Modifies a Publisher to perform its emissions and notifications on a specified Scheduler, asynchronously with a bounded buffer of configurable size and optionally delays onError notifications.
final <U> Flowable<U> ofType(Class<U> clazz)
Filters the items emitted by a Publisher, only emitting those of the specified type.
final Flowable<T> onBackpressureBuffer(int capacity, boolean delayError, boolean unbounded)
Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to a given amount of items until they can be emitted.
final Flowable<T> onBackpressureBuffer(int capacity)
Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to a given amount of items until they can be emitted.
final Flowable<T> onBackpressureBuffer(long capacity, Action onOverflow, BackpressureOverflowStrategy overflowStrategy)
Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to a given amount of items until they can be emitted.
final Flowable<T> onBackpressureBuffer(boolean delayError)
Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer these items indefinitely until they can be emitted.
final Flowable<T> onBackpressureBuffer(int capacity, boolean delayError, boolean unbounded, Action onOverflow)
Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to a given amount of items until they can be emitted.
final Flowable<T> onBackpressureBuffer(int capacity, Action onOverflow)
Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to a given amount of items until they can be emitted.
final Flowable<T> onBackpressureBuffer(int capacity, boolean delayError)
Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to a given amount of items until they can be emitted.
final Flowable<T> onBackpressureBuffer()
Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer these items indefinitely until they can be emitted.
final Flowable<T> onBackpressureDrop()
Instructs a Publisher that is emitting items faster than its Subscriber can consume them to discard, rather than emit, those items that its Subscriber is not prepared to observe.
final Flowable<T> onBackpressureDrop(Consumer<? super T> onDrop)
Instructs a Publisher that is emitting items faster than its Subscriber can consume them to discard, rather than emit, those items that its Subscriber is not prepared to observe.
final Flowable<T> onBackpressureLatest()
Instructs a Publisher that is emitting items faster than its Subscriber can consume them to hold onto the latest value and emit that on request.
final Flowable<T> onErrorResumeNext(Publisher<? extends T> next)
Instructs a Publisher to pass control to another Publisher rather than invoking onError if it encounters an error.
final Flowable<T> onErrorResumeNext(Function<? super Throwable, ? extends Publisher<? extends T>> resumeFunction)
Instructs a Publisher to pass control to another Publisher rather than invoking onError if it encounters an error.
final Flowable<T> onErrorReturn(Function<? super Throwable, ? extends T> valueSupplier)
Instructs a Publisher to emit an item (returned by a specified function) rather than invoking onError if it encounters an error.
final Flowable<T> onErrorReturnItem(T item)
Instructs a Publisher to emit an item (returned by a specified function) rather than invoking onError if it encounters an error.
final Flowable<T> onExceptionResumeNext(Publisher<? extends T> next)
Instructs a Publisher to pass control to another Publisher rather than invoking onError if it encounters an Exception.
final Flowable<T> onTerminateDetach()
Nulls out references to the upstream producer and downstream Subscriber if the sequence is terminated or downstream cancels.
final ParallelFlowable<T> parallel()
Parallelizes the flow by creating multiple 'rails' (equal to the number of CPUs) and dispatches the upstream items to them in a round-robin fashion.
final ParallelFlowable<T> parallel(int parallelism, int prefetch)
Parallelizes the flow by creating the specified number of 'rails' and dispatches the upstream items to them in a round-robin fashion and uses the defined per-'rail' prefetch amount.
final ParallelFlowable<T> parallel(int parallelism)
Parallelizes the flow by creating the specified number of 'rails' and dispatches the upstream items to them in a round-robin fashion.
final ConnectableFlowable<T> publish()
Returns a ConnectableFlowable, which is a variety of Publisher that waits until its connect method is called before it begins emitting items to those Subscribers that have subscribed to it.
final <R> Flowable<R> publish(Function<? super Flowable<T>, ? extends Publisher<? extends R>> selector, int prefetch)
Returns a Flowable that emits the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the underlying sequence.
final ConnectableFlowable<T> publish(int bufferSize)
Returns a ConnectableFlowable, which is a variety of Publisher that waits until its connect method is called before it begins emitting items to those Subscribers that have subscribed to it.
final <R> Flowable<R> publish(Function<? super Flowable<T>, ? extends Publisher<R>> selector)
Returns a Flowable that emits the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the underlying sequence.
static Flowable<Integer> range(int start, int count)
Returns a Flowable that emits a sequence of Integers within a specified range.
static Flowable<Long> rangeLong(long start, long count)
Returns a Flowable that emits a sequence of Longs within a specified range.
final Flowable<T> rebatchRequests(int n)
Requests n initially from the upstream and then 75% of n subsequently after 75% of n values have been emitted to the downstream.
final Maybe<T> reduce(BiFunction<T, T, T> reducer)
Returns a Maybe that applies a specified accumulator function to the first item emitted by a source Publisher, then feeds the result of that function along with the second item emitted by the source Publisher into the same function, and so on until all items have been emitted by the source Publisher, and emits the final result from the final call to your function as its sole item.
final <R> Single<R> reduce(R seed, BiFunction<R, ? super T, R> reducer)
Returns a Single that applies a specified accumulator function to the first item emitted by a source Publisher and a specified seed value, then feeds the result of that function along with the second item emitted by a Publisher into the same function, and so on until all items have been emitted by the source Publisher, emitting the final result from the final call to your function as its sole item.
final <R> Single<R> reduceWith(Callable<R> seedSupplier, BiFunction<R, ? super T, R> reducer)
Returns a Single that applies a specified accumulator function to the first item emitted by a source Publisher and a seed value derived from calling a specified seedSupplier, then feeds the result of that function along with the second item emitted by a Publisher into the same function, and so on until all items have been emitted by the source Publisher, emitting the final result from the final call to your function as its sole item.
final Flowable<T> repeat()
Returns a Flowable that repeats the sequence of items emitted by the source Publisher indefinitely.
final Flowable<T> repeat(long times)
Returns a Flowable that repeats the sequence of items emitted by the source Publisher at most count times.
final Flowable<T> repeatUntil(BooleanSupplier stop)
Returns a Flowable that repeats the sequence of items emitted by the source Publisher until the provided stop function returns true.
final Flowable<T> repeatWhen(Function<? super Flowable<Object>, ? extends Publisher<?>> handler)
Returns a Flowable that emits the same values as the source Publisher with the exception of an onComplete.
final <R> Flowable<R> replay(Function<? super Flowable<T>, ? extends Publisher<R>> selector, Scheduler scheduler)
Returns a Flowable that emits items that are the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher.
final <R> Flowable<R> replay(Function<? super Flowable<T>, ? extends Publisher<R>> selector, int bufferSize)
Returns a Flowable that emits items that are the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, replaying bufferSize notifications.
final <R> Flowable<R> replay(Function<? super Flowable<T>, ? extends Publisher<R>> selector, int bufferSize, Scheduler scheduler)
Returns a Flowable that emits items that are the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, replaying a maximum of bufferSize items.
final ConnectableFlowable<T> replay(int bufferSize, long time, TimeUnit unit)
Returns a ConnectableFlowable that shares a single subscription to the source Publisher and replays at most bufferSize items that were emitted during a specified time window.
final ConnectableFlowable<T> replay(int bufferSize, long time, TimeUnit unit, Scheduler scheduler)
Returns a ConnectableFlowable that shares a single subscription to the source Publisher and that replays a maximum of bufferSize items that are emitted within a specified time window.
final ConnectableFlowable<T> replay(int bufferSize)
Returns a ConnectableFlowable that shares a single subscription to the source Publisher that replays at most bufferSize items emitted by that Publisher.
final ConnectableFlowable<T> replay()
Returns a ConnectableFlowable that shares a single subscription to the underlying Publisher that will replay all of its items and notifications to any future Subscriber.
final <R> Flowable<R> replay(Function<? super Flowable<T>, ? extends Publisher<R>> selector)
Returns a Flowable that emits items that are the results of invoking a specified selector on the items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher.
final <R> Flowable<R> replay(Function<? super Flowable<T>, ? extends Publisher<R>> selector, int bufferSize, long time, TimeUnit unit)
Returns a Flowable that emits items that are the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, replaying no more than bufferSize items that were emitted within a specified time window.
final <R> Flowable<R> replay(Function<? super Flowable<T>, ? extends Publisher<R>> selector, long time, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits items that are the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, replaying all items that were emitted within a specified time window.
final ConnectableFlowable<T> replay(long time, TimeUnit unit)
Returns a ConnectableFlowable that shares a single subscription to the source Publisher and replays all items emitted by that Publisher within a specified time window.
final ConnectableFlowable<T> replay(Scheduler scheduler)
Returns a ConnectableFlowable that shares a single subscription to the source Publisher that will replay all of its items and notifications to any future Subscriber on the given Scheduler.
final ConnectableFlowable<T> replay(int bufferSize, Scheduler scheduler)
Returns a ConnectableFlowable that shares a single subscription to the source Publisher and replays at most bufferSize items emitted by that Publisher.
final ConnectableFlowable<T> replay(long time, TimeUnit unit, Scheduler scheduler)
Returns a ConnectableFlowable that shares a single subscription to the source Publisher and replays all items emitted by that Publisher within a specified time window.
final <R> Flowable<R> replay(Function<? super Flowable<T>, ? extends Publisher<R>> selector, long time, TimeUnit unit)
Returns a Flowable that emits items that are the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, replaying all items that were emitted within a specified time window.
final <R> Flowable<R> replay(Function<? super Flowable<T>, ? extends Publisher<R>> selector, int bufferSize, long time, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits items that are the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, replaying no more than bufferSize items that were emitted within a specified time window.
final Flowable<T> retry()
Returns a Flowable that mirrors the source Publisher, resubscribing to it if it calls onError (infinite retry count).
final Flowable<T> retry(long count)
Returns a Flowable that mirrors the source Publisher, resubscribing to it if it calls onError up to a specified number of retries.
final Flowable<T> retry(long times, Predicate<? super Throwable> predicate)
Retries at most times or until the predicate returns false, whichever happens first.
final Flowable<T> retry(BiPredicate<? super Integer, ? super Throwable> predicate)
Returns a Flowable that mirrors the source Publisher, resubscribing to it if it calls onError and the predicate returns true for that specific exception and retry count.
final Flowable<T> retry(Predicate<? super Throwable> predicate)
Retries the current Flowable if the predicate returns true.
final Flowable<T> retryUntil(BooleanSupplier stop)
Retries until the given stop function returns true.
final Flowable<T> retryWhen(Function<? super Flowable<Throwable>, ? extends Publisher<?>> handler)
Returns a Flowable that emits the same values as the source Publisher with the exception of an onError.
final void safeSubscribe(Subscriber<? super T> s)
Subscribes to the current Flowable and wraps the given Subscriber into a SafeSubscriber (if not already a SafeSubscriber) that deals with exceptions thrown by a misbehaving Subscriber (that doesn't follow the Reactive-Streams specification).
final Flowable<T> sample(long period, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits the most recently emitted item (if any) emitted by the source Publisher within periodic time intervals, where the intervals are defined on a particular Scheduler.
final Flowable<T> sample(long period, TimeUnit unit)
Returns a Flowable that emits the most recently emitted item (if any) emitted by the source Publisher within periodic time intervals.
final <U> Flowable<T> sample(Publisher<U> sampler)
Returns a Flowable that, when the specified sampler Publisher emits an item or completes, emits the most recently emitted item (if any) emitted by the source Publisher since the previous emission from the sampler Publisher.
final Flowable<T> sample(long period, TimeUnit unit, boolean emitLast)
Returns a Flowable that emits the most recently emitted item (if any) emitted by the source Publisher within periodic time intervals and optionally emit the very last upstream item when the upstream completes.
final Flowable<T> sample(long period, TimeUnit unit, Scheduler scheduler, boolean emitLast)
Returns a Flowable that emits the most recently emitted item (if any) emitted by the source Publisher within periodic time intervals, where the intervals are defined on a particular Scheduler and optionally emit the very last upstream item when the upstream completes.
final <U> Flowable<T> sample(Publisher<U> sampler, boolean emitLast)
Returns a Flowable that, when the specified sampler Publisher emits an item or completes, emits the most recently emitted item (if any) emitted by the source Publisher since the previous emission from the sampler Publisher and optionally emit the very last upstream item when the upstream or other Publisher complete.
final <R> Flowable<R> scan(R initialValue, BiFunction<R, ? super T, R> accumulator)
Returns a Flowable that applies a specified accumulator function to the first item emitted by a source Publisher and a seed value, then feeds the result of that function along with the second item emitted by the source Publisher into the same function, and so on until all items have been emitted by the source Publisher, emitting the result of each of these iterations.
final Flowable<T> scan(BiFunction<T, T, T> accumulator)
Returns a Flowable that applies a specified accumulator function to the first item emitted by a source Publisher, then feeds the result of that function along with the second item emitted by the source Publisher into the same function, and so on until all items have been emitted by the source Publisher, emitting the result of each of these iterations.
final <R> Flowable<R> scanWith(Callable<R> seedSupplier, BiFunction<R, ? super T, R> accumulator)
Returns a Flowable that applies a specified accumulator function to the first item emitted by a source Publisher and a seed value, then feeds the result of that function along with the second item emitted by the source Publisher into the same function, and so on until all items have been emitted by the source Publisher, emitting the result of each of these iterations.
static <T> Single<Boolean> sequenceEqual(Publisher<? extends T> source1, Publisher<? extends T> source2, BiPredicate<? super T, ? super T> isEqual, int bufferSize)
Returns a Single that emits a Boolean value that indicates whether two Publisher sequences are the same by comparing the items emitted by each Publisher pairwise based on the results of a specified equality function.
static <T> Single<Boolean> sequenceEqual(Publisher<? extends T> source1, Publisher<? extends T> source2, int bufferSize)
Returns a Single that emits a Boolean value that indicates whether two Publisher sequences are the same by comparing the items emitted by each Publisher pairwise.
static <T> Single<Boolean> sequenceEqual(Publisher<? extends T> source1, Publisher<? extends T> source2)
Returns a Single that emits a Boolean value that indicates whether two Publisher sequences are the same by comparing the items emitted by each Publisher pairwise.
static <T> Single<Boolean> sequenceEqual(Publisher<? extends T> source1, Publisher<? extends T> source2, BiPredicate<? super T, ? super T> isEqual)
Returns a Single that emits a Boolean value that indicates whether two Publisher sequences are the same by comparing the items emitted by each Publisher pairwise based on the results of a specified equality function.
final Flowable<T> serialize()
Forces a Publisher's emissions and notifications to be serialized and for it to obey the Publisher contract in other ways.
final Flowable<T> share()
Returns a new Publisher that multicasts (shares) the original Publisher.
final Single<T> single(T defaultItem)
Returns a Single that emits the single item emitted by the source Publisher, if that Publisher emits only a single item, or a default item if the source Publisher emits no items.
final Maybe<T> singleElement()
Returns a Maybe that completes if this Flowable is empty, signals one item if this Flowable signals exactly one item or signals an IllegalArgumentException if this Flowable signals more than one item.
final Single<T> singleOrError()
Returns a Single that emits the single item emitted by this Flowable, if this Flowable emits only a single item, otherwise if this Flowable completes without emitting any items a NoSuchElementException will be signalled and if this Flowable emits more than one item, an IllegalArgumentException will be signalled.
final Flowable<T> skip(long count)
Returns a Flowable that skips the first count items emitted by the source Publisher and emits the remainder.
final Flowable<T> skip(long time, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that skips values emitted by the source Publisher before a specified time window on a specified Scheduler elapses.
final Flowable<T> skip(long time, TimeUnit unit)
Returns a Flowable that skips values emitted by the source Publisher before a specified time window elapses.
final Flowable<T> skipLast(int count)
Returns a Flowable that drops a specified number of items from the end of the sequence emitted by the source Publisher.
final Flowable<T> skipLast(long time, TimeUnit unit)
Returns a Flowable that drops items emitted by the source Publisher during a specified time window before the source completes.
final Flowable<T> skipLast(long time, TimeUnit unit, boolean delayError)
Returns a Flowable that drops items emitted by the source Publisher during a specified time window before the source completes.
final Flowable<T> skipLast(long time, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that drops items emitted by the source Publisher during a specified time window (defined on a specified scheduler) before the source completes.
final Flowable<T> skipLast(long time, TimeUnit unit, Scheduler scheduler, boolean delayError, int bufferSize)
Returns a Flowable that drops items emitted by the source Publisher during a specified time window (defined on a specified scheduler) before the source completes.
final Flowable<T> skipLast(long time, TimeUnit unit, Scheduler scheduler, boolean delayError)
Returns a Flowable that drops items emitted by the source Publisher during a specified time window (defined on a specified scheduler) before the source completes.
final <U> Flowable<T> skipUntil(Publisher<U> other)
Returns a Flowable that skips items emitted by the source Publisher until a second Publisher emits an item.
final Flowable<T> skipWhile(Predicate<? super T> predicate)
Returns a Flowable that skips all items emitted by the source Publisher as long as a specified condition holds true, but emits all further source items as soon as the condition becomes false.
final Flowable<T> sorted()
Returns a Flowable that emits the events emitted by source Publisher, in a sorted order.
final Flowable<T> sorted(Comparator<? super T> sortFunction)
Returns a Flowable that emits the events emitted by source Publisher, in a sorted order based on a specified comparison function.
final Flowable<T> startWith(Publisher<? extends T> other)
Returns a Flowable that emits the items in a specified Publisher before it begins to emit items emitted by the source Publisher.
final Flowable<T> startWith(Iterable<? extends T> items)
Returns a Flowable that emits the items in a specified Iterable before it begins to emit items emitted by the source Publisher.
final Flowable<T> startWith(T value)
Returns a Flowable that emits a specified item before it begins to emit items emitted by the source Publisher.
final Flowable<T> startWithArray(T... items)
Returns a Flowable that emits the specified items before it begins to emit items emitted by the source Publisher.
final void subscribe(FlowableSubscriber<? super T> s)
Establish a connection between this Flowable and the given FlowableSubscriber and start streaming events based on the demand of the FlowableSubscriber.
final void subscribe(Subscriber<? super T> s)
final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super Throwable> onError, Action onComplete)
Subscribes to a Publisher and provides callbacks to handle the items it emits and any error or completion notification it issues.
final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super Throwable> onError, Action onComplete, Consumer<? super Subscription> onSubscribe)
Subscribes to a Publisher and provides callbacks to handle the items it emits and any error or completion notification it issues.
final Disposable subscribe()
Subscribes to a Publisher and ignores onNext and onComplete emissions.
final Disposable subscribe(Consumer<? super T> onNext)
Subscribes to a Publisher and provides a callback to handle the items it emits.
final Disposable subscribe(Consumer<? super T> onNext, Consumer<? super Throwable> onError)
Subscribes to a Publisher and provides callbacks to handle the items it emits and any error notification it issues.
final Flowable<T> subscribeOn(Scheduler scheduler)
Asynchronously subscribes Subscribers to this Publisher on the specified Scheduler.
final Flowable<T> subscribeOn(Scheduler scheduler, boolean requestOn)
Asynchronously subscribes Subscribers to this Publisher on the specified Scheduler optionally reroutes requests from other threads to the same Scheduler thread.
final <E extends Subscriber<? super T>> E subscribeWith(E subscriber)
Subscribes a given Subscriber (subclass) to this Flowable and returns the given Subscriber as is.
final Flowable<T> switchIfEmpty(Publisher<? extends T> other)
Returns a Flowable that emits the items emitted by the source Publisher or the items of an alternate Publisher if the source Publisher is empty.
final <R> Flowable<R> switchMap(Function<? super T, ? extends Publisher<? extends R>> mapper, int bufferSize)
Returns a new Publisher by applying a function that you supply to each item emitted by the source Publisher that returns a Publisher, and then emitting the items emitted by the most recently emitted of these Publishers.
final <R> Flowable<R> switchMap(Function<? super T, ? extends Publisher<? extends R>> mapper)
Returns a new Publisher by applying a function that you supply to each item emitted by the source Publisher that returns a Publisher, and then emitting the items emitted by the most recently emitted of these Publishers.
final <R> Flowable<R> switchMapDelayError(Function<? super T, ? extends Publisher<? extends R>> mapper)
Returns a new Publisher by applying a function that you supply to each item emitted by the source Publisher that returns a Publisher, and then emitting the items emitted by the most recently emitted of these Publishers and delays any error until all Publishers terminate.
final <R> Flowable<R> switchMapDelayError(Function<? super T, ? extends Publisher<? extends R>> mapper, int bufferSize)
Returns a new Publisher by applying a function that you supply to each item emitted by the source Publisher that returns a Publisher, and then emitting the items emitted by the most recently emitted of these Publishers and delays any error until all Publishers terminate.
static <T> Flowable<T> switchOnNext(Publisher<? extends Publisher<? extends T>> sources, int bufferSize)
Converts a Publisher that emits Publishers into a Publisher that emits the items emitted by the most recently emitted of those Publishers.
static <T> Flowable<T> switchOnNext(Publisher<? extends Publisher<? extends T>> sources)
Converts a Publisher that emits Publishers into a Publisher that emits the items emitted by the most recently emitted of those Publishers.
static <T> Flowable<T> switchOnNextDelayError(Publisher<? extends Publisher<? extends T>> sources, int prefetch)
Converts a Publisher that emits Publishers into a Publisher that emits the items emitted by the most recently emitted of those Publishers and delays any exception until all Publishers terminate.
static <T> Flowable<T> switchOnNextDelayError(Publisher<? extends Publisher<? extends T>> sources)
Converts a Publisher that emits Publishers into a Publisher that emits the items emitted by the most recently emitted of those Publishers and delays any exception until all Publishers terminate.
final Flowable<T> take(long time, TimeUnit unit)
Returns a Flowable that emits those items emitted by source Publisher before a specified time runs out.
final Flowable<T> take(long time, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits those items emitted by source Publisher before a specified time (on a specified Scheduler) runs out.
final Flowable<T> take(long count)
Returns a Flowable that emits only the first count items emitted by the source Publisher.
final Flowable<T> takeLast(long time, TimeUnit unit, boolean delayError)
Returns a Flowable that emits the items from the source Publisher that were emitted in a specified window of time before the Publisher completed.
final Flowable<T> takeLast(long count, long time, TimeUnit unit, Scheduler scheduler, boolean delayError, int bufferSize)
Returns a Flowable that emits at most a specified number of items from the source Publisher that were emitted in a specified window of time before the Publisher completed, where the timing information is provided by a given Scheduler.
final Flowable<T> takeLast(long time, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits the items from the source Publisher that were emitted in a specified window of time before the Publisher completed, where the timing information is provided by a specified Scheduler.
final Flowable<T> takeLast(long time, TimeUnit unit, Scheduler scheduler, boolean delayError)
Returns a Flowable that emits the items from the source Publisher that were emitted in a specified window of time before the Publisher completed, where the timing information is provided by a specified Scheduler.
final Flowable<T> takeLast(int count)
Returns a Flowable that emits at most the last count items emitted by the source Publisher.
final Flowable<T> takeLast(long time, TimeUnit unit)
Returns a Flowable that emits the items from the source Publisher that were emitted in a specified window of time before the Publisher completed.
final Flowable<T> takeLast(long count, long time, TimeUnit unit)
Returns a Flowable that emits at most a specified number of items from the source Publisher that were emitted in a specified window of time before the Publisher completed.
final Flowable<T> takeLast(long count, long time, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits at most a specified number of items from the source Publisher that were emitted in a specified window of time before the Publisher completed, where the timing information is provided by a given Scheduler.
final Flowable<T> takeLast(long time, TimeUnit unit, Scheduler scheduler, boolean delayError, int bufferSize)
Returns a Flowable that emits the items from the source Publisher that were emitted in a specified window of time before the Publisher completed, where the timing information is provided by a specified Scheduler.
final <U> Flowable<T> takeUntil(Publisher<U> other)
Returns a Flowable that emits the items emitted by the source Publisher until a second Publisher emits an item.
final Flowable<T> takeUntil(Predicate<? super T> stopPredicate)
Returns a Flowable that emits items emitted by the source Publisher, checks the specified predicate for each item, and then completes when the condition is satisfied.
final Flowable<T> takeWhile(Predicate<? super T> predicate)
Returns a Flowable that emits items emitted by the source Publisher so long as each item satisfied a specified condition, and then completes as soon as this condition is not satisfied.
final TestSubscriber<T> test(long initialRequest)
Creates a TestSubscriber with the given initial request amount and subscribes it to this Flowable.
final TestSubscriber<T> test()
Creates a TestSubscriber that requests Long.MAX_VALUE and subscribes it to this Flowable.
final TestSubscriber<T> test(long initialRequest, boolean cancel)
Creates a TestSubscriber with the given initial request amount, optionally cancels it before the subscription and subscribes it to this Flowable.
final Flowable<T> throttleFirst(long windowDuration, TimeUnit unit)
Returns a Flowable that emits only the first item emitted by the source Publisher during sequential time windows of a specified duration.
final Flowable<T> throttleFirst(long skipDuration, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits only the first item emitted by the source Publisher during sequential time windows of a specified duration, where the windows are managed by a specified Scheduler.
final Flowable<T> throttleLast(long intervalDuration, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits only the last item emitted by the source Publisher during sequential time windows of a specified duration, where the duration is governed by a specified Scheduler.
final Flowable<T> throttleLast(long intervalDuration, TimeUnit unit)
Returns a Flowable that emits only the last item emitted by the source Publisher during sequential time windows of a specified duration.
final Flowable<T> throttleWithTimeout(long timeout, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that only emits those items emitted by the source Publisher that are not followed by another emitted item within a specified time window, where the time window is governed by a specified Scheduler.
final Flowable<T> throttleWithTimeout(long timeout, TimeUnit unit)
Returns a Flowable that only emits those items emitted by the source Publisher that are not followed by another emitted item within a specified time window.
final Flowable<Timed<T>> timeInterval(Scheduler scheduler)
Returns a Flowable that emits records of the time interval between consecutive items emitted by the source Publisher, where this interval is computed on a specified Scheduler.
final Flowable<Timed<T>> timeInterval(TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits records of the time interval between consecutive items emitted by the source Publisher, where this interval is computed on a specified Scheduler.
final Flowable<Timed<T>> timeInterval()
Returns a Flowable that emits records of the time interval between consecutive items emitted by the source Publisher.
final Flowable<Timed<T>> timeInterval(TimeUnit unit)
Returns a Flowable that emits records of the time interval between consecutive items emitted by the source Publisher.
final <V> Flowable<T> timeout(Function<? super T, ? extends Publisher<V>> itemTimeoutIndicator)
Returns a Flowable that mirrors the source Publisher, but notifies Subscribers of a TimeoutException if an item emitted by the source Publisher doesn't arrive within a window of time after the emission of the previous item, where that period of time is measured by a Publisher that is a function of the previous item.
final <U, V> Flowable<T> timeout(Publisher<U> firstTimeoutIndicator, Function<? super T, ? extends Publisher<V>> itemTimeoutIndicator)
Returns a Flowable that mirrors the source Publisher, but notifies Subscribers of a TimeoutException if either the first item emitted by the source Publisher or any subsequent item doesn't arrive within time windows defined by other Publishers.
final Flowable<T> timeout(long timeout, TimeUnit timeUnit)
Returns a Flowable that mirrors the source Publisher but applies a timeout policy for each emitted item.
final <U, V> Flowable<T> timeout(Publisher<U> firstTimeoutIndicator, Function<? super T, ? extends Publisher<V>> itemTimeoutIndicator, Publisher<? extends T> other)
Returns a Flowable that mirrors the source Publisher, but switches to a fallback Publisher if either the first item emitted by the source Publisher or any subsequent item doesn't arrive within time windows defined by other Publishers.
final <V> Flowable<T> timeout(Function<? super T, ? extends Publisher<V>> itemTimeoutIndicator, Flowable<? extends T> other)
Returns a Flowable that mirrors the source Publisher, but that switches to a fallback Publisher if an item emitted by the source Publisher doesn't arrive within a window of time after the emission of the previous item, where that period of time is measured by a Publisher that is a function of the previous item.
final Flowable<T> timeout(long timeout, TimeUnit timeUnit, Publisher<? extends T> other)
Returns a Flowable that mirrors the source Publisher but applies a timeout policy for each emitted item.
final Flowable<T> timeout(long timeout, TimeUnit timeUnit, Scheduler scheduler, Publisher<? extends T> other)
Returns a Flowable that mirrors the source Publisher but applies a timeout policy for each emitted item using a specified Scheduler.
final Flowable<T> timeout(long timeout, TimeUnit timeUnit, Scheduler scheduler)
Returns a Flowable that mirrors the source Publisher but applies a timeout policy for each emitted item, where this policy is governed on a specified Scheduler.
static Flowable<Long> timer(long delay, TimeUnit unit)
Returns a Flowable that emits 0L after a specified delay, and then completes.
static Flowable<Long> timer(long delay, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits 0L after a specified delay, on a specified Scheduler, and then completes.
final Flowable<Timed<T>> timestamp(TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits each item emitted by the source Publisher, wrapped in a Timed object whose timestamps are provided by a specified Scheduler.
final Flowable<Timed<T>> timestamp()
Returns a Flowable that emits each item emitted by the source Publisher, wrapped in a Timed object.
final Flowable<Timed<T>> timestamp(Scheduler scheduler)
Returns a Flowable that emits each item emitted by the source Publisher, wrapped in a Timed object whose timestamps are provided by a specified Scheduler.
final Flowable<Timed<T>> timestamp(TimeUnit unit)
Returns a Flowable that emits each item emitted by the source Publisher, wrapped in a Timed object.
final <R> R to(Function<? super Flowable<T>, R> converter)
Calls the specified converter function during assembly time and returns its resulting value.
final Future<T> toFuture()
Returns a Future representing the single value emitted by this Flowable.
final <U extends Collection<? super T>> Single<U> toList(Callable<U> collectionSupplier)
Returns a Single that emits a single item, a list composed of all the items emitted by the finite source Publisher.
final Single<List<T>> toList()
Returns a Single that emits a single item, a list composed of all the items emitted by the finite upstream source Publisher.
final Single<List<T>> toList(int capacityHint)
Returns a Single that emits a single item, a list composed of all the items emitted by the finite source Publisher.
final <K> Single<Map<K, T>> toMap(Function<? super T, ? extends K> keySelector)
Returns a Single that emits a single HashMap containing all items emitted by the source Publisher, mapped by the keys returned by a specified keySelector function.
final <K, V> Single<Map<K, V>> toMap(Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector, Callable<? extends Map<K, V>> mapSupplier)
Returns a Single that emits a single Map, returned by a specified mapFactory function, that contains keys and values extracted from the items emitted by the source Publisher.
final <K, V> Single<Map<K, V>> toMap(Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector)
Returns a Single that emits a single HashMap containing values corresponding to items emitted by the source Publisher, mapped by the keys returned by a specified keySelector function.
final <K> Single<Map<K, Collection<T>>> toMultimap(Function<? super T, ? extends K> keySelector)
Returns a Single that emits a single HashMap that contains an ArrayList of items emitted by the source Publisher keyed by a specified keySelector function.
final <K, V> Single<Map<K, Collection<V>>> toMultimap(Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector, Callable<Map<K, Collection<V>>> mapSupplier)
Returns a Single that emits a single Map, returned by a specified mapFactory function, that contains an ArrayList of values, extracted by a specified valueSelector function from items emitted by the source Publisher and keyed by the keySelector function.
final <K, V> Single<Map<K, Collection<V>>> toMultimap(Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector)
Returns a Single that emits a single HashMap that contains an ArrayList of values extracted by a specified valueSelector function from items emitted by the source Publisher, keyed by a specified keySelector function.
final <K, V> Single<Map<K, Collection<V>>> toMultimap(Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector, Callable<? extends Map<K, Collection<V>>> mapSupplier, Function<? super K, ? extends Collection<? super V>> collectionFactory)
Returns a Single that emits a single Map, returned by a specified mapFactory function, that contains a custom collection of values, extracted by a specified valueSelector function from items emitted by the source Publisher, and keyed by the keySelector function.
final Observable<T> toObservable()
Converts the current Flowable into a non-backpressured Observable.
final Single<List<T>> toSortedList(Comparator<? super T> comparator, int capacityHint)
Returns a Single that emits a list that contains the items emitted by the source Publisher, in a sorted order based on a specified comparison function.
final Single<List<T>> toSortedList(Comparator<? super T> comparator)
Returns a Single that emits a list that contains the items emitted by the source Publisher, in a sorted order based on a specified comparison function.
final Single<List<T>> toSortedList()
Returns a Single that emits a list that contains the items emitted by the source Publisher, in a sorted order.
final Single<List<T>> toSortedList(int capacityHint)
Returns a Flowable that emits a list that contains the items emitted by the source Publisher, in a sorted order.
static <T> Flowable<T> unsafeCreate(Publisher<T> onSubscribe)
Create a Flowable by wrapping a Publisher which has to be implemented according to the Reactive-Streams specification by handling backpressure and cancellation correctly; no safeguards are provided by the Flowable itself.
final Flowable<T> unsubscribeOn(Scheduler scheduler)
Modifies the source Publisher so that subscribers will cancel it on a specified Scheduler.
static <T, D> Flowable<T> using(Callable<? extends D> resourceSupplier, Function<? super D, ? extends Publisher<? extends T>> sourceSupplier, Consumer<? super D> resourceDisposer)
Constructs a Publisher that creates a dependent resource object which is disposed of on cancellation.
static <T, D> Flowable<T> using(Callable<? extends D> resourceSupplier, Function<? super D, ? extends Publisher<? extends T>> sourceSupplier, Consumer<? super D> resourceDisposer, boolean eager)
Constructs a Publisher that creates a dependent resource object which is disposed of just before termination if you have set disposeEagerly to true and cancellation does not occur before termination.
final <U, V> Flowable<Flowable<T>> window(Publisher<U> openingIndicator, Function<? super U, ? extends Publisher<V>> closingIndicator)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final Flowable<Flowable<T>> window(long timespan, long timeskip, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final Flowable<Flowable<T>> window(long timespan, TimeUnit unit, Scheduler scheduler, long count, boolean restart)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final Flowable<Flowable<T>> window(long timespan, TimeUnit unit, Scheduler scheduler, long count, boolean restart, int bufferSize)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final <B> Flowable<Flowable<T>> window(Callable<? extends Publisher<B>> boundaryIndicatorSupplier, int bufferSize)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final Flowable<Flowable<T>> window(long timespan, TimeUnit unit, Scheduler scheduler)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final Flowable<Flowable<T>> window(long timespan, long timeskip, TimeUnit unit, Scheduler scheduler, int bufferSize)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final <U, V> Flowable<Flowable<T>> window(Publisher<U> openingIndicator, Function<? super U, ? extends Publisher<V>> closingIndicator, int bufferSize)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final <B> Flowable<Flowable<T>> window(Publisher<B> boundaryIndicator, int bufferSize)
Returns a Flowable that emits non-overlapping windows of items it collects from the source Publisher where the boundary of each window is determined by the items emitted from a specified boundary-governing Publisher.
final Flowable<Flowable<T>> window(long count)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final Flowable<Flowable<T>> window(long count, long skip)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final Flowable<Flowable<T>> window(long timespan, long timeskip, TimeUnit unit)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final <B> Flowable<Flowable<T>> window(Callable<? extends Publisher<B>> boundaryIndicatorSupplier)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final Flowable<Flowable<T>> window(long timespan, TimeUnit unit, long count)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final Flowable<Flowable<T>> window(long timespan, TimeUnit unit, long count, boolean restart)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final <B> Flowable<Flowable<T>> window(Publisher<B> boundaryIndicator)
Returns a Flowable that emits non-overlapping windows of items it collects from the source Publisher where the boundary of each window is determined by the items emitted from a specified boundary-governing Publisher.
final Flowable<Flowable<T>> window(long timespan, TimeUnit unit, Scheduler scheduler, long count)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final Flowable<Flowable<T>> window(long timespan, TimeUnit unit)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final Flowable<Flowable<T>> window(long count, long skip, int bufferSize)
Returns a Flowable that emits windows of items it collects from the source Publisher.
final <U, R> Flowable<R> withLatestFrom(Publisher<? extends U> other, BiFunction<? super T, ? super U, ? extends R> combiner)
Merges the specified Publisher into this Publisher sequence by using the resultSelector function only when the source Publisher (this instance) emits an item.
final <T1, T2, T3, R> Flowable<R> withLatestFrom(Publisher<T1> source1, Publisher<T2> source2, Publisher<T3> source3, Function4<? super T, ? super T1, ? super T2, ? super T3, R> combiner)
Combines the value emission from this Publisher with the latest emissions from the other Publishers via a function to produce the output item.
final <R> Flowable<R> withLatestFrom(Publisher[]<?> others, Function<? super Object[], R> combiner)
Combines the value emission from this Publisher with the latest emissions from the other Publishers via a function to produce the output item.
final <T1, T2, R> Flowable<R> withLatestFrom(Publisher<T1> source1, Publisher<T2> source2, Function3<? super T, ? super T1, ? super T2, R> combiner)
Combines the value emission from this Publisher with the latest emissions from the other Publishers via a function to produce the output item.
final <T1, T2, T3, T4, R> Flowable<R> withLatestFrom(Publisher<T1> source1, Publisher<T2> source2, Publisher<T3> source3, Publisher<T4> source4, Function5<? super T, ? super T1, ? super T2, ? super T3, ? super T4, R> combiner)
Combines the value emission from this Publisher with the latest emissions from the other Publishers via a function to produce the output item.
final <R> Flowable<R> withLatestFrom(Iterable<? extends Publisher<?>> others, Function<? super Object[], R> combiner)
Combines the value emission from this Publisher with the latest emissions from the other Publishers via a function to produce the output item.
static <T1, T2, T3, T4, T5, T6, R> Flowable<R> zip(Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Publisher<? extends T6> source6, Function6<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? extends R> zipper)
Returns a Flowable that emits the results of a specified combiner function applied to combinations of six items emitted, in sequence, by six other Publishers.
static <T1, T2, T3, T4, T5, T6, T7, T8, R> Flowable<R> zip(Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Publisher<? extends T6> source6, Publisher<? extends T7> source7, Publisher<? extends T8> source8, Function8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R> zipper)
Returns a Flowable that emits the results of a specified combiner function applied to combinations of eight items emitted, in sequence, by eight other Publishers.
static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> Flowable<R> zip(Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Publisher<? extends T6> source6, Publisher<? extends T7> source7, Publisher<? extends T8> source8, Publisher<? extends T9> source9, Function9<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? extends R> zipper)
Returns a Flowable that emits the results of a specified combiner function applied to combinations of nine items emitted, in sequence, by nine other Publishers.
static <T, R> Flowable<R> zip(Publisher<? extends Publisher<? extends T>> sources, Function<? super Object[], ? extends R> zipper)
Returns a Flowable that emits the results of a specified combiner function applied to combinations of n items emitted, in sequence, by the n Publishers emitted by a specified Publisher.
static <T1, T2, T3, T4, T5, R> Flowable<R> zip(Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Function5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> zipper)
Returns a Flowable that emits the results of a specified combiner function applied to combinations of five items emitted, in sequence, by five other Publishers.
static <T1, T2, T3, T4, T5, T6, T7, R> Flowable<R> zip(Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Publisher<? extends T6> source6, Publisher<? extends T7> source7, Function7<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? extends R> zipper)
Returns a Flowable that emits the results of a specified combiner function applied to combinations of seven items emitted, in sequence, by seven other Publishers.
static <T1, T2, T3, R> Flowable<R> zip(Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Function3<? super T1, ? super T2, ? super T3, ? extends R> zipper)
Returns a Flowable that emits the results of a specified combiner function applied to combinations of three items emitted, in sequence, by three other Publishers.
static <T1, T2, T3, T4, R> Flowable<R> zip(Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Function4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> zipper)
Returns a Flowable that emits the results of a specified combiner function applied to combinations of four items emitted, in sequence, by four other Publishers.
static <T1, T2, R> Flowable<R> zip(Publisher<? extends T1> source1, Publisher<? extends T2> source2, BiFunction<? super T1, ? super T2, ? extends R> zipper, boolean delayError, int bufferSize)
Returns a Flowable that emits the results of a specified combiner function applied to combinations of two items emitted, in sequence, by two other Publishers.
static <T1, T2, R> Flowable<R> zip(Publisher<? extends T1> source1, Publisher<? extends T2> source2, BiFunction<? super T1, ? super T2, ? extends R> zipper, boolean delayError)
Returns a Flowable that emits the results of a specified combiner function applied to combinations of two items emitted, in sequence, by two other Publishers.
static <T, R> Flowable<R> zip(Iterable<? extends Publisher<? extends T>> sources, Function<? super Object[], ? extends R> zipper)
Returns a Flowable that emits the results of a specified combiner function applied to combinations of items emitted, in sequence, by an Iterable of other Publishers.
static <T1, T2, R> Flowable<R> zip(Publisher<? extends T1> source1, Publisher<? extends T2> source2, BiFunction<? super T1, ? super T2, ? extends R> zipper)
Returns a Flowable that emits the results of a specified combiner function applied to combinations of two items emitted, in sequence, by two other Publishers.
static <T, R> Flowable<R> zipArray(Function<? super Object[], ? extends R> zipper, boolean delayError, int bufferSize, Publisher...<? extends T> sources)
Returns a Flowable that emits the results of a specified combiner function applied to combinations of items emitted, in sequence, by an array of other Publishers.
static <T, R> Flowable<R> zipIterable(Iterable<? extends Publisher<? extends T>> sources, Function<? super Object[], ? extends R> zipper, boolean delayError, int bufferSize)
Returns a Flowable that emits the results of a specified combiner function applied to combinations of items emitted, in sequence, by an Iterable of other Publishers.
final <U, R> Flowable<R> zipWith(Publisher<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper, boolean delayError)
Returns a Flowable that emits items that are the result of applying a specified function to pairs of values, one each from the source Publisher and another specified Publisher.
final <U, R> Flowable<R> zipWith(Publisher<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper)
Returns a Flowable that emits items that are the result of applying a specified function to pairs of values, one each from the source Publisher and another specified Publisher.
final <U, R> Flowable<R> zipWith(Iterable<U> other, BiFunction<? super T, ? super U, ? extends R> zipper)
Returns a Flowable that emits items that are the result of applying a specified function to pairs of values, one each from the source Publisher and a specified Iterable sequence.
final <U, R> Flowable<R> zipWith(Publisher<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper, boolean delayError, int bufferSize)
Returns a Flowable that emits items that are the result of applying a specified function to pairs of values, one each from the source Publisher and another specified Publisher.
Protected Methods
abstract void subscribeActual(Subscriber<? super T> s)
Operator implementations (both source and intermediate) should implement this method that performs the necessary business logic.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.reactivestreams.Publisher

Public Constructors

public Flowable ()

Public Methods

public final Single<Boolean> all (Predicate<? super T> predicate)

Returns a Single that emits a Boolean that indicates whether all of the items emitted by the source Publisher satisfy a condition.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure).
Scheduler:
all does not operate by default on a particular Scheduler.

Parameters
predicate a function that evaluates an item and returns a Boolean
Returns
  • a Single that emits true if all items emitted by the source Publisher satisfy the predicate; otherwise, false

public static Flowable<T> amb (Iterable<? extends Publisher<? extends T>> sources)

Mirrors the one Publisher in an Iterable of several Publishers that first either emits an item or sends a termination notification.

Backpressure:
The operator itself doesn't interfere with backpressure which is determined by the winning Publisher's backpressure behavior.
Scheduler:
amb does not operate by default on a particular Scheduler.

Parameters
sources an Iterable of Publishers sources competing to react first. A subscription to each Publisher will occur in the same order as in this Iterable.
Returns
  • a Flowable that emits the same sequence as whichever of the source Publishers first emitted an item or sent a termination notification

public static Flowable<T> ambArray (Publisher...<? extends T> sources)

Mirrors the one Publisher in an array of several Publishers that first either emits an item or sends a termination notification.

Backpressure:
The operator itself doesn't interfere with backpressure which is determined by the winning Publisher's backpressure behavior.
Scheduler:
ambArray does not operate by default on a particular Scheduler.

Parameters
sources an array of Publisher sources competing to react first. A subscription to each Publisher will occur in the same order as in this Iterable.
Returns
  • a Flowable that emits the same sequence as whichever of the source Publishers first emitted an item or sent a termination notification

public final Flowable<T> ambWith (Publisher<? extends T> other)

Mirrors the Publisher (current or provided) that first either emits an item or sends a termination notification.

Backpressure:
The operator itself doesn't interfere with backpressure which is determined by the winning Publisher's backpressure behavior.
Scheduler:
ambWith does not operate by default on a particular Scheduler.

Parameters
other a Publisher competing to react first. A subscription to this provided Publisher will occur after subscribing to the current Publisher.
Returns
  • a Flowable that emits the same sequence as whichever of the source Publishers first emitted an item or sent a termination notification

public final Single<Boolean> any (Predicate<? super T> predicate)

Returns a Single that emits true if any item emitted by the source Publisher satisfies a specified condition, otherwise false. Note: this always emits false if the source Publisher is empty.

In Rx.Net this is the any Subscriber but we renamed it in RxJava to better match Java naming idioms.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
any does not operate by default on a particular Scheduler.

Parameters
predicate the condition to test items emitted by the source Publisher
Returns
  • a Single that emits a Boolean that indicates whether any item emitted by the source Publisher satisfies the predicate

public final T blockingFirst (T defaultItem)

Returns the first item emitted by this Flowable, or a default value if it emits no items.

Backpressure:
The operator consumes the source Flowable in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
blockingFirst does not operate by default on a particular Scheduler.

Parameters
defaultItem a default value to return if this Flowable emits no items
Returns
  • the first item emitted by this Flowable, or the default value if it emits no items

public final T blockingFirst ()

Returns the first item emitted by this Flowable, or throws NoSuchElementException if it emits no items.

Backpressure:
The operator consumes the source Flowable in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
blockingFirst does not operate by default on a particular Scheduler.

Returns
  • the first item emitted by this Flowable
Throws
NoSuchElementException if this Flowable emits no items

public final void blockingForEach (Consumer<? super T> onNext)

Invokes a method on each item emitted by this Flowable and blocks until the Flowable completes.

Note: This will block even if the underlying Flowable is asynchronous.

This is similar to subscribe(Subscriber), but it blocks. Because it blocks it does not need the onComplete() or onError(Throwable) methods. If the underlying Flowable terminates with an error, rather than calling onError, this method will throw an exception.

The difference between this method and subscribe(Consumer) is that the onNext action is executed on the emission thread instead of the current thread.

Backpressure:
The operator consumes the source Flowable in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
blockingForEach does not operate by default on a particular Scheduler.

Parameters
onNext the Consumer to invoke for each item emitted by the Flowable
Throws
RuntimeException if an error occurs

public final Iterable<T> blockingIterable (int bufferSize)

Converts this Flowable into an Iterable.

Backpressure:
The operator expects the upstream to honor backpressure otherwise the returned Iterable's iterator will throw a MissingBackpressureException.
Scheduler:
blockingIterable does not operate by default on a particular Scheduler.

Parameters
bufferSize the number of items to prefetch from the current Flowable
Returns

public final Iterable<T> blockingIterable ()

Converts this Flowable into an Iterable.

Backpressure:
The operator expects the upstream to honor backpressure otherwise the returned Iterable's iterator will throw a MissingBackpressureException.
Scheduler:
blockingIterable does not operate by default on a particular Scheduler.

Returns

public final T blockingLast ()

Returns the last item emitted by this Flowable, or throws NoSuchElementException if this Flowable emits no items.

Backpressure:
The operator consumes the source Flowable in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
blockingLast does not operate by default on a particular Scheduler.

Returns
  • the last item emitted by this Flowable
Throws
NoSuchElementException if this Flowable emits no items

public final T blockingLast (T defaultItem)

Returns the last item emitted by this Flowable, or a default value if it emits no items.

Backpressure:
The operator consumes the source Flowable in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
blockingLast does not operate by default on a particular Scheduler.

Parameters
defaultItem a default value to return if this Flowable emits no items
Returns
  • the last item emitted by the Flowable, or the default value if it emits no items

public final Iterable<T> blockingLatest ()

Returns an Iterable that returns the latest item emitted by this Flowable, waiting if necessary for one to become available.

If this Flowable produces items faster than Iterator.next takes them, onNext events might be skipped, but onError or onComplete events are not.

Note also that an onNext directly followed by onComplete might hide the onNext event.

Backpressure:
The operator consumes the source Flowable in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
blockingLatest does not operate by default on a particular Scheduler.

Returns
  • an Iterable that always returns the latest item emitted by this Flowable

public final Iterable<T> blockingMostRecent (T initialItem)

Returns an Iterable that always returns the item most recently emitted by this Flowable.

Backpressure:
The operator consumes the source Flowable in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
blockingMostRecent does not operate by default on a particular Scheduler.

Parameters
initialItem the initial item that the Iterable sequence will yield if this Flowable has not yet emitted an item
Returns
  • an Iterable that on each iteration returns the item that this Flowable has most recently emitted

public final Iterable<T> blockingNext ()

Returns an Iterable that blocks until this Flowable emits another item, then returns that item.

Backpressure:
The operator consumes the source Flowable in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
blockingNext does not operate by default on a particular Scheduler.

Returns
  • an Iterable that blocks upon each iteration until this Flowable emits a new item, whereupon the Iterable returns that item

public final T blockingSingle (T defaultItem)

If this Flowable completes after emitting a single item, return that item; if it emits more than one item, throw an IllegalArgumentException; if it emits no items, return a default value.

Backpressure:
The operator consumes the source Flowable in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
blockingSingle does not operate by default on a particular Scheduler.

Parameters
defaultItem a default value to return if this Flowable emits no items
Returns
  • the single item emitted by this Flowable, or the default value if it emits no items

public final T blockingSingle ()

If this Flowable completes after emitting a single item, return that item, otherwise throw a NoSuchElementException.

Backpressure:
The operator consumes the source Flowable in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
blockingSingle does not operate by default on a particular Scheduler.

Returns
  • the single item emitted by this Flowable

public final void blockingSubscribe (Consumer<? super T> onNext)

Subscribes to the source and calls the given callbacks on the current thread.

If the Flowable emits an error, it is wrapped into an OnErrorNotImplementedException and routed to the RxJavaPlugins.onError handler.

Backpressure:
The operator consumes the source Flowable in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
blockingSubscribe does not operate by default on a particular Scheduler.

Parameters
onNext the callback action for each source value

public final void blockingSubscribe (Consumer<? super T> onNext, Consumer<? super Throwable> onError)

Subscribes to the source and calls the given callbacks on the current thread.

Backpressure:
The operator consumes the source Flowable in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
blockingSubscribe does not operate by default on a particular Scheduler.

Parameters
onNext the callback action for each source value
onError the callback action for an error event

public final void blockingSubscribe ()

Runs the source observable to a terminal event, ignoring any values and rethrowing any exception.

Backpressure:
The operator consumes the source Flowable in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
blockingSubscribe does not operate by default on a particular Scheduler.

public final void blockingSubscribe (Consumer<? super T> onNext, Consumer<? super Throwable> onError, Action onComplete)

Subscribes to the source and calls the given callbacks on the current thread.

Backpressure:
The operator consumes the source Flowable in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
blockingSubscribe does not operate by default on a particular Scheduler.

Parameters
onNext the callback action for each source value
onError the callback action for an error event
onComplete the callback action for the completion event.

public final void blockingSubscribe (Subscriber<? super T> subscriber)

Subscribes to the source and calls the Subscriber methods on the current thread.

Backpressure:
The supplied Subscriber determines how backpressure is applied.
Scheduler:
blockingSubscribe does not operate by default on a particular Scheduler.
The cancellation and backpressure is composed through.

Parameters
subscriber the subscriber to forward events and calls to in the current thread

public final Flowable<U> buffer (long timespan, long timeskip, TimeUnit unit, Scheduler scheduler, Callable<U> bufferSupplier)

Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting Publisher starts a new buffer periodically, as determined by the timeskip argument, and on the specified scheduler. It emits each buffer after a fixed timespan, specified by the timespan argument. When the source Publisher completes or encounters an error, the resulting Publisher emits the current buffer and propagates the notification from the source Publisher.

Backpressure:
This operator does not support backpressure as it uses time. It requests Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler:
You specify which Scheduler this operator will use

Parameters
timespan the period of time each buffer collects items before it is emitted
timeskip the period of time after which a new buffer will be created
unit the unit of time that applies to the timespan and timeskip arguments
scheduler the Scheduler to use when determining the end and start of a buffer
bufferSupplier a factory function that returns an instance of the collection subclass to be used and returned as the buffer
Returns
  • a Flowable that emits new buffers of items emitted by the source Publisher periodically after a fixed timespan has elapsed

public final Flowable<List<T>> buffer (Callable<? extends Publisher<B>> boundaryIndicatorSupplier)

Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping buffers. It emits the current buffer and replaces it with a new buffer whenever the Publisher produced by the specified closingIndicator emits an item.

Backpressure:
This operator does not support backpressure as it is instead controlled by the given Publishers and buffers data. It requests Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler:
This version of buffer does not operate by default on a particular Scheduler.

Parameters
boundaryIndicatorSupplier a Callable that produces a Publisher that governs the boundary between buffers. Whenever the source Publisher emits an item, buffer emits the current buffer and begins to fill a new one
Returns
  • a Flowable that emits a connected, non-overlapping buffer of items from the source Publisher each time the Publisher created with the closingIndicator argument emits an item

public final Flowable<List<T>> buffer (long timespan, long timeskip, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting Publisher starts a new buffer periodically, as determined by the timeskip argument, and on the specified scheduler. It emits each buffer after a fixed timespan, specified by the timespan argument. When the source Publisher completes or encounters an error, the resulting Publisher emits the current buffer and propagates the notification from the source Publisher.

Backpressure:
This operator does not support backpressure as it uses time. It requests Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler:
You specify which Scheduler this operator will use

Parameters
timespan the period of time each buffer collects items before it is emitted
timeskip the period of time after which a new buffer will be created
unit the unit of time that applies to the timespan and timeskip arguments
scheduler the Scheduler to use when determining the end and start of a buffer
Returns
  • a Flowable that emits new buffers of items emitted by the source Publisher periodically after a fixed timespan has elapsed

public final Flowable<U> buffer (int count, Callable<U> bufferSupplier)

Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping buffers, each containing count items. When the source Publisher completes or encounters an error, the resulting Publisher emits the current buffer and propagates the notification from the source Publisher.

Backpressure:
The operator honors backpressure from downstream and expects the source Publisher to honor it as well, although not enforced; violation may lead to MissingBackpressureException somewhere downstream.
Scheduler:
This version of buffer does not operate by default on a particular Scheduler.

Parameters
count the maximum number of items in each buffer before it should be emitted
bufferSupplier a factory function that returns an instance of the collection subclass to be used and returned as the buffer
Returns
  • a Flowable that emits connected, non-overlapping buffers, each containing at most count items from the source Publisher

public final Flowable<U> buffer (Publisher<B> boundaryIndicator, Callable<U> bufferSupplier)

Returns a Flowable that emits non-overlapping buffered items from the source Publisher each time the specified boundary Publisher emits an item.

Completion of either the source or the boundary Publisher causes the returned Publisher to emit the latest buffer and complete.

Backpressure:
This operator does not support backpressure as it is instead controlled by the Publisher boundary and buffers data. It requests Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler:
This version of buffer does not operate by default on a particular Scheduler.

Parameters
boundaryIndicator the boundary Publisher
bufferSupplier a factory function that returns an instance of the collection subclass to be used and returned as the buffer
Returns
  • a Flowable that emits buffered items from the source Publisher when the boundary Publisher emits an item

public final Flowable<List<T>> buffer (Publisher<B> boundaryIndicator, int initialCapacity)

Returns a Flowable that emits non-overlapping buffered items from the source Publisher each time the specified boundary Publisher emits an item.

Completion of either the source or the boundary Publisher causes the returned Publisher to emit the latest buffer and complete.

Backpressure:
This operator does not support backpressure as it is instead controlled by the Publisher boundary and buffers data. It requests Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler:
This version of buffer does not operate by default on a particular Scheduler.

Parameters
boundaryIndicator the boundary Publisher
initialCapacity the initial capacity of each buffer chunk
Returns
  • a Flowable that emits buffered items from the source Publisher when the boundary Publisher emits an item

public final Flowable<List<T>> buffer (long timespan, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping buffers, each of a fixed duration specified by the timespan argument and on the specified scheduler. When the source Publisher completes or encounters an error, the resulting Publisher emits the current buffer and propagates the notification from the source Publisher.

Backpressure:
This operator does not support backpressure as it uses time. It requests Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler:
You specify which Scheduler this operator will use

Parameters
timespan the period of time each buffer collects items before it is emitted and replaced with a new buffer
unit the unit of time which applies to the timespan argument
scheduler the Scheduler to use when determining the end and start of a buffer
Returns
  • a Flowable that emits connected, non-overlapping buffers of items emitted by the source Publisher within a fixed duration

public final Flowable<List<T>> buffer (int count)

Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping buffers, each containing count items. When the source Publisher completes or encounters an error, the resulting Publisher emits the current buffer and propagates the notification from the source Publisher.

Backpressure:
The operator honors backpressure from downstream and expects the source Publisher to honor it as well, although not enforced; violation may lead to MissingBackpressureException somewhere downstream.
Scheduler:
This version of buffer does not operate by default on a particular Scheduler.

Parameters
count the maximum number of items in each buffer before it should be emitted
Returns
  • a Flowable that emits connected, non-overlapping buffers, each containing at most count items from the source Publisher

public final Flowable<List<T>> buffer (long timespan, long timeskip, TimeUnit unit)

Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting Publisher starts a new buffer periodically, as determined by the timeskip argument. It emits each buffer after a fixed timespan, specified by the timespan argument. When the source Publisher completes or encounters an error, the resulting Publisher emits the current buffer and propagates the notification from the source Publisher.

Backpressure:
This operator does not support backpressure as it uses time. It requests Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler:
This version of buffer operates by default on the computation Scheduler.

Parameters
timespan the period of time each buffer collects items before it is emitted
timeskip the period of time after which a new buffer will be created
unit the unit of time that applies to the timespan and timeskip arguments
Returns
  • a Flowable that emits new buffers of items emitted by the source Publisher periodically after a fixed timespan has elapsed

public final Flowable<List<T>> buffer (Flowable<? extends TOpening> openingIndicator, Function<? super TOpening, ? extends Publisher<? extends TClosing>> closingIndicator)

Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting Publisher emits buffers that it creates when the specified openingIndicator Publisher emits an item, and closes when the Publisher returned from closingIndicator emits an item.

Backpressure:
This operator does not support backpressure as it is instead controlled by the given Publishers and buffers data. It requests Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler:
This version of buffer does not operate by default on a particular Scheduler.

Parameters
openingIndicator the Publisher that, when it emits an item, causes a new buffer to be created
closingIndicator the Function that is used to produce a Publisher for every buffer created. When this Publisher emits an item, the associated buffer is emitted.
Returns
  • a Flowable that emits buffers, containing items from the source Publisher, that are created and closed when the specified Publishers emit items

public final Flowable<List<T>> buffer (long timespan, TimeUnit unit, Scheduler scheduler, int count)

Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping buffers, each of a fixed duration specified by the timespan argument as measured on the specified scheduler, or a maximum size specified by the count argument (whichever is reached first). When the source Publisher completes or encounters an error, the resulting Publisher emits the current buffer and propagates the notification from the source Publisher.

Backpressure:
This operator does not support backpressure as it uses time. It requests Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler:
You specify which Scheduler this operator will use

Parameters
timespan the period of time each buffer collects items before it is emitted and replaced with a new buffer
unit the unit of time which applies to the timespan argument
scheduler the Scheduler to use when determining the end and start of a buffer
count the maximum size of each buffer before it is emitted
Returns
  • a Flowable that emits connected, non-overlapping buffers of items emitted by the source Publisher after a fixed duration or when the buffer reaches maximum capacity (whichever occurs first)

public final Flowable<List<T>> buffer (long timespan, TimeUnit unit)

Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping buffers, each of a fixed duration specified by the timespan argument. When the source Publisher completes or encounters an error, the resulting Publisher emits the current buffer and propagates the notification from the source Publisher.

Backpressure:
This operator does not support backpressure as it uses time. It requests Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler:
This version of buffer operates by default on the computation Scheduler.

Parameters
timespan the period of time each buffer collects items before it is emitted and replaced with a new buffer
unit the unit of time that applies to the timespan argument
Returns
  • a Flowable that emits connected, non-overlapping buffers of items emitted by the source Publisher within a fixed duration

public final Flowable<U> buffer (long timespan, TimeUnit unit, Scheduler scheduler, int count, Callable<U> bufferSupplier, boolean restartTimerOnMaxSize)

Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping buffers, each of a fixed duration specified by the timespan argument as measured on the specified scheduler, or a maximum size specified by the count argument (whichever is reached first). When the source Publisher completes or encounters an error, the resulting Publisher emits the current buffer and propagates the notification from the source Publisher.

Backpressure:
This operator does not support backpressure as it uses time. It requests Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler:
You specify which Scheduler this operator will use

Parameters
timespan the period of time each buffer collects items before it is emitted and replaced with a new buffer
unit the unit of time which applies to the timespan argument
scheduler the Scheduler to use when determining the end and start of a buffer
count the maximum size of each buffer before it is emitted
bufferSupplier a factory function that returns an instance of the collection subclass to be used and returned as the buffer
restartTimerOnMaxSize if true the time window is restarted when the max capacity of the current buffer is reached
Returns
  • a Flowable that emits connected, non-overlapping buffers of items emitted by the source Publisher after a fixed duration or when the buffer reaches maximum capacity (whichever occurs first)

public final Flowable<List<T>> buffer (int count, int skip)

Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting Publisher emits buffers every skip items, each containing count items. When the source Publisher completes or encounters an error, the resulting Publisher emits the current buffer and propagates the notification from the source Publisher.

Backpressure:
The operator honors backpressure from downstream and expects the source Publisher to honor it as well, although not enforced; violation may lead to MissingBackpressureException somewhere downstream.
Scheduler:
This version of buffer does not operate by default on a particular Scheduler.

Parameters
count the maximum size of each buffer before it should be emitted
skip how many items emitted by the source Publisher should be skipped before starting a new buffer. Note that when skip and count are equal, this is the same operation as buffer(int).
Returns
  • a Flowable that emits buffers for every skip item from the source Publisher and containing at most count items

public final Flowable<List<T>> buffer (Publisher<B> boundaryIndicator)

Returns a Flowable that emits non-overlapping buffered items from the source Publisher each time the specified boundary Publisher emits an item.

Completion of either the source or the boundary Publisher causes the returned Publisher to emit the latest buffer and complete.

Backpressure:
This operator does not support backpressure as it is instead controlled by the Publisher boundary and buffers data. It requests Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler:
This version of buffer does not operate by default on a particular Scheduler.

Parameters
boundaryIndicator the boundary Publisher
Returns
  • a Flowable that emits buffered items from the source Publisher when the boundary Publisher emits an item

public final Flowable<U> buffer (Flowable<? extends TOpening> openingIndicator, Function<? super TOpening, ? extends Publisher<? extends TClosing>> closingIndicator, Callable<U> bufferSupplier)

Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting Publisher emits buffers that it creates when the specified openingIndicator Publisher emits an item, and closes when the Publisher returned from closingIndicator emits an item.

Backpressure:
This operator does not support backpressure as it is instead controlled by the given Publishers and buffers data. It requests Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler:
This version of buffer does not operate by default on a particular Scheduler.

Parameters
openingIndicator the Publisher that, when it emits an item, causes a new buffer to be created
closingIndicator the Function that is used to produce a Publisher for every buffer created. When this Publisher emits an item, the associated buffer is emitted.
bufferSupplier a factory function that returns an instance of the collection subclass to be used and returned as the buffer
Returns
  • a Flowable that emits buffers, containing items from the source Publisher, that are created and closed when the specified Publishers emit items

public final Flowable<U> buffer (Callable<? extends Publisher<B>> boundaryIndicatorSupplier, Callable<U> bufferSupplier)

Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping buffers. It emits the current buffer and replaces it with a new buffer whenever the Publisher produced by the specified closingIndicator emits an item.

Backpressure:
This operator does not support backpressure as it is instead controlled by the given Publishers and buffers data. It requests Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler:
This version of buffer does not operate by default on a particular Scheduler.

Parameters
boundaryIndicatorSupplier a Callable that produces a Publisher that governs the boundary between buffers. Whenever the source Publisher emits an item, buffer emits the current buffer and begins to fill a new one
bufferSupplier a factory function that returns an instance of the collection subclass to be used and returned as the buffer
Returns
  • a Flowable that emits a connected, non-overlapping buffer of items from the source Publisher each time the Publisher created with the closingIndicator argument emits an item

public final Flowable<List<T>> buffer (long timespan, TimeUnit unit, int count)

Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping buffers, each of a fixed duration specified by the timespan argument or a maximum size specified by the count argument (whichever is reached first). When the source Publisher completes or encounters an error, the resulting Publisher emits the current buffer and propagates the notification from the source Publisher.

Backpressure:
This operator does not support backpressure as it uses time. It requests Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler:
This version of buffer operates by default on the computation Scheduler.

Parameters
timespan the period of time each buffer collects items before it is emitted and replaced with a new buffer
unit the unit of time which applies to the timespan argument
count the maximum size of each buffer before it is emitted
Returns
  • a Flowable that emits connected, non-overlapping buffers of items emitted by the source Publisher, after a fixed duration or when the buffer reaches maximum capacity (whichever occurs first)

public final Flowable<U> buffer (int count, int skip, Callable<U> bufferSupplier)

Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting Publisher emits buffers every skip items, each containing count items. When the source Publisher completes or encounters an error, the resulting Publisher emits the current buffer and propagates the notification from the source Publisher.

Backpressure:
The operator honors backpressure from downstream and expects the source Publisher to honor it as well, although not enforced; violation may lead to MissingBackpressureException somewhere downstream.
Scheduler:
This version of buffer does not operate by default on a particular Scheduler.

Parameters
count the maximum size of each buffer before it should be emitted
skip how many items emitted by the source Publisher should be skipped before starting a new buffer. Note that when skip and count are equal, this is the same operation as buffer(int).
bufferSupplier a factory function that returns an instance of the collection subclass to be used and returned as the buffer
Returns
  • a Flowable that emits buffers for every skip item from the source Publisher and containing at most count items

public static int bufferSize ()

Returns the default internal buffer size used by most async operators.

The value can be overridden via system parameter rx2.buffer-size before the Flowable class is loaded.

Returns
  • the default internal buffer size.

public final Flowable<T> cache ()

Returns a Flowable that subscribes to this Publisher lazily, caches all of its events and replays them, in the same order as received, to all the downstream subscribers.

This is useful when you want a Publisher to cache responses and you can't control the subscribe/cancel behavior of all the Subscribers.

The operator subscribes only when the first downstream subscriber subscribes and maintains a single subscription towards this Publisher. In contrast, the operator family of replay() that return a ConnectableFlowable require an explicit call to connect().

Note: You sacrifice the ability to cancel the origin when you use the cache Subscriber so be careful not to use this Subscriber on Publishers that emit an infinite or very large number of items that will use up memory. A possible workaround is to apply `takeUntil` with a predicate or another source before (and perhaps after) the application of cache().


 AtomicBoolean shouldStop = new AtomicBoolean();

 source.takeUntil(v -> shouldStop.get())
       .cache()
       .takeUntil(v -> shouldStop.get())
       .subscribe(...);
 
Since the operator doesn't allow clearing the cached values either, the possible workaround is to forget all references to it via onTerminateDetach() applied along with the previous workaround:

 AtomicBoolean shouldStop = new AtomicBoolean();

 source.takeUntil(v -> shouldStop.get())
       .onTerminateDetach()
       .cache()
       .takeUntil(v -> shouldStop.get())
       .onTerminateDetach()
       .subscribe(...);
 
Backpressure:
The operator consumes this Publisher in an unbounded fashion but respects the backpressure of each downstream Subscriber individually.
Scheduler:
cache does not operate by default on a particular Scheduler.

Returns
  • a Flowable that, when first subscribed to, caches all of its items and notifications for the benefit of subsequent subscribers

public final Flowable<T> cacheWithInitialCapacity (int initialCapacity)

Returns a Flowable that subscribes to this Publisher lazily, caches all of its events and replays them, in the same order as received, to all the downstream subscribers.

This is useful when you want a Publisher to cache responses and you can't control the subscribe/cancel behavior of all the Subscribers.

The operator subscribes only when the first downstream subscriber subscribes and maintains a single subscription towards this Publisher. In contrast, the operator family of replay() that return a ConnectableFlowable require an explicit call to connect().

Note: You sacrifice the ability to cancel the origin when you use the cache Subscriber so be careful not to use this Subscriber on Publishers that emit an infinite or very large number of items that will use up memory. A possible workaround is to apply `takeUntil` with a predicate or another source before (and perhaps after) the application of cache().


 AtomicBoolean shouldStop = new AtomicBoolean();

 source.takeUntil(v -> shouldStop.get())
       .cache()
       .takeUntil(v -> shouldStop.get())
       .subscribe(...);
 
Since the operator doesn't allow clearing the cached values either, the possible workaround is to forget all references to it via onTerminateDetach() applied along with the previous workaround:

 AtomicBoolean shouldStop = new AtomicBoolean();

 source.takeUntil(v -> shouldStop.get())
       .onTerminateDetach()
       .cache()
       .takeUntil(v -> shouldStop.get())
       .onTerminateDetach()
       .subscribe(...);
 
Backpressure:
The operator consumes this Publisher in an unbounded fashion but respects the backpressure of each downstream Subscriber individually.
Scheduler:
cacheWithInitialCapacity does not operate by default on a particular Scheduler.

Note: The capacity hint is not an upper bound on cache size. For that, consider replay(int) in combination with autoConnect() or similar.

Parameters
initialCapacity hint for number of items to cache (for optimizing underlying data structure)
Returns
  • a Flowable that, when first subscribed to, caches all of its items and notifications for the benefit of subsequent subscribers

public final Flowable<U> cast (Class<U> clazz)

Returns a Flowable that emits the items emitted by the source Publisher, converted to the specified type.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
cast does not operate by default on a particular Scheduler.

Parameters
clazz the target class type that cast will cast the items emitted by the source Publisher into before emitting them from the resulting Publisher
Returns
  • a Flowable that emits each item from the source Publisher after converting it to the specified type

public final Single<U> collect (Callable<? extends U> initialItemSupplier, BiConsumer<? super U, ? super T> collector)

Collects items emitted by the source Publisher into a single mutable data structure and returns a Single that emits this structure.

This is a simplified version of reduce that does not need to return the state on each pass.

Backpressure:
This operator does not support backpressure because by intent it will receive all values and reduce them to a single onNext.
Scheduler:
collect does not operate by default on a particular Scheduler.

Parameters
initialItemSupplier the mutable data structure that will collect the items
collector a function that accepts the state and an emitted item, and modifies state accordingly
Returns
  • a Single that emits the result of collecting the values emitted by the source Publisher into a single mutable data structure

public final Single<U> collectInto (U initialItem, BiConsumer<? super U, ? super T> collector)

Collects items emitted by the source Publisher into a single mutable data structure and returns a Single that emits this structure.

This is a simplified version of reduce that does not need to return the state on each pass.

Backpressure:
This operator does not support backpressure because by intent it will receive all values and reduce them to a single onNext.
Scheduler:
collectInto does not operate by default on a particular Scheduler.

Parameters
initialItem the mutable data structure that will collect the items
collector a function that accepts the state and an emitted item, and modifies state accordingly
Returns
  • a Single that emits the result of collecting the values emitted by the source Publisher into a single mutable data structure

public static Flowable<R> combineLatest (Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Publisher<? extends T6> source6, Publisher<? extends T7> source7, Publisher<? extends T8> source8, Publisher<? extends T9> source9, Function9<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? extends R> combiner)

Combines nine source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatest does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 the second source Publisher
source3 the third source Publisher
source4 the fourth source Publisher
source5 the fifth source Publisher
source6 the sixth source Publisher
source7 the seventh source Publisher
source8 the eighth source Publisher
source9 the ninth source Publisher
combiner the aggregation function used to combine the items emitted by the source Publishers
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatest (Publisher[]<? extends T> sources, Function<? super Object[], ? extends R> combiner)

Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.

Note on method signature: since Java doesn't allow creating a generic array with new T[], the implementation of this operator has to create an Object[] instead. Unfortunately, a Function<Integer[], R> passed to the method would trigger a ClassCastException.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

If the provided array of source Publishers is empty, the resulting sequence completes immediately without emitting any items and without any calls to the combiner function.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatest does not operate by default on a particular Scheduler.

Parameters
sources the collection of source Publishers
combiner the aggregation function used to combine the items emitted by the source Publishers
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatest (Iterable<? extends Publisher<? extends T>> sources, Function<? super Object[], ? extends R> combiner)

Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.

Note on method signature: since Java doesn't allow creating a generic array with new T[], the implementation of this operator has to create an Object[] instead. Unfortunately, a Function<Integer[], R> passed to the method would trigger a ClassCastException.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

If the provided iterable of source Publishers is empty, the resulting sequence completes immediately without emitting any items and without any calls to the combiner function.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatest does not operate by default on a particular Scheduler.

Parameters
sources the collection of source Publishers
combiner the aggregation function used to combine the items emitted by the source Publishers
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatest (Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Publisher<? extends T6> source6, Publisher<? extends T7> source7, Publisher<? extends T8> source8, Function8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R> combiner)

Combines eight source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatest does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 the second source Publisher
source3 the third source Publisher
source4 the fourth source Publisher
source5 the fifth source Publisher
source6 the sixth source Publisher
source7 the seventh source Publisher
source8 the eighth source Publisher
combiner the aggregation function used to combine the items emitted by the source Publishers
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatest (Publisher<? extends T1> source1, Publisher<? extends T2> source2, BiFunction<? super T1, ? super T2, ? extends R> combiner)

Combines two source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from either of the source Publishers, where this aggregation is defined by a specified function.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatest does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 the second source Publisher
combiner the aggregation function used to combine the items emitted by the source Publishers
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatest (Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Function3<? super T1, ? super T2, ? super T3, ? extends R> combiner)

Combines three source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatest does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 the second source Publisher
source3 the third source Publisher
combiner the aggregation function used to combine the items emitted by the source Publishers
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatest (Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Function4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> combiner)

Combines four source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatest does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 the second source Publisher
source3 the third source Publisher
source4 the fourth source Publisher
combiner the aggregation function used to combine the items emitted by the source Publishers
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatest (Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Function5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> combiner)

Combines five source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatest does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 the second source Publisher
source3 the third source Publisher
source4 the fourth source Publisher
source5 the fifth source Publisher
combiner the aggregation function used to combine the items emitted by the source Publishers
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatest (Publisher[]<? extends T> sources, Function<? super Object[], ? extends R> combiner, int bufferSize)

Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.

Note on method signature: since Java doesn't allow creating a generic array with new T[], the implementation of this operator has to create an Object[] instead. Unfortunately, a Function<Integer[], R> passed to the method would trigger a ClassCastException.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

If the provided array of source Publishers is empty, the resulting sequence completes immediately without emitting any items and without any calls to the combiner function.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatest does not operate by default on a particular Scheduler.

Parameters
sources the collection of source Publishers
combiner the aggregation function used to combine the items emitted by the source Publishers
bufferSize the internal buffer size and prefetch amount applied to every source Flowable
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatest (Function<? super Object[], ? extends R> combiner, Publisher...<? extends T> sources)

Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.

Note on method signature: since Java doesn't allow creating a generic array with new T[], the implementation of this operator has to create an Object[] instead. Unfortunately, a Function<Integer[], R> passed to the method would trigger a ClassCastException.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

If there are no source Publishers provided, the resulting sequence completes immediately without emitting any items and without any calls to the combiner function.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatest does not operate by default on a particular Scheduler.

Parameters
combiner the aggregation function used to combine the items emitted by the source Publishers
sources the collection of source Publishers
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatest (Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Publisher<? extends T6> source6, Publisher<? extends T7> source7, Function7<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? extends R> combiner)

Combines seven source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatest does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 the second source Publisher
source3 the third source Publisher
source4 the fourth source Publisher
source5 the fifth source Publisher
source6 the sixth source Publisher
source7 the seventh source Publisher
combiner the aggregation function used to combine the items emitted by the source Publishers
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatest (Iterable<? extends Publisher<? extends T>> sources, Function<? super Object[], ? extends R> combiner, int bufferSize)

Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.

Note on method signature: since Java doesn't allow creating a generic array with new T[], the implementation of this operator has to create an Object[] instead. Unfortunately, a Function<Integer[], R> passed to the method would trigger a ClassCastException.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

If the provided iterable of source Publishers is empty, the resulting sequence completes immediately without emitting any items and without any calls to the combiner function.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatest does not operate by default on a particular Scheduler.

Parameters
sources the collection of source Publishers
combiner the aggregation function used to combine the items emitted by the source Publishers
bufferSize the internal buffer size and prefetch amount applied to every source Flowable
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatest (Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Publisher<? extends T6> source6, Function6<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? extends R> combiner)

Combines six source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatest does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 the second source Publisher
source3 the third source Publisher
source4 the fourth source Publisher
source5 the fifth source Publisher
source6 the sixth source Publisher
combiner the aggregation function used to combine the items emitted by the source Publishers
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatestDelayError (Function<? super Object[], ? extends R> combiner, int bufferSize, Publisher...<? extends T> sources)

Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publisher, where this aggregation is defined by a specified function and delays any error from the sources until all source Publishers terminate.

Note on method signature: since Java doesn't allow creating a generic array with new T[], the implementation of this operator has to create an Object[] instead. Unfortunately, a Function<Integer[], R> passed to the method would trigger a ClassCastException.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

If there are no source Publishers provided, the resulting sequence completes immediately without emitting any items and without any calls to the combiner function.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatestDelayError does not operate by default on a particular Scheduler.

Parameters
combiner the aggregation function used to combine the items emitted by the source Publishers
bufferSize the internal buffer size and prefetch amount applied to every source Publisher
sources the collection of source Publishers
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatestDelayError (Publisher[]<? extends T> sources, Function<? super Object[], ? extends R> combiner)

Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function.

Note on method signature: since Java doesn't allow creating a generic array with new T[], the implementation of this operator has to create an Object[] instead. Unfortunately, a Function<Integer[], R> passed to the method would trigger a ClassCastException.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

If the provided array of source Publishers is empty, the resulting sequence completes immediately without emitting any items and without any calls to the combiner function.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatestDelayError does not operate by default on a particular Scheduler.

Parameters
sources the collection of source Publishers
combiner the aggregation function used to combine the items emitted by the source Publishers
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatestDelayError (Publisher[]<? extends T> sources, Function<? super Object[], ? extends R> combiner, int bufferSize)

Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function and delays any error from the sources until all source Publishers terminate.

Note on method signature: since Java doesn't allow creating a generic array with new T[], the implementation of this operator has to create an Object[] instead. Unfortunately, a Function<Integer[], R> passed to the method would trigger a ClassCastException.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

If the provided array of source Publishers is empty, the resulting sequence completes immediately without emitting any items and without any calls to the combiner function.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatestDelayError does not operate by default on a particular Scheduler.

Parameters
sources the collection of source Publishers
combiner the aggregation function used to combine the items emitted by the source Publishers
bufferSize the internal buffer size and prefetch amount applied to every source Flowable
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatestDelayError (Iterable<? extends Publisher<? extends T>> sources, Function<? super Object[], ? extends R> combiner)

Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function and delays any error from the sources until all source Publishers terminate.

Note on method signature: since Java doesn't allow creating a generic array with new T[], the implementation of this operator has to create an Object[] instead. Unfortunately, a Function<Integer[], R> passed to the method would trigger a ClassCastException.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

If the provided iterable of source Publishers is empty, the resulting sequence completes immediately without emitting any items and without any calls to the combiner function.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatestDelayError does not operate by default on a particular Scheduler.

Parameters
sources the collection of source Publishers
combiner the aggregation function used to combine the items emitted by the source Publishers
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatestDelayError (Iterable<? extends Publisher<? extends T>> sources, Function<? super Object[], ? extends R> combiner, int bufferSize)

Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function and delays any error from the sources until all source Publishers terminate.

Note on method signature: since Java doesn't allow creating a generic array with new T[], the implementation of this operator has to create an Object[] instead. Unfortunately, a Function<Integer[], R> passed to the method would trigger a ClassCastException.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

If the provided iterable of source Publishers is empty, the resulting sequence completes immediately without emitting any items and without any calls to the combiner function.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatestDelayError does not operate by default on a particular Scheduler.

Parameters
sources the collection of source Publishers
combiner the aggregation function used to combine the items emitted by the source Publishers
bufferSize the internal buffer size and prefetch amount applied to every source Flowable
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public static Flowable<R> combineLatestDelayError (Function<? super Object[], ? extends R> combiner, Publisher...<? extends T> sources)

Combines a collection of source Publishers by emitting an item that aggregates the latest values of each of the source Publishers each time an item is received from any of the source Publishers, where this aggregation is defined by a specified function and delays any error from the sources until all source Publishers terminate.

Note on method signature: since Java doesn't allow creating a generic array with new T[], the implementation of this operator has to create an Object[] instead. Unfortunately, a Function<Integer[], R> passed to the method would trigger a ClassCastException.

If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.

If there are no source Publishers provided, the resulting sequence completes immediately without emitting any items and without any calls to the combiner function.

Backpressure:
The returned Publisher honors backpressure from downstream. The source Publishers are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal MissingBackpressureException) and may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
combineLatestDelayError does not operate by default on a particular Scheduler.

Parameters
combiner the aggregation function used to combine the items emitted by the source Publishers
sources the collection of source Publishers
Returns
  • a Flowable that emits items that are the result of combining the items emitted by the source Publishers by means of the given aggregation function

public final Flowable<R> compose (FlowableTransformer<? super T, ? extends R> composer)

Transform a Publisher by applying a particular Transformer function to it.

This method operates on the Publisher itself whereas lift(FlowableOperator) operates on the Publisher's Subscribers or Subscribers.

If the operator you are creating is designed to act on the individual items emitted by a source Publisher, use lift(FlowableOperator). If your operator is designed to transform the source Publisher as a whole (for instance, by applying a particular set of existing RxJava operators to it) use compose.

Backpressure:
The operator itself doesn't interfere with the backpressure behavior which only depends on what kind of Publisher the transformer returns.
Scheduler:
compose does not operate by default on a particular Scheduler.

Parameters
composer implements the function that transforms the source Publisher
Returns
  • the source Publisher, transformed by the transformer function

public static Flowable<T> concat (Publisher<? extends T> source1, Publisher<? extends T> source2, Publisher<? extends T> source3)

Returns a Flowable that emits the items emitted by three Publishers, one after the other, without interleaving them.

Backpressure:
The operator honors backpressure from downstream. The Publisher sources are expected to honor backpressure as well. If any of the source Publishers violate this, it may throw an IllegalStateException when the source Publisher completes.
Scheduler:
concat does not operate by default on a particular Scheduler.

Parameters
source1 a Publisher to be concatenated
source2 a Publisher to be concatenated
source3 a Publisher to be concatenated
Returns
  • a Flowable that emits items emitted by the three source Publishers, one after the other, without interleaving them

public static Flowable<T> concat (Iterable<? extends Publisher<? extends T>> sources)

Concatenates elements of each Publisher provided via an Iterable sequence into a single sequence of elements without interleaving them.

Backpressure:
The operator honors backpressure from downstream. The Publisher sources are expected to honor backpressure as well. If any of the source Publishers violate this, it may throw an IllegalStateException when the source Publisher completes.
Scheduler:
concat does not operate by default on a particular Scheduler.

Parameters
sources the Iterable sequence of Publishers
Returns
  • the new Flowable instance

public static Flowable<T> concat (Publisher<? extends T> source1, Publisher<? extends T> source2, Publisher<? extends T> source3, Publisher<? extends T> source4)

Returns a Flowable that emits the items emitted by four Publishers, one after the other, without interleaving them.

Backpressure:
The operator honors backpressure from downstream. The Publisher sources are expected to honor backpressure as well. If any of the source Publishers violate this, it may throw an IllegalStateException when the source Publisher completes.
Scheduler:
concat does not operate by default on a particular Scheduler.

Parameters
source1 a Publisher to be concatenated
source2 a Publisher to be concatenated
source3 a Publisher to be concatenated
source4 a Publisher to be concatenated
Returns
  • a Flowable that emits items emitted by the four source Publishers, one after the other, without interleaving them

public static Flowable<T> concat (Publisher<? extends Publisher<? extends T>> sources, int prefetch)

Returns a Flowable that emits the items emitted by each of the Publishers emitted by the source Publisher, one after the other, without interleaving them.

Backpressure:
The operator honors backpressure from downstream. Both the outer and inner Publisher sources are expected to honor backpressure as well. If the outer violates this, a MissingBackpressureException is signalled. If any of the inner Publishers violates this, it may throw an IllegalStateException when an inner Publisher completes.
Scheduler:
concat does not operate by default on a particular Scheduler.

Parameters
sources a Publisher that emits Publishers
prefetch the number of Publishers to prefetch from the sources sequence.
Returns
  • a Flowable that emits items all of the items emitted by the Publishers emitted by Publishers, one after the other, without interleaving them

public static Flowable<T> concat (Publisher<? extends Publisher<? extends T>> sources)

Returns a Flowable that emits the items emitted by each of the Publishers emitted by the source Publisher, one after the other, without interleaving them.

Backpressure:
The operator honors backpressure from downstream. Both the outer and inner Publisher sources are expected to honor backpressure as well. If the outer violates this, a MissingBackpressureException is signalled. If any of the inner Publishers violates this, it may throw an IllegalStateException when an inner Publisher completes.
Scheduler:
concat does not operate by default on a particular Scheduler.

Parameters
sources a Publisher that emits Publishers
Returns
  • a Flowable that emits items all of the items emitted by the Publishers emitted by Publishers, one after the other, without interleaving them

public static Flowable<T> concat (Publisher<? extends T> source1, Publisher<? extends T> source2)

Returns a Flowable that emits the items emitted by two Publishers, one after the other, without interleaving them.

Backpressure:
The operator honors backpressure from downstream. The Publisher sources are expected to honor backpressure as well. If any of the source Publishers violate this, it may throw an IllegalStateException when the source Publisher completes.
Scheduler:
concat does not operate by default on a particular Scheduler.

Parameters
source1 a Publisher to be concatenated
source2 a Publisher to be concatenated
Returns
  • a Flowable that emits items emitted by the two source Publishers, one after the other, without interleaving them

public static Flowable<T> concatArray (Publisher...<? extends T> sources)

Concatenates a variable number of Publisher sources.

Note: named this way because of overload conflict with concat(Publisher<Publisher>).

Backpressure:
The operator honors backpressure from downstream. The Publisher sources are expected to honor backpressure as well. If any of the source Publishers violate this, it may throw an IllegalStateException when the source Publisher completes.
Scheduler:
concatArray does not operate by default on a particular Scheduler.

Parameters
sources the array of sources
Returns
  • the new Publisher instance
Throws
NullPointerException if sources is null

public static Flowable<T> concatArrayDelayError (Publisher...<? extends T> sources)

Concatenates a variable number of Publisher sources and delays errors from any of them till all terminate.

Backpressure:
The operator honors backpressure from downstream. The Publisher sources are expected to honor backpressure as well. If any of the source Publishers violate this, it may throw an IllegalStateException when the source Publisher completes.
Scheduler:
concatArrayDelayError does not operate by default on a particular Scheduler.

Parameters
sources the array of sources
Returns
  • the new Flowable instance
Throws
NullPointerException if sources is null

public static Flowable<T> concatArrayEager (int maxConcurrency, int prefetch, Publisher...<? extends T> sources)

Concatenates a sequence of Publishers eagerly into a single stream of values.

Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the source Publishers. The operator buffers the values emitted by these Publishers and then drains them in order, each one after the previous one completes.

Backpressure:
The operator honors backpressure from downstream. The Publisher sources are expected to honor backpressure as well. If any of the source Publishers violate this, the operator will signal a MissingBackpressureException.
Scheduler:
This method does not operate by default on a particular Scheduler.

Parameters
maxConcurrency the maximum number of concurrent subscriptions at a time, Integer.MAX_VALUE is interpreted as indication to subscribe to all sources at once
prefetch the number of elements to prefetch from each Publisher source
sources a sequence of Publishers that need to be eagerly concatenated
Returns
  • the new Publisher instance with the specified concatenation behavior

public static Flowable<T> concatArrayEager (Publisher...<? extends T> sources)

Concatenates a sequence of Publishers eagerly into a single stream of values.

Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the source Publishers. The operator buffers the values emitted by these Publishers and then drains them in order, each one after the previous one completes.

Backpressure:
The operator honors backpressure from downstream. The Publisher sources are expected to honor backpressure as well. If any of the source Publishers violate this, the operator will signal a MissingBackpressureException.
Scheduler:
This method does not operate by default on a particular Scheduler.

Parameters
sources a sequence of Publishers that need to be eagerly concatenated
Returns
  • the new Publisher instance with the specified concatenation behavior

public static Flowable<T> concatDelayError (Publisher<? extends Publisher<? extends T>> sources, int prefetch, boolean tillTheEnd)

Concatenates the Publisher sequence of Publishers into a single sequence by subscribing to each inner Publisher, one after the other, one at a time and delays any errors till the all inner and the outer Publishers terminate.

Backpressure:
concatDelayError fully supports backpressure.
Scheduler:
concatDelayError does not operate by default on a particular Scheduler.

Parameters
sources the Publisher sequence of Publishers
prefetch the number of elements to prefetch from the outer Publisher
tillTheEnd if true exceptions from the outer and all inner Publishers are delayed to the end if false, exception from the outer Publisher is delayed till the current Publisher terminates
Returns
  • the new Publisher with the concatenating behavior

public static Flowable<T> concatDelayError (Iterable<? extends Publisher<? extends T>> sources)

Concatenates the Iterable sequence of Publishers into a single sequence by subscribing to each Publisher, one after the other, one at a time and delays any errors till the all inner Publishers terminate.

Backpressure:
The operator honors backpressure from downstream. Both the outer and inner Publisher sources are expected to honor backpressure as well. If the outer violates this, a MissingBackpressureException is signalled. If any of the inner Publishers violates this, it may throw an IllegalStateException when an inner Publisher completes.
Scheduler:
concatDelayError does not operate by default on a particular Scheduler.

Parameters
sources the Iterable sequence of Publishers
Returns
  • the new Publisher with the concatenating behavior

public static Flowable<T> concatDelayError (Publisher<? extends Publisher<? extends T>> sources)

Concatenates the Publisher sequence of Publishers into a single sequence by subscribing to each inner Publisher, one after the other, one at a time and delays any errors till the all inner and the outer Publishers terminate.

Backpressure:
concatDelayError fully supports backpressure.
Scheduler:
concatDelayError does not operate by default on a particular Scheduler.

Parameters
sources the Publisher sequence of Publishers
Returns
  • the new Publisher with the concatenating behavior

public static Flowable<T> concatEager (Iterable<? extends Publisher<? extends T>> sources)

Concatenates a sequence of Publishers eagerly into a single stream of values.

Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the source Publishers. The operator buffers the values emitted by these Publishers and then drains them in order, each one after the previous one completes.

Backpressure:
Backpressure is honored towards the downstream and the inner Publishers are expected to support backpressure. Violating this assumption, the operator will signal MissingBackpressureException.
Scheduler:
This method does not operate by default on a particular Scheduler.

Parameters
sources a sequence of Publishers that need to be eagerly concatenated
Returns
  • the new Publisher instance with the specified concatenation behavior

public static Flowable<T> concatEager (Publisher<? extends Publisher<? extends T>> sources, int maxConcurrency, int prefetch)

Concatenates a Publisher sequence of Publishers eagerly into a single stream of values.

Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the emitted source Publishers as they are observed. The operator buffers the values emitted by these Publishers and then drains them in order, each one after the previous one completes.

Backpressure:
Backpressure is honored towards the downstream and both the outer and inner Publishers are expected to support backpressure. Violating this assumption, the operator will signal MissingBackpressureException.
Scheduler:
This method does not operate by default on a particular Scheduler.

Parameters
sources a sequence of Publishers that need to be eagerly concatenated
maxConcurrency the maximum number of concurrently running inner Publishers; Integer.MAX_VALUE is interpreted as all inner Publishers can be active at the same time
prefetch the number of elements to prefetch from each inner Publisher source
Returns
  • the new Publisher instance with the specified concatenation behavior

public static Flowable<T> concatEager (Publisher<? extends Publisher<? extends T>> sources)

Concatenates a Publisher sequence of Publishers eagerly into a single stream of values.

Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the emitted source Publishers as they are observed. The operator buffers the values emitted by these Publishers and then drains them in order, each one after the previous one completes.

Backpressure:
Backpressure is honored towards the downstream and both the outer and inner Publishers are expected to support backpressure. Violating this assumption, the operator will signal MissingBackpressureException.
Scheduler:
This method does not operate by default on a particular Scheduler.

Parameters
sources a sequence of Publishers that need to be eagerly concatenated
Returns
  • the new Publisher instance with the specified concatenation behavior

public static Flowable<T> concatEager (Iterable<? extends Publisher<? extends T>> sources, int maxConcurrency, int prefetch)

Concatenates a sequence of Publishers eagerly into a single stream of values.

Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the source Publishers. The operator buffers the values emitted by these Publishers and then drains them in order, each one after the previous one completes.

Backpressure:
Backpressure is honored towards the downstream and both the outer and inner Publishers are expected to support backpressure. Violating this assumption, the operator will signal MissingBackpressureException.
Scheduler:
This method does not operate by default on a particular Scheduler.

Parameters
sources a sequence of Publishers that need to be eagerly concatenated
maxConcurrency the maximum number of concurrently running inner Publishers; Integer.MAX_VALUE is interpreted as all inner Publishers can be active at the same time
prefetch the number of elements to prefetch from each inner Publisher source
Returns
  • the new Publisher instance with the specified concatenation behavior

public final Flowable<R> concatMap (Function<? super T, ? extends Publisher<? extends R>> mapper, int prefetch)

Returns a new Flowable that emits items resulting from applying a function that you supply to each item emitted by the source Publisher, where that function returns a Publisher, and then emitting the items that result from concatenating those resulting Publishers.

Backpressure:
The operator honors backpressure from downstream. Both this and the inner Publishers are expected to honor backpressure as well. If the source Publisher violates the rule, the operator will signal a MissingBackpressureException. If any of the inner Publishers doesn't honor backpressure, that may throw an IllegalStateException when that Publisher completes.
Scheduler:
concatMap does not operate by default on a particular Scheduler.

Parameters
mapper a function that, when applied to an item emitted by the source Publisher, returns an Publisher
prefetch the number of elements to prefetch from the current Flowable
Returns
  • a Flowable that emits the result of applying the transformation function to each item emitted by the source Publisher and concatenating the Publishers obtained from this transformation

public final Flowable<R> concatMap (Function<? super T, ? extends Publisher<? extends R>> mapper)

Returns a new Flowable that emits items resulting from applying a function that you supply to each item emitted by the source Publisher, where that function returns a Publisher, and then emitting the items that result from concatenating those resulting Publishers.

Backpressure:
The operator honors backpressure from downstream. Both this and the inner Publishers are expected to honor backpressure as well. If the source Publisher violates the rule, the operator will signal a MissingBackpressureException. If any of the inner Publishers doesn't honor backpressure, that may throw an IllegalStateException when that Publisher completes.
Scheduler:
concatMap does not operate by default on a particular Scheduler.

Parameters
mapper a function that, when applied to an item emitted by the source Publisher, returns an Publisher
Returns
  • a Flowable that emits the result of applying the transformation function to each item emitted by the source Publisher and concatenating the Publishers obtained from this transformation

public final Flowable<R> concatMapDelayError (Function<? super T, ? extends Publisher<? extends R>> mapper, int prefetch, boolean tillTheEnd)

Maps each of the items into a Publisher, subscribes to them one after the other, one at a time and emits their values in order while delaying any error from either this or any of the inner Publishers till all of them terminate.

Backpressure:
The operator honors backpressure from downstream. Both this and the inner Publishers are expected to honor backpressure as well. If the source Publisher violates the rule, the operator will signal a MissingBackpressureException. If any of the inner Publishers doesn't honor backpressure, that may throw an IllegalStateException when that Publisher completes.
Scheduler:
concatMapDelayError does not operate by default on a particular Scheduler.

Parameters
mapper the function that maps the items of this Publisher into the inner Publishers.
prefetch the number of elements to prefetch from the current Flowable
tillTheEnd if true, all errors from the outer and inner Publisher sources are delayed until the end, if false, an error from the main source is signalled when the current Publisher source terminates
Returns
  • the new Publisher instance with the concatenation behavior

public final Flowable<R> concatMapDelayError (Function<? super T, ? extends Publisher<? extends R>> mapper)

Maps each of the items into a Publisher, subscribes to them one after the other, one at a time and emits their values in order while delaying any error from either this or any of the inner Publishers till all of them terminate.

Backpressure:
The operator honors backpressure from downstream. Both this and the inner Publishers are expected to honor backpressure as well. If the source Publisher violates the rule, the operator will signal a MissingBackpressureException. If any of the inner Publishers doesn't honor backpressure, that may throw an IllegalStateException when that Publisher completes.
Scheduler:
concatMapDelayError does not operate by default on a particular Scheduler.

Parameters
mapper the function that maps the items of this Publisher into the inner Publishers.
Returns
  • the new Publisher instance with the concatenation behavior

public final Flowable<R> concatMapEager (Function<? super T, ? extends Publisher<? extends R>> mapper)

Maps a sequence of values into Publishers and concatenates these Publishers eagerly into a single Publisher.

Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the source Publishers. The operator buffers the values emitted by these Publishers and then drains them in order, each one after the previous one completes.

Backpressure:
Backpressure is honored towards the downstream, however, due to the eagerness requirement, sources are subscribed to in unbounded mode and their values are queued up in an unbounded buffer.
Scheduler:
This method does not operate by default on a particular Scheduler.

Parameters
mapper the function that maps a sequence of values into a sequence of Publishers that will be eagerly concatenated
Returns
  • the new Publisher instance with the specified concatenation behavior

public final Flowable<R> concatMapEager (Function<? super T, ? extends Publisher<? extends R>> mapper, int maxConcurrency, int prefetch)

Maps a sequence of values into Publishers and concatenates these Publishers eagerly into a single Publisher.

Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the source Publishers. The operator buffers the values emitted by these Publishers and then drains them in order, each one after the previous one completes.

Backpressure:
Backpressure is honored towards the downstream, however, due to the eagerness requirement, sources are subscribed to in unbounded mode and their values are queued up in an unbounded buffer.
Scheduler:
This method does not operate by default on a particular Scheduler.

Parameters
mapper the function that maps a sequence of values into a sequence of Publishers that will be eagerly concatenated
maxConcurrency the maximum number of concurrent subscribed Publishers
prefetch hints about the number of expected values from each inner Publisher, must be positive
Returns
  • the new Publisher instance with the specified concatenation behavior

public final Flowable<R> concatMapEagerDelayError (Function<? super T, ? extends Publisher<? extends R>> mapper, boolean tillTheEnd)

Maps a sequence of values into Publishers and concatenates these Publishers eagerly into a single Publisher.

Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the source Publishers. The operator buffers the values emitted by these Publishers and then drains them in order, each one after the previous one completes.

Backpressure:
Backpressure is honored towards the downstream, however, due to the eagerness requirement, sources are subscribed to in unbounded mode and their values are queued up in an unbounded buffer.
Scheduler:
This method does not operate by default on a particular Scheduler.

Parameters
mapper the function that maps a sequence of values into a sequence of Publishers that will be eagerly concatenated
tillTheEnd if true, all errors from the outer and inner Publisher sources are delayed until the end, if false, an error from the main source is signalled when the current Publisher source terminates
Returns
  • the new Publisher instance with the specified concatenation behavior

public final Flowable<R> concatMapEagerDelayError (Function<? super T, ? extends Publisher<? extends R>> mapper, int maxConcurrency, int prefetch, boolean tillTheEnd)

Maps a sequence of values into Publishers and concatenates these Publishers eagerly into a single Publisher.

Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the source Publishers. The operator buffers the values emitted by these Publishers and then drains them in order, each one after the previous one completes.

Backpressure:
Backpressure is honored towards the downstream, however, due to the eagerness requirement, sources are subscribed to in unbounded mode and their values are queued up in an unbounded buffer.
Scheduler:
This method does not operate by default on a particular Scheduler.

Parameters
mapper the function that maps a sequence of values into a sequence of Publishers that will be eagerly concatenated
maxConcurrency the maximum number of concurrent subscribed Publishers
prefetch the number of elements to prefetch from each source Publisher
tillTheEnd if true, exceptions from the current Flowable and all the inner Publishers are delayed until all of them terminate, if false, exception from the current Flowable is delayed until the currently running Publisher terminates
Returns
  • the new Publisher instance with the specified concatenation behavior

public final Flowable<U> concatMapIterable (Function<? super T, ? extends Iterable<? extends U>> mapper)

Returns a Flowable that concatenate each item emitted by the source Publisher with the values in an Iterable corresponding to that item that is generated by a selector.

Backpressure:
The operator honors backpressure from downstream. The source Publishers is expected to honor backpressure as well. If the source Publisher violates the rule, the operator will signal a MissingBackpressureException.
Scheduler:
concatMapIterable does not operate by default on a particular Scheduler.

Parameters
mapper a function that returns an Iterable sequence of values for when given an item emitted by the source Publisher
Returns
  • a Flowable that emits the results of concatenating the items emitted by the source Publisher with the values in the Iterables corresponding to those items, as generated by collectionSelector

public final Flowable<U> concatMapIterable (Function<? super T, ? extends Iterable<? extends U>> mapper, int prefetch)

Returns a Flowable that concatenate each item emitted by the source Publisher with the values in an Iterable corresponding to that item that is generated by a selector.

Backpressure:
The operator honors backpressure from downstream. The source Publishers is expected to honor backpressure as well. If the source Publisher violates the rule, the operator will signal a MissingBackpressureException.
Scheduler:
concatMapIterable does not operate by default on a particular Scheduler.

Parameters
mapper a function that returns an Iterable sequence of values for when given an item emitted by the source Publisher
prefetch the number of elements to prefetch from the current Flowable
Returns
  • a Flowable that emits the results of concatenating the items emitted by the source Publisher with the values in the Iterables corresponding to those items, as generated by collectionSelector

public final Flowable<T> concatWith (Publisher<? extends T> other)

Returns a Flowable that emits the items emitted from the current Publisher, then the next, one after the other, without interleaving them.

Backpressure:
The operator honors backpressure from downstream. Both this and the other Publishers are expected to honor backpressure as well. If any of then violates this rule, it may throw an IllegalStateException when the source Publisher completes.
Scheduler:
concatWith does not operate by default on a particular Scheduler.

Parameters
other a Publisher to be concatenated after the current
Returns
  • a Flowable that emits items emitted by the two source Publishers, one after the other, without interleaving them

public final Single<Boolean> contains (Object item)

Returns a Single that emits a Boolean that indicates whether the source Publisher emitted a specified item.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure).
Scheduler:
contains does not operate by default on a particular Scheduler.

Parameters
item the item to search for in the emissions from the source Publisher
Returns
  • a Flowable that emits true if the specified item is emitted by the source Publisher, or false if the source Publisher completes without emitting that item

public final Single<Long> count ()

Returns a Single that counts the total number of items emitted by the source Publisher and emits this count as a 64-bit Long.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure).
Scheduler:
count does not operate by default on a particular Scheduler.

Returns
  • a Single that emits a single item: the number of items emitted by the source Publisher as a 64-bit Long item

public static Flowable<T> create (FlowableOnSubscribe<T> source, BackpressureStrategy mode)

Provides an API (via a cold Flowable) that bridges the reactive world with the callback-style, generally non-backpressured world.

Example:


 Flowable.<Event>create(emitter -> {
     Callback listener = new Callback() {
         @Override
         public void onEvent(Event e) {
             emitter.onNext(e);
             if (e.isLast()) {
                 emitter.onComplete();
             }
         }

         @Override
         public void onFailure(Exception e) {
             emitter.onError(e);
         }
     };

     AutoCloseable c = api.someMethod(listener);

     emitter.setCancellable(c::close);

 }, BackpressureStrategy.BUFFER);
 

You should call the FlowableEmitter onNext, onError and onComplete methods in a serialized fashion. The rest of its methods are thread-safe.

Backpressure:
The backpressure behavior is determined by the mode parameter.
Scheduler:
create does not operate by default on a particular Scheduler.

Parameters
source the emitter that is called when a Subscriber subscribes to the returned Flowable
mode the backpressure mode to apply if the downstream Subscriber doesn't request (fast) enough
Returns
  • the new Flowable instance

public final Flowable<T> debounce (long timeout, TimeUnit unit)

Returns a Flowable that mirrors the source Publisher, except that it drops items emitted by the source Publisher that are followed by newer items before a timeout value expires. The timer resets on each emission.

Note: If items keep being emitted by the source Publisher faster than the timeout then no items will be emitted by the resulting Publisher.

Information on debounce vs throttle:

Backpressure:
This operator does not support backpressure as it uses time to control data flow.
Scheduler:
This version of debounce operates by default on the computation Scheduler.

Parameters
timeout the time each item has to be "the most recent" of those emitted by the source Publisher to ensure that it's not dropped
unit the TimeUnit for the timeout
Returns
  • a Flowable that filters out items from the source Publisher that are too quickly followed by newer items

public final Flowable<T> debounce (long timeout, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that mirrors the source Publisher, except that it drops items emitted by the source Publisher that are followed by newer items before a timeout value expires on a specified Scheduler. The timer resets on each emission.

Note: If items keep being emitted by the source Publisher faster than the timeout then no items will be emitted by the resulting Publisher.

Information on debounce vs throttle:

Backpressure:
This operator does not support backpressure as it uses time to control data flow.
Scheduler:
You specify which Scheduler this operator will use

Parameters
timeout the time each item has to be "the most recent" of those emitted by the source Publisher to ensure that it's not dropped
unit the unit of time for the specified timeout
scheduler the Scheduler to use internally to manage the timers that handle the timeout for each item
Returns
  • a Flowable that filters out items from the source Publisher that are too quickly followed by newer items

public final Flowable<T> debounce (Function<? super T, ? extends Publisher<U>> debounceIndicator)

Returns a Flowable that mirrors the source Publisher, except that it drops items emitted by the source Publisher that are followed by another item within a computed debounce duration.

Backpressure:
This operator does not support backpressure as it uses the debounceSelector to mark boundaries.
Scheduler:
This version of debounce does not operate by default on a particular Scheduler.

Parameters
debounceIndicator function to retrieve a sequence that indicates the throttle duration for each item
Returns
  • a Flowable that omits items emitted by the source Publisher that are followed by another item within a computed debounce duration

public final Flowable<T> defaultIfEmpty (T defaultItem)

Returns a Flowable that emits the items emitted by the source Publisher or a specified default item if the source Publisher is empty.

Backpressure:
If the source Publisher is empty, this operator is guaranteed to honor backpressure from downstream. If the source Publisher is non-empty, it is expected to honor backpressure as well; if the rule is violated, a MissingBackpressureException may get signalled somewhere downstream.
Scheduler:
defaultIfEmpty does not operate by default on a particular Scheduler.

Parameters
defaultItem the item to emit if the source Publisher emits no items
Returns
  • a Flowable that emits either the specified default item if the source Publisher emits no items, or the items emitted by the source Publisher

public static Flowable<T> defer (Callable<? extends Publisher<? extends T>> supplier)

Returns a Flowable that calls a Publisher factory to create a Publisher for each new Subscriber that subscribes. That is, for each subscriber, the actual Publisher that subscriber observes is determined by the factory function.

The defer Subscriber allows you to defer or delay emitting items from a Publisher until such time as an Subscriber subscribes to the Publisher. This allows a Subscriber to easily obtain updates or a refreshed version of the sequence.

Backpressure:
The operator itself doesn't interfere with backpressure which is determined by the Publisher returned by the supplier.
Scheduler:
defer does not operate by default on a particular Scheduler.

Parameters
supplier the Publisher factory function to invoke for each Subscriber that subscribes to the resulting Publisher
Returns
  • a Flowable whose Subscribers' subscriptions trigger an invocation of the given Publisher factory function

public final Flowable<T> delay (long delay, TimeUnit unit, boolean delayError)

Returns a Flowable that emits the items emitted by the source Publisher shifted forward in time by a specified delay. Error notifications from the source Publisher are not delayed.

Backpressure:
The operator doesn't interfere with the backpressure behavior which is determined by the source Publisher.
Scheduler:
This version of delay operates by default on the computation Scheduler.

Parameters
delay the delay to shift the source by
unit the TimeUnit in which period is defined
delayError if true, the upstream exception is signalled with the given delay, after all preceding normal elements, if false, the upstream exception is signalled immediately
Returns
  • the source Publisher shifted in time by the specified delay

public final Flowable<T> delay (Publisher<U> subscriptionIndicator, Function<? super T, ? extends Publisher<V>> itemDelayIndicator)

Returns a Flowable that delays the subscription to and emissions from the source Publisher via another Publisher on a per-item basis.

Note: the resulting Publisher will immediately propagate any onError notification from the source Publisher.

Backpressure:
The operator doesn't interfere with the backpressure behavior which is determined by the source Publisher. All of the other Publishers supplied by the functions are consumed in an unbounded manner (i.e., no backpressure applied to them).
Scheduler:
This version of delay does not operate by default on a particular Scheduler.

Parameters
subscriptionIndicator a function that returns a Publisher that triggers the subscription to the source Publisher once it emits any item
itemDelayIndicator a function that returns a Publisher for each item emitted by the source Publisher, which is then used to delay the emission of that item by the resulting Publisher until the Publisher returned from itemDelay emits an item
Returns
  • a Flowable that delays the subscription and emissions of the source Publisher via another Publisher on a per-item basis

public final Flowable<T> delay (long delay, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits the items emitted by the source Publisher shifted forward in time by a specified delay. Error notifications from the source Publisher are not delayed.

Backpressure:
The operator doesn't interfere with the backpressure behavior which is determined by the source Publisher.
Scheduler:
You specify which Scheduler this operator will use

Parameters
delay the delay to shift the source by
unit the time unit of delay
scheduler the Scheduler to use for delaying
Returns
  • the source Publisher shifted in time by the specified delay

public final Flowable<T> delay (long delay, TimeUnit unit, Scheduler scheduler, boolean delayError)

Returns a Flowable that emits the items emitted by the source Publisher shifted forward in time by a specified delay. Error notifications from the source Publisher are not delayed.

Backpressure:
The operator doesn't interfere with the backpressure behavior which is determined by the source Publisher.
Scheduler:
You specify which Scheduler this operator will use

Parameters
delay the delay to shift the source by
unit the time unit of delay
scheduler the Scheduler to use for delaying
delayError if true, the upstream exception is signalled with the given delay, after all preceding normal elements, if false, the upstream exception is signalled immediately
Returns
  • the source Publisher shifted in time by the specified delay

public final Flowable<T> delay (Function<? super T, ? extends Publisher<U>> itemDelayIndicator)

Returns a Flowable that delays the emissions of the source Publisher via another Publisher on a per-item basis.

Note: the resulting Publisher will immediately propagate any onError notification from the source Publisher.

Backpressure:
The operator doesn't interfere with the backpressure behavior which is determined by the source Publisher. All of the other Publishers supplied by the function are consumed in an unbounded manner (i.e., no backpressure applied to them).
Scheduler:
This version of delay does not operate by default on a particular Scheduler.

Parameters
itemDelayIndicator a function that returns a Publisher for each item emitted by the source Publisher, which is then used to delay the emission of that item by the resulting Publisher until the Publisher returned from itemDelay emits an item
Returns
  • a Flowable that delays the emissions of the source Publisher via another Publisher on a per-item basis

public final Flowable<T> delay (long delay, TimeUnit unit)

Returns a Flowable that emits the items emitted by the source Publisher shifted forward in time by a specified delay. Error notifications from the source Publisher are not delayed.

Backpressure:
The operator doesn't interfere with the backpressure behavior which is determined by the source Publisher.
Scheduler:
This version of delay operates by default on the computation Scheduler.

Parameters
delay the delay to shift the source by
unit the TimeUnit in which period is defined
Returns
  • the source Publisher shifted in time by the specified delay

public final Flowable<T> delaySubscription (Publisher<U> subscriptionIndicator)

Returns a Flowable that delays the subscription to this Publisher until the other Publisher emits an element or completes normally.

Backpressure:
The operator forwards the backpressure requests to this Publisher once the subscription happens and requests Long.MAX_VALUE from the other Publisher
Scheduler:
This method does not operate by default on a particular Scheduler.

Parameters
subscriptionIndicator the other Publisher that should trigger the subscription to this Publisher.
Returns
  • a Flowable that delays the subscription to this Publisher until the other Publisher emits an element or completes normally.

public final Flowable<T> delaySubscription (long delay, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that delays the subscription to the source Publisher by a given amount of time, both waiting and subscribing on a given Scheduler.

Backpressure:
The operator doesn't interfere with the backpressure behavior which is determined by the source Publisher.
Scheduler:
You specify which Scheduler this operator will use

Parameters
delay the time to delay the subscription
unit the time unit of delay
scheduler the Scheduler on which the waiting and subscription will happen
Returns
  • a Flowable that delays the subscription to the source Publisher by a given amount, waiting and subscribing on the given Scheduler

public final Flowable<T> delaySubscription (long delay, TimeUnit unit)

Returns a Flowable that delays the subscription to the source Publisher by a given amount of time.

Backpressure:
The operator doesn't interfere with the backpressure behavior which is determined by the source Publisher.
Scheduler:
This version of delaySubscription operates by default on the computation Scheduler.

Parameters
delay the time to delay the subscription
unit the time unit of delay
Returns
  • a Flowable that delays the subscription to the source Publisher by the given amount

public final Flowable<T2> dematerialize ()

Returns a Flowable that reverses the effect of materialize by transforming the Notification objects emitted by the source Publisher into the items or notifications they represent.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
dematerialize does not operate by default on a particular Scheduler.

Returns
  • a Flowable that emits the items and notifications embedded in the Notification objects emitted by the source Publisher

public final Flowable<T> distinct ()

Returns a Flowable that emits all items emitted by the source Publisher that are distinct.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
distinct does not operate by default on a particular Scheduler.

Returns
  • a Flowable that emits only those items emitted by the source Publisher that are distinct from each other

public final Flowable<T> distinct (Function<? super T, K> keySelector)

Returns a Flowable that emits all items emitted by the source Publisher that are distinct according to a key selector function.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
distinct does not operate by default on a particular Scheduler.

Parameters
keySelector a function that projects an emitted item to a key value that is used to decide whether an item is distinct from another one or not
Returns
  • a Flowable that emits those items emitted by the source Publisher that have distinct keys

public final Flowable<T> distinct (Function<? super T, K> keySelector, Callable<? extends Collection<? super K>> collectionSupplier)

Returns a Flowable that emits all items emitted by the source Publisher that are distinct according to a key selector function.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
distinct does not operate by default on a particular Scheduler.

Parameters
keySelector a function that projects an emitted item to a key value that is used to decide whether an item is distinct from another one or not
collectionSupplier function called for each individual Subscriber to return a Collection subtype for holding the extracted keys and whose add() method's return indicates uniqueness.
Returns
  • a Flowable that emits those items emitted by the source Publisher that have distinct keys

public final Flowable<T> distinctUntilChanged (BiPredicate<? super T, ? super T> comparer)

Returns a Flowable that emits all items emitted by the source Publisher that are distinct from their immediate predecessors when compared with each other via the provided comparator function.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
distinctUntilChanged does not operate by default on a particular Scheduler.

Parameters
comparer the function that receives the previous item and the current item and is expected to return true if the two are equal, thus skipping the current value.
Returns
  • a Flowable that emits those items from the source Publisher that are distinct from their immediate predecessors

public final Flowable<T> distinctUntilChanged (Function<? super T, K> keySelector)

Returns a Flowable that emits all items emitted by the source Publisher that are distinct from their immediate predecessors, according to a key selector function.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
distinctUntilChanged does not operate by default on a particular Scheduler.

Parameters
keySelector a function that projects an emitted item to a key value that is used to decide whether an item is distinct from another one or not
Returns
  • a Flowable that emits those items from the source Publisher whose keys are distinct from those of their immediate predecessors

public final Flowable<T> distinctUntilChanged ()

Returns a Flowable that emits all items emitted by the source Publisher that are distinct from their immediate predecessors.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
distinctUntilChanged does not operate by default on a particular Scheduler.

Returns
  • a Flowable that emits those items from the source Publisher that are distinct from their immediate predecessors

public final Flowable<T> doAfterNext (Consumer<? super T> onAfterNext)

Calls the specified consumer with the current item after this item has been emitted to the downstream.

Note that the onAfterNext action is shared between subscriptions and as such should be thread-safe.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
doAfterNext does not operate by default on a particular Scheduler.
Operator-fusion:
This operator supports normal and conditional Subscribers as well as boundary-limited synchronous or asynchronous queue-fusion.

History: 2.0.1 - experimental

Parameters
onAfterNext the Consumer that will be called after emitting an item from upstream to the downstream
Returns
  • the new Flowable instance

public final Flowable<T> doAfterTerminate (Action onAfterTerminate)

Registers an Action to be called when this Publisher invokes either onComplete or onError.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
doAfterTerminate does not operate by default on a particular Scheduler.

Parameters
onAfterTerminate an Action to be invoked when the source Publisher finishes
Returns
  • a Flowable that emits the same items as the source Publisher, then invokes the Action

public final Flowable<T> doFinally (Action onFinally)

Calls the specified action after this Flowable signals onError or onCompleted or gets cancelled by the downstream.

In case of a race between a terminal event and a cancellation, the provided onFinally action is executed once per subscription.

Note that the onFinally action is shared between subscriptions and as such should be thread-safe.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
doFinally does not operate by default on a particular Scheduler.
Operator-fusion:
This operator supports normal and conditional Subscribers as well as boundary-limited synchronous or asynchronous queue-fusion.

History: 2.0.1 - experimental

Parameters
onFinally the action called when this Flowable terminates or gets cancelled
Returns
  • the new Flowable instance

public final Flowable<T> doOnCancel (Action onCancel)

Calls the cancel Action if the downstream cancels the sequence.

The action is shared between subscriptions and thus may be called concurrently from multiple threads; the action must be thread safe.

If the action throws a runtime exception, that exception is rethrown by the onCancel() call, sometimes as a CompositeException if there were multiple exceptions along the way.

Note that terminal events trigger the action unless the Publisher is subscribed to via unsafeSubscribe().

Backpressure:
doOnCancel does not interact with backpressure requests or value delivery; backpressure behavior is preserved between its upstream and its downstream.
Scheduler:
doOnCancel does not operate by default on a particular Scheduler.

Parameters
onCancel the action that gets called when the source Publisher's Subscription is cancelled
Returns
  • the source Publisher modified so as to call this Action when appropriate

public final Flowable<T> doOnComplete (Action onComplete)

Modifies the source Publisher so that it invokes an action when it calls onComplete.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
doOnComplete does not operate by default on a particular Scheduler.

Parameters
onComplete the action to invoke when the source Publisher calls onComplete
Returns
  • the source Publisher with the side-effecting behavior applied

public final Flowable<T> doOnEach (Consumer<? super Notification<T>> onNotification)

Modifies the source Publisher so that it invokes an action for each item it emits.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
doOnEach does not operate by default on a particular Scheduler.

Parameters
onNotification the action to invoke for each item emitted by the source Publisher
Returns
  • the source Publisher with the side-effecting behavior applied

public final Flowable<T> doOnEach (Subscriber<? super T> subscriber)

Modifies the source Publisher so that it notifies a Subscriber for each item and terminal event it emits.

In case the onError of the supplied Subscriber throws, the downstream will receive a composite exception containing the original exception and the exception thrown by onError. If either the onNext or the onComplete method of the supplied Subscriber throws, the downstream will be terminated and will receive this thrown exception.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
doOnEach does not operate by default on a particular Scheduler.

Parameters
subscriber the Subscriber to be notified about onNext, onError and onComplete events on its respective methods before the actual downstream Subscriber gets notified.
Returns
  • the source Publisher with the side-effecting behavior applied

public final Flowable<T> doOnError (Consumer<? super Throwable> onError)

Modifies the source Publisher so that it invokes an action if it calls onError.

In case the onError action throws, the downstream will receive a composite exception containing the original exception and the exception thrown by onError.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
doOnError does not operate by default on a particular Scheduler.

Parameters
onError the action to invoke if the source Publisher calls onError
Returns
  • the source Publisher with the side-effecting behavior applied

public final Flowable<T> doOnLifecycle (Consumer<? super Subscription> onSubscribe, LongConsumer onRequest, Action onCancel)

Calls the appropriate onXXX method (shared between all Subscribers) for the lifecycle events of the sequence (subscription, cancellation, requesting).

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
doOnLifecycle does not operate by default on a particular Scheduler.

Parameters
onSubscribe a Consumer called with the Subscription sent via Subscriber.onSubscribe()
onRequest a LongConsumer called with the request amount sent via Subscription.request()
onCancel called when the downstream cancels the Subscription via cancel()
Returns
  • the source Publisher with the side-effecting behavior applied

public final Flowable<T> doOnNext (Consumer<? super T> onNext)

Modifies the source Publisher so that it invokes an action when it calls onNext.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
doOnNext does not operate by default on a particular Scheduler.

Parameters
onNext the action to invoke when the source Publisher calls onNext
Returns
  • the source Publisher with the side-effecting behavior applied

public final Flowable<T> doOnRequest (LongConsumer onRequest)

Modifies the source Publisher so that it invokes the given action when it receives a request for more items.

Note: This operator is for tracing the internal behavior of back-pressure request patterns and generally intended for debugging use.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
doOnRequest does not operate by default on a particular Scheduler.

Parameters
onRequest the action that gets called when a Subscriber requests items from this Publisher
Returns
  • the source Publisher modified so as to call this Action when appropriate

public final Flowable<T> doOnSubscribe (Consumer<? super Subscription> onSubscribe)

Modifies the source Publisher so that it invokes the given action when it is subscribed from its subscribers. Each subscription will result in an invocation of the given action except when the source Publisher is reference counted, in which case the source Publisher will invoke the given action for the first subscription.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
doOnSubscribe does not operate by default on a particular Scheduler.

Parameters
onSubscribe the Consumer that gets called when a Subscriber subscribes to the current Flowable
Returns
  • the source Publisher modified so as to call this Consumer when appropriate

public final Flowable<T> doOnTerminate (Action onTerminate)

Modifies the source Publisher so that it invokes an action when it calls onComplete or onError.

This differs from doAfterTerminate in that this happens before the onComplete or onError notification.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
doOnTerminate does not operate by default on a particular Scheduler.

Parameters
onTerminate the action to invoke when the source Publisher calls onComplete or onError
Returns
  • the source Publisher with the side-effecting behavior applied

public final Single<T> elementAt (long index, T defaultItem)

Returns a Flowable that emits the item found at a specified index in a sequence of emissions from this Flowable, or a default item if that index is out of range.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
elementAt does not operate by default on a particular Scheduler.

Parameters
index the zero-based index of the item to retrieve
defaultItem the default item
Returns
  • a Flowable that emits the item at the specified position in the sequence emitted by the source Publisher, or the default item if that index is outside the bounds of the source sequence
Throws
IndexOutOfBoundsException if index is less than 0

public final Maybe<T> elementAt (long index)

Returns a Maybe that emits the single item at a specified index in a sequence of emissions from this Flowable or completes if this Flowable sequence has fewer elements than index.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
elementAt does not operate by default on a particular Scheduler.

Parameters
index the zero-based index of the item to retrieve
Returns
  • a Maybe that emits a single item: the item at the specified position in the sequence of those emitted by the source Publisher

public final Single<T> elementAtOrError (long index)

Returns a Flowable that emits the item found at a specified index in a sequence of emissions from this Flowable or signals a NoSuchElementException if this Flowable has fewer elements than index.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
elementAtOrError does not operate by default on a particular Scheduler.

Parameters
index the zero-based index of the item to retrieve
Returns
  • a Flowable that emits the item at the specified position in the sequence emitted by the source Publisher, or the default item if that index is outside the bounds of the source sequence
Throws
IndexOutOfBoundsException if index is less than 0

public static Flowable<T> empty ()

Returns a Flowable that emits no items to the Subscriber and immediately invokes its onComplete method.

Backpressure:
This source doesn't produce any elements and effectively ignores downstream backpressure.
Scheduler:
empty does not operate by default on a particular Scheduler.

Returns
  • a Flowable that emits no items to the Subscriber but immediately invokes the Subscriber's onComplete method

public static Flowable<T> error (Callable<? extends Throwable> supplier)

Returns a Flowable that invokes a Subscriber's onError method when the Subscriber subscribes to it.

Backpressure:
This source doesn't produce any elements and effectively ignores downstream backpressure.
Scheduler:
error does not operate by default on a particular Scheduler.

Parameters
supplier a Callable factory to return a Throwable for each individual Subscriber
Returns
  • a Flowable that invokes the Subscriber's onError method when the Subscriber subscribes to it

public static Flowable<T> error (Throwable throwable)

Returns a Flowable that invokes a Subscriber's onError method when the Subscriber subscribes to it.

Backpressure:
This source doesn't produce any elements and effectively ignores downstream backpressure.
Scheduler:
error does not operate by default on a particular Scheduler.

Parameters
throwable the particular Throwable to pass to onError
Returns
  • a Flowable that invokes the Subscriber's onError method when the Subscriber subscribes to it

public final Flowable<T> filter (Predicate<? super T> predicate)

Filters items emitted by a Publisher by only emitting those that satisfy a specified predicate.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
filter does not operate by default on a particular Scheduler.

Parameters
predicate a function that evaluates each item emitted by the source Publisher, returning true if it passes the filter
Returns
  • a Flowable that emits only those items emitted by the source Publisher that the filter evaluates as true

public final Single<T> first (T defaultItem)

Returns a Single that emits only the very first item emitted by this Flowable, or a default item if this Flowable completes without emitting anything.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure).
Scheduler:
first does not operate by default on a particular Scheduler.

Parameters
defaultItem the default item to emit if the source Publisher doesn't emit anything
Returns
  • a Single that emits only the very first item from the source, or a default item if the source Publisher completes without emitting any items

public final Maybe<T> firstElement ()

Returns a Maybe that emits only the very first item emitted by this Flowable or completes if this Flowable is empty.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure).
Scheduler:
firstElement does not operate by default on a particular Scheduler.

Returns
  • the new Maybe instance

public final Single<T> firstOrError ()

Returns a Single that emits only the very first item emitted by this Flowable or signals a NoSuchElementException if this Flowable is empty.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure).
Scheduler:
firstOrError does not operate by default on a particular Scheduler.

Returns
  • the new Single instance

public final Flowable<R> flatMap (Function<? super T, ? extends Publisher<? extends R>> onNextMapper, Function<Throwable, ? extends Publisher<? extends R>> onErrorMapper, Callable<? extends Publisher<? extends R>> onCompleteSupplier, int maxConcurrency)

Returns a Flowable that applies a function to each item emitted or notification raised by the source Publisher and then flattens the Publishers returned from these functions and emits the resulting items, while limiting the maximum number of concurrent subscriptions to these Publishers.

Backpressure:
The operator honors backpressure from downstream. The upstream Flowable is consumed in a bounded manner (up to maxConcurrency outstanding request amount for items). The inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
flatMap does not operate by default on a particular Scheduler.

Parameters
onNextMapper a function that returns a Publisher to merge for each item emitted by the source Publisher
onErrorMapper a function that returns a Publisher to merge for an onError notification from the source Publisher
onCompleteSupplier a function that returns a Publisher to merge for an onComplete notification from the source Publisher
maxConcurrency the maximum number of Publishers that may be subscribed to concurrently
Returns
  • a Flowable that emits the results of merging the Publishers returned from applying the specified functions to the emissions and notifications of the source Publisher

public final Flowable<R> flatMap (Function<? super T, ? extends Publisher<? extends U>> mapper, BiFunction<? super T, ? super U, ? extends R> combiner, boolean delayErrors, int maxConcurrency)

Returns a Flowable that emits the results of a specified function to the pair of values emitted by the source Publisher and a specified collection Publisher, while limiting the maximum number of concurrent subscriptions to these Publishers.

Backpressure:
The operator honors backpressure from downstream. The upstream Flowable is consumed in a bounded manner (up to maxConcurrency outstanding request amount for items). The inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
flatMap does not operate by default on a particular Scheduler.

Parameters
mapper a function that returns a Publisher for each item emitted by the source Publisher
combiner a function that combines one item emitted by each of the source and collection Publishers and returns an item to be emitted by the resulting Publisher
delayErrors if true, exceptions from the current Flowable and all inner Publishers are delayed until all of them terminate if false, the first one signalling an exception will terminate the whole sequence immediately
maxConcurrency the maximum number of Publishers that may be subscribed to concurrently
Returns
  • a Flowable that emits the results of applying a function to a pair of values emitted by the source Publisher and the collection Publisher

public final Flowable<R> flatMap (Function<? super T, ? extends Publisher<? extends U>> mapper, BiFunction<? super T, ? super U, ? extends R> combiner, int maxConcurrency)

Returns a Flowable that emits the results of a specified function to the pair of values emitted by the source Publisher and a specified collection Publisher, while limiting the maximum number of concurrent subscriptions to these Publishers.

Backpressure:
The operator honors backpressure from downstream. The upstream Flowable is consumed in a bounded manner (up to bufferSize() outstanding request amount for items). The inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
flatMap does not operate by default on a particular Scheduler.

Parameters
mapper a function that returns a Publisher for each item emitted by the source Publisher
combiner a function that combines one item emitted by each of the source and collection Publishers and returns an item to be emitted by the resulting Publisher
maxConcurrency the maximum number of Publishers that may be subscribed to concurrently
Returns
  • a Flowable that emits the results of applying a function to a pair of values emitted by the source Publisher and the collection Publisher

public final Flowable<R> flatMap (Function<? super T, ? extends Publisher<? extends R>> mapper, boolean delayErrors, int maxConcurrency)

Returns a Flowable that emits items based on applying a function that you supply to each item emitted by the source Publisher, where that function returns a Publisher, and then merging those resulting Publishers and emitting the results of this merger, while limiting the maximum number of concurrent subscriptions to these Publishers.

Backpressure:
The operator honors backpressure from downstream. The upstream Flowable is consumed in a bounded manner (up to maxConcurrency outstanding request amount for items). The inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
flatMap does not operate by default on a particular Scheduler.

Parameters
mapper a function that, when applied to an item emitted by the source Publisher, returns an Publisher
delayErrors if true, exceptions from the current Flowable and all inner Publishers are delayed until all of them terminate if false, the first one signalling an exception will terminate the whole sequence immediately
maxConcurrency the maximum number of Publishers that may be subscribed to concurrently
Returns
  • a Flowable that emits the result of applying the transformation function to each item emitted by the source Publisher and merging the results of the Publishers obtained from this transformation

public final Flowable<R> flatMap (Function<? super T, ? extends Publisher<? extends R>> mapper, int maxConcurrency)

Returns a Flowable that emits items based on applying a function that you supply to each item emitted by the source Publisher, where that function returns a Publisher, and then merging those resulting Publishers and emitting the results of this merger, while limiting the maximum number of concurrent subscriptions to these Publishers.

Backpressure:
The operator honors backpressure from downstream. The upstream Flowable is consumed in a bounded manner (up to maxConcurrency outstanding request amount for items). The inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
flatMap does not operate by default on a particular Scheduler.

Parameters
mapper a function that, when applied to an item emitted by the source Publisher, returns an Publisher
maxConcurrency the maximum number of Publishers that may be subscribed to concurrently
Returns
  • a Flowable that emits the result of applying the transformation function to each item emitted by the source Publisher and merging the results of the Publishers obtained from this transformation

public final Flowable<R> flatMap (Function<? super T, ? extends Publisher<? extends U>> mapper, BiFunction<? super T, ? super U, ? extends R> combiner)

Returns a Flowable that emits the results of a specified function to the pair of values emitted by the source Publisher and a specified collection Publisher.

Backpressure:
The operator honors backpressure from downstream. The upstream Flowable is consumed in a bounded manner (up to maxConcurrency outstanding request amount for items). The inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
flatMap does not operate by default on a particular Scheduler.

Parameters
mapper a function that returns a Publisher for each item emitted by the source Publisher
combiner a function that combines one item emitted by each of the source and collection Publishers and returns an item to be emitted by the resulting Publisher
Returns
  • a Flowable that emits the results of applying a function to a pair of values emitted by the source Publisher and the collection Publisher

public final Flowable<R> flatMap (Function<? super T, ? extends Publisher<? extends U>> mapper, BiFunction<? super T, ? super U, ? extends R> combiner, boolean delayErrors, int maxConcurrency, int bufferSize)

Returns a Flowable that emits the results of a specified function to the pair of values emitted by the source Publisher and a specified collection Publisher, while limiting the maximum number of concurrent subscriptions to these Publishers.

Backpressure:
The operator honors backpressure from downstream. The upstream Flowable is consumed in a bounded manner (up to maxConcurrency outstanding request amount for items). The inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
flatMap does not operate by default on a particular Scheduler.

Parameters
mapper a function that returns a Publisher for each item emitted by the source Publisher
combiner a function that combines one item emitted by each of the source and collection Publishers and returns an item to be emitted by the resulting Publisher
delayErrors if true, exceptions from the current Flowable and all inner Publishers are delayed until all of them terminate if false, the first one signalling an exception will terminate the whole sequence immediately
maxConcurrency the maximum number of Publishers that may be subscribed to concurrently
bufferSize the number of elements to prefetch from the inner Publishers.
Returns
  • a Flowable that emits the results of applying a function to a pair of values emitted by the source Publisher and the collection Publisher

public final Flowable<R> flatMap (Function<? super T, ? extends Publisher<? extends R>> mapper, boolean delayErrors)

Returns a Flowable that emits items based on applying a function that you supply to each item emitted by the source Publisher, where that function returns a Publisher, and then merging those resulting Publishers and emitting the results of this merger.

Backpressure:
The operator honors backpressure from downstream. The upstream Flowable is consumed in a bounded manner (up to bufferSize() outstanding request amount for items). The inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
flatMap does not operate by default on a particular Scheduler.

Parameters
mapper a function that, when applied to an item emitted by the source Publisher, returns an Publisher
delayErrors if true, exceptions from the current Flowable and all inner Publishers are delayed until all of them terminate if false, the first one signalling an exception will terminate the whole sequence immediately
Returns
  • a Flowable that emits the result of applying the transformation function to each item emitted by the source Publisher and merging the results of the Publishers obtained from this transformation

public final Flowable<R> flatMap (Function<? super T, ? extends Publisher<? extends U>> mapper, BiFunction<? super T, ? super U, ? extends R> combiner, boolean delayErrors)

Returns a Flowable that emits the results of a specified function to the pair of values emitted by the source Publisher and a specified collection Publisher.

Backpressure:
The operator honors backpressure from downstream. The upstream Flowable is consumed in a bounded manner (up to bufferSize() outstanding request amount for items). The inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
flatMap does not operate by default on a particular Scheduler.

Parameters
mapper a function that returns a Publisher for each item emitted by the source Publisher
combiner a function that combines one item emitted by each of the source and collection Publishers and returns an item to be emitted by the resulting Publisher
delayErrors if true, exceptions from the current Flowable and all inner Publishers are delayed until all of them terminate if false, the first one signalling an exception will terminate the whole sequence immediately
Returns
  • a Flowable that emits the results of applying a function to a pair of values emitted by the source Publisher and the collection Publisher

public final Flowable<R> flatMap (Function<? super T, ? extends Publisher<? extends R>> onNextMapper, Function<? super Throwable, ? extends Publisher<? extends R>> onErrorMapper, Callable<? extends Publisher<? extends R>> onCompleteSupplier)

Returns a Flowable that applies a function to each item emitted or notification raised by the source Publisher and then flattens the Publishers returned from these functions and emits the resulting items.

Backpressure:
The operator honors backpressure from downstream. The upstream Flowable is consumed in a bounded manner (up to bufferSize() outstanding request amount for items). The inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
flatMap does not operate by default on a particular Scheduler.

Parameters
onNextMapper a function that returns a Publisher to merge for each item emitted by the source Publisher
onErrorMapper a function that returns a Publisher to merge for an onError notification from the source Publisher
onCompleteSupplier a function that returns a Publisher to merge for an onComplete notification from the source Publisher
Returns
  • a Flowable that emits the results of merging the Publishers returned from applying the specified functions to the emissions and notifications of the source Publisher

public final Flowable<R> flatMap (Function<? super T, ? extends Publisher<? extends R>> mapper)

Returns a Flowable that emits items based on applying a function that you supply to each item emitted by the source Publisher, where that function returns a Publisher, and then merging those resulting Publishers and emitting the results of this merger.

Backpressure:
The operator honors backpressure from downstream. The upstream Flowable is consumed in a bounded manner (up to bufferSize() outstanding request amount for items). The inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
flatMap does not operate by default on a particular Scheduler.

Parameters
mapper a function that, when applied to an item emitted by the source Publisher, returns an Publisher
Returns
  • a Flowable that emits the result of applying the transformation function to each item emitted by the source Publisher and merging the results of the Publishers obtained from this transformation

public final Flowable<R> flatMap (Function<? super T, ? extends Publisher<? extends R>> mapper, boolean delayErrors, int maxConcurrency, int bufferSize)

Returns a Flowable that emits items based on applying a function that you supply to each item emitted by the source Publisher, where that function returns a Publisher, and then merging those resulting Publishers and emitting the results of this merger, while limiting the maximum number of concurrent subscriptions to these Publishers.

Backpressure:
The operator honors backpressure from downstream. The upstream Flowable is consumed in a bounded manner (up to maxConcurrency outstanding request amount for items). The inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
flatMap does not operate by default on a particular Scheduler.

Parameters
mapper a function that, when applied to an item emitted by the source Publisher, returns an Publisher
delayErrors if true, exceptions from the current Flowable and all inner Publishers are delayed until all of them terminate if false, the first one signalling an exception will terminate the whole sequence immediately
maxConcurrency the maximum number of Publishers that may be subscribed to concurrently
bufferSize the number of elements to prefetch from each inner Publisher
Returns
  • a Flowable that emits the result of applying the transformation function to each item emitted by the source Publisher and merging the results of the Publishers obtained from this transformation

public final Completable flatMapCompletable (Function<? super T, ? extends CompletableSource> mapper)

Maps each element of the upstream Flowable into CompletableSources, subscribes to them and waits until the upstream and all CompletableSources complete.

Backpressure:
The operator consumes the upstream in an unbounded manner.
Scheduler:
flatMapCompletable does not operate by default on a particular Scheduler.

Parameters
mapper the function that received each source value and transforms them into CompletableSources.
Returns
  • the new Completable instance

public final Completable flatMapCompletable (Function<? super T, ? extends CompletableSource> mapper, boolean delayErrors, int maxConcurrency)

Maps each element of the upstream Flowable into CompletableSources, subscribes to them and waits until the upstream and all CompletableSources complete, optionally delaying all errors.

Backpressure:
If maxConcurrency == Integer.MAX_VALUE the operator consumes the upstream in an unbounded manner. Otherwise the operator expects the upstream to honor backpressure. If the upstream doesn't support backpressure the operator behaves as if maxConcurrency == Integer.MAX_VALUE was used.
Scheduler:
flatMapCompletable does not operate by default on a particular Scheduler.

Parameters
mapper the function that received each source value and transforms them into CompletableSources.
delayErrors if true errors from the upstream and inner CompletableSources are delayed until each of them terminates.
maxConcurrency the maximum number of active subscriptions to the CompletableSources.
Returns
  • the new Completable instance

public final Flowable<U> flatMapIterable (Function<? super T, ? extends Iterable<? extends U>> mapper, int bufferSize)

Returns a Flowable that merges each item emitted by the source Publisher with the values in an Iterable corresponding to that item that is generated by a selector.

Backpressure:
The operator honors backpressure from downstream. The source Publishers is expected to honor backpressure as well. If the source Publisher violates the rule, the operator will signal a MissingBackpressureException.
Scheduler:
flatMapIterable does not operate by default on a particular Scheduler.

Parameters
mapper a function that returns an Iterable sequence of values for when given an item emitted by the source Publisher
bufferSize the number of elements to prefetch from the current Flowable
Returns
  • a Flowable that emits the results of merging the items emitted by the source Publisher with the values in the Iterables corresponding to those items, as generated by collectionSelector

public final Flowable<V> flatMapIterable (Function<? super T, ? extends Iterable<? extends U>> mapper, BiFunction<? super T, ? super U, ? extends V> resultSelector)

Returns a Flowable that emits the results of applying a function to the pair of values from the source Publisher and an Iterable corresponding to that item that is generated by a selector.

Backpressure:
The operator honors backpressure from downstream and the source Publishers is consumed in an unbounded manner (i.e., no backpressure is applied to it).
Scheduler:
flatMapIterable does not operate by default on a particular Scheduler.

Parameters
mapper a function that returns an Iterable sequence of values for each item emitted by the source Publisher
resultSelector a function that returns an item based on the item emitted by the source Publisher and the Iterable returned for that item by the collectionSelector
Returns
  • a Flowable that emits the items returned by resultSelector for each item in the source Publisher

public final Flowable<U> flatMapIterable (Function<? super T, ? extends Iterable<? extends U>> mapper)

Returns a Flowable that merges each item emitted by the source Publisher with the values in an Iterable corresponding to that item that is generated by a selector.

Backpressure:
The operator honors backpressure from downstream. The source Publishers is expected to honor backpressure as well. If the source Publisher violates the rule, the operator will signal a MissingBackpressureException.
Scheduler:
flatMapIterable does not operate by default on a particular Scheduler.

Parameters
mapper a function that returns an Iterable sequence of values for when given an item emitted by the source Publisher
Returns
  • a Flowable that emits the results of merging the items emitted by the source Publisher with the values in the Iterables corresponding to those items, as generated by collectionSelector

public final Flowable<V> flatMapIterable (Function<? super T, ? extends Iterable<? extends U>> mapper, BiFunction<? super T, ? super U, ? extends V> resultSelector, int prefetch)

Returns a Flowable that merges each item emitted by the source Publisher with the values in an Iterable corresponding to that item that is generated by a selector, while limiting the number of concurrent subscriptions to these Publishers.

Backpressure:
The operator honors backpressure from downstream. The source Publishers is expected to honor backpressure as well. If the source Publisher violates the rule, the operator will signal a MissingBackpressureException.
Scheduler:
flatMapIterable does not operate by default on a particular Scheduler.

Parameters
mapper a function that returns an Iterable sequence of values for when given an item emitted by the source Publisher
resultSelector a function that returns an item based on the item emitted by the source Publisher and the Iterable returned for that item by the collectionSelector
prefetch the number of elements to prefetch from the current Flowable
Returns
  • a Flowable that emits the results of merging the items emitted by the source Publisher with the values in the Iterables corresponding to those items, as generated by collectionSelector

public final Flowable<R> flatMapMaybe (Function<? super T, ? extends MaybeSource<? extends R>> mapper, boolean delayErrors, int maxConcurrency)

Maps each element of the upstream Flowable into MaybeSources, subscribes to them and waits until the upstream and all MaybeSources complete, optionally delaying all errors.

Backpressure:
If maxConcurrency == Integer.MAX_VALUE the operator consumes the upstream in an unbounded manner. Otherwise the operator expects the upstream to honor backpressure. If the upstream doesn't support backpressure the operator behaves as if maxConcurrency == Integer.MAX_VALUE was used.
Scheduler:
flatMapMaybe does not operate by default on a particular Scheduler.

Parameters
mapper the function that received each source value and transforms them into MaybeSources.
delayErrors if true errors from the upstream and inner MaybeSources are delayed until each of them terminates.
maxConcurrency the maximum number of active subscriptions to the MaybeSources.
Returns
  • the new Flowable instance

public final Flowable<R> flatMapMaybe (Function<? super T, ? extends MaybeSource<? extends R>> mapper)

Maps each element of the upstream Flowable into MaybeSources, subscribes to them and waits until the upstream and all MaybeSources complete.

Backpressure:
The operator consumes the upstream in an unbounded manner.
Scheduler:
flatMapMaybe does not operate by default on a particular Scheduler.

Parameters
mapper the function that received each source value and transforms them into MaybeSources.
Returns
  • the new Flowable instance

public final Flowable<R> flatMapSingle (Function<? super T, ? extends SingleSource<? extends R>> mapper, boolean delayErrors, int maxConcurrency)

Maps each element of the upstream Flowable into SingleSources, subscribes to them and waits until the upstream and all SingleSources complete, optionally delaying all errors.

Backpressure:
If maxConcurrency == Integer.MAX_VALUE the operator consumes the upstream in an unbounded manner. Otherwise the operator expects the upstream to honor backpressure. If the upstream doesn't support backpressure the operator behaves as if maxConcurrency == Integer.MAX_VALUE was used.
Scheduler:
flatMapSingle does not operate by default on a particular Scheduler.

Parameters
mapper the function that received each source value and transforms them into SingleSources.
delayErrors if true errors from the upstream and inner SingleSources are delayed until each of them terminates.
maxConcurrency the maximum number of active subscriptions to the SingleSources.
Returns
  • the new Flowable instance

public final Flowable<R> flatMapSingle (Function<? super T, ? extends SingleSource<? extends R>> mapper)

Maps each element of the upstream Flowable into SingleSources, subscribes to them and waits until the upstream and all SingleSources complete.

Backpressure:
The operator consumes the upstream in an unbounded manner.
Scheduler:
flatMapSingle does not operate by default on a particular Scheduler.

Parameters
mapper the function that received each source value and transforms them into SingleSources.
Returns
  • the new Flowable instance

public final Disposable forEach (Consumer<? super T> onNext)

Subscribes to the Publisher and receives notifications for each element.

Alias to subscribe(Consumer)

Backpressure:
The operator consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it).
Scheduler:
forEach does not operate by default on a particular Scheduler.

Parameters
onNext Consumer to execute for each item.
Returns
  • a Disposable that allows cancelling an asynchronous sequence
Throws
NullPointerException if onNext is null

public final Disposable forEachWhile (Predicate<? super T> onNext, Consumer<? super Throwable> onError, Action onComplete)

Subscribes to the Publisher and receives notifications for each element and the terminal events until the onNext Predicate returns false.

Backpressure:
The operator consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it).
Scheduler:
forEachWhile does not operate by default on a particular Scheduler.

Parameters
onNext Predicate to execute for each item.
onError Consumer to execute when an error is emitted.
onComplete Action to execute when completion is signalled.
Returns
  • a Disposable that allows cancelling an asynchronous sequence
Throws
NullPointerException if onNext is null, or if onError is null, or if onComplete is null

public final Disposable forEachWhile (Predicate<? super T> onNext, Consumer<? super Throwable> onError)

Subscribes to the Publisher and receives notifications for each element and error events until the onNext Predicate returns false.

Backpressure:
The operator consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it).
Scheduler:
forEachWhile does not operate by default on a particular Scheduler.

Parameters
onNext Predicate to execute for each item.
onError Consumer to execute when an error is emitted.
Returns
  • a Disposable that allows cancelling an asynchronous sequence
Throws
NullPointerException if onNext is null, or if onError is null

public final Disposable forEachWhile (Predicate<? super T> onNext)

Subscribes to the Publisher and receives notifications for each element until the onNext Predicate returns false.

If the Flowable emits an error, it is wrapped into an OnErrorNotImplementedException and routed to the RxJavaPlugins.onError handler.

Backpressure:
The operator consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it).
Scheduler:
forEachWhile does not operate by default on a particular Scheduler.

Parameters
onNext Predicate to execute for each item.
Returns
  • a Disposable that allows cancelling an asynchronous sequence
Throws
NullPointerException if onNext is null

public static Flowable<T> fromArray (T... items)

Converts an Array into a Publisher that emits the items in the Array.

Backpressure:
The operator honors backpressure from downstream and iterates the given array on demand (i.e., when requested).
Scheduler:
fromArray does not operate by default on a particular Scheduler.

Parameters
items the array of elements
Returns
  • a Flowable that emits each item in the source Array

public static Flowable<T> fromCallable (Callable<? extends T> supplier)

Returns a Flowable that, when a Subscriber subscribes to it, invokes a function you specify and then emits the value returned from that function.

This allows you to defer the execution of the function you specify until a Subscriber subscribes to the Publisher. That is to say, it makes the function "lazy."

Backpressure:
The operator honors backpressure from downstream.
Scheduler:
fromCallable does not operate by default on a particular Scheduler.

Parameters
supplier a function, the execution of which should be deferred; fromCallable will invoke this function only when a Subscriber subscribes to the Publisher that fromCallable returns
Returns
  • a Flowable whose Subscribers' subscriptions trigger an invocation of the given function
See Also

public static Flowable<T> fromFuture (Future<? extends T> future, Scheduler scheduler)

Converts a Future, operating on a specified Scheduler, into a Publisher.

You can convert any object that supports the Future interface into a Publisher that emits the return value of the get() method of that object, by passing the object into the from method.

Unlike 1.x, cancelling the Flowable won't cancel the future. If necessary, one can use composition to achieve the cancellation effect: futurePublisher.doOnCancel(() -> future.cancel(true));.

Backpressure:
The operator honors backpressure from downstream.
Scheduler:
You specify which Scheduler this operator will use

Parameters
future the source Future
scheduler the Scheduler to wait for the Future on. Use a Scheduler such as io() that can block and wait on the Future
Returns
  • a Flowable that emits the item from the source Future

public static Flowable<T> fromFuture (Future<? extends T> future, long timeout, TimeUnit unit, Scheduler scheduler)

Converts a Future into a Publisher, with a timeout on the Future.

You can convert any object that supports the Future interface into a Publisher that emits the return value of the get() method of that object, by passing the object into the from method.

Unlike 1.x, cancelling the Flowable won't cancel the future. If necessary, one can use composition to achieve the cancellation effect: futurePublisher.doOnCancel(() -> future.cancel(true));.

Important note: This Publisher is blocking; you cannot cancel it.

Backpressure:
The operator honors backpressure from downstream.
Scheduler:
fromFuture does not operate by default on a particular Scheduler.

Parameters
future the source Future
timeout the maximum time to wait before calling get
unit the TimeUnit of the timeout argument
scheduler the Scheduler to wait for the Future on. Use a Scheduler such as io() that can block and wait on the Future
Returns
  • a Flowable that emits the item from the source Future

public static Flowable<T> fromFuture (Future<? extends T> future, long timeout, TimeUnit unit)

Converts a Future into a Publisher, with a timeout on the Future.

You can convert any object that supports the Future interface into a Publisher that emits the return value of the get() method of that object, by passing the object into the fromFuture method.

Unlike 1.x, cancelling the Flowable won't cancel the future. If necessary, one can use composition to achieve the cancellation effect: futurePublisher.doOnCancel(() -> future.cancel(true));.

Important note: This Publisher is blocking on the thread it gets subscribed on; you cannot cancel it.

Backpressure:
The operator honors backpressure from downstream.
Scheduler:
fromFuture does not operate by default on a particular Scheduler.

Parameters
future the source Future
timeout the maximum time to wait before calling get
unit the TimeUnit of the timeout argument
Returns
  • a Flowable that emits the item from the source Future

public static Flowable<T> fromFuture (Future<? extends T> future)

Converts a Future into a Publisher.

You can convert any object that supports the Future interface into a Publisher that emits the return value of the get() method of that object, by passing the object into the from method.

Important note: This Publisher is blocking on the thread it gets subscribed on; you cannot cancel it.

Unlike 1.x, cancelling the Flowable won't cancel the future. If necessary, one can use composition to achieve the cancellation effect: futurePublisher.doOnCancel(() -> future.cancel(true));.

Backpressure:
The operator honors backpressure from downstream.
Scheduler:
fromFuture does not operate by default on a particular Scheduler.

Parameters
future the source Future
Returns
  • a Flowable that emits the item from the source Future

public static Flowable<T> fromIterable (Iterable<? extends T> source)

Converts an Iterable sequence into a Publisher that emits the items in the sequence.

Backpressure:
The operator honors backpressure from downstream and iterates the given iterable on demand (i.e., when requested).
Scheduler:
fromIterable does not operate by default on a particular Scheduler.

Parameters
source the source Iterable sequence
Returns
  • a Flowable that emits each item in the source Iterable sequence

public static Flowable<T> fromPublisher (Publisher<? extends T> source)

Converts an arbitrary Reactive-Streams Publisher into a Flowable if not already a Flowable.

Backpressure:
The operator is a pass-through for backpressure and its behavior is determined by the backpressure behavior of the wrapped publisher.
Scheduler:
fromPublisher does not operate by default on a particular Scheduler.

Parameters
source the Publisher to convert
Returns
  • the new Flowable instance
Throws
NullPointerException if publisher is null

public static Flowable<T> generate (Callable<S> initialState, BiFunction<S, Emitter<T>, S> generator, Consumer<? super S> disposeState)

Returns a cold, synchronous, stateful and backpressure-aware generator of values.

Backpressure:
The operator honors downstream backpressure.
Scheduler:
generate does not operate by default on a particular Scheduler.

Parameters
initialState the Callable to generate the initial state for each Subscriber
generator the Function called with the current state whenever a particular downstream Subscriber has requested a value. The callback then should call onNext, onError or onComplete to signal a value or a terminal event and should return a (new) state for the next invocation. Signalling multiple onNext in a call will make the operator signal IllegalStateException.
disposeState the Consumer that is called with the current state when the generator terminates the sequence or it gets cancelled
Returns
  • the new Flowable instance

public static Flowable<T> generate (Callable<S> initialState, BiFunction<S, Emitter<T>, S> generator)

Returns a cold, synchronous, stateful and backpressure-aware generator of values.

Backpressure:
The operator honors downstream backpressure.
Scheduler:
generate does not operate by default on a particular Scheduler.

Parameters
initialState the Callable to generate the initial state for each Subscriber
generator the Function called with the current state whenever a particular downstream Subscriber has requested a value. The callback then should call onNext, onError or onComplete to signal a value or a terminal event and should return a (new) state for the next invocation. Signalling multiple onNext in a call will make the operator signal IllegalStateException.
Returns
  • the new Flowable instance

public static Flowable<T> generate (Callable<S> initialState, BiConsumer<S, Emitter<T>> generator)

Returns a cold, synchronous, stateful and backpressure-aware generator of values.

Backpressure:
The operator honors downstream backpressure.
Scheduler:
generate does not operate by default on a particular Scheduler.

Parameters
initialState the Callable to generate the initial state for each Subscriber
generator the Consumer called with the current state whenever a particular downstream Subscriber has requested a value. The callback then should call onNext, onError or onComplete to signal a value or a terminal event. Signalling multiple onNext in a call will make the operator signal IllegalStateException.
Returns
  • the new Flowable instance

public static Flowable<T> generate (Callable<S> initialState, BiConsumer<S, Emitter<T>> generator, Consumer<? super S> disposeState)

Returns a cold, synchronous, stateful and backpressure-aware generator of values.

Backpressure:
The operator honors downstream backpressure.
Scheduler:
generate does not operate by default on a particular Scheduler.

Parameters
initialState the Callable to generate the initial state for each Subscriber
generator the Consumer called with the current state whenever a particular downstream Subscriber has requested a value. The callback then should call onNext, onError or onComplete to signal a value or a terminal event. Signalling multiple onNext in a call will make the operator signal IllegalStateException.
disposeState the Consumer that is called with the current state when the generator terminates the sequence or it gets cancelled
Returns
  • the new Flowable instance

public static Flowable<T> generate (Consumer<Emitter<T>> generator)

Returns a cold, synchronous, stateless and backpressure-aware generator of values.

Backpressure:
The operator honors downstream backpressure.
Scheduler:
generate does not operate by default on a particular Scheduler.

Parameters
generator the Consumer called whenever a particular downstream Subscriber has requested a value. The callback then should call onNext, onError or onComplete to signal a value or a terminal event. Signalling multiple onNext in a call will make the operator signal IllegalStateException.
Returns
  • the new Flowable instance

public final Flowable<GroupedFlowable<K, T>> groupBy (Function<? super T, ? extends K> keySelector, boolean delayError)

Groups the items emitted by a Publisher according to a specified criterion, and emits these grouped items as GroupedFlowables. The emitted GroupedPublisher allows only a single Subscriber during its lifetime and if this Subscriber cancels before the source terminates, the next emission by the source having the same key will trigger a new GroupedPublisher emission.

Note: A GroupedFlowable will cache the items it is to emit until such time as it is subscribed to. For this reason, in order to avoid memory leaks, you should not simply ignore those GroupedPublishers that do not concern you. Instead, you can signal to them that they may discard their buffers by applying an operator like ignoreElements() to them.

Backpressure:
Both the returned and its inner Publishers honor backpressure and the source Publisher is consumed in a bounded mode (i.e., requested a fixed amount upfront and replenished based on downstream consumption). Note that both the returned and its inner Publishers use unbounded internal buffers and if the source Publisher doesn't honor backpressure, that may lead to OutOfMemoryError.
Scheduler:
groupBy does not operate by default on a particular Scheduler.

Parameters
keySelector a function that extracts the key for each item
delayError if true, the exception from the current Flowable is delayed in each group until that specific group emitted the normal values; if false, the exception bypasses values in the groups and is reported immediately.
Returns
  • a Publisher that emits GroupedFlowables, each of which corresponds to a unique key value and each of which emits those items from the source Publisher that share that key value

public final Flowable<GroupedFlowable<K, T>> groupBy (Function<? super T, ? extends K> keySelector)

Groups the items emitted by a Publisher according to a specified criterion, and emits these grouped items as GroupedFlowables. The emitted GroupedPublisher allows only a single Subscriber during its lifetime and if this Subscriber cancels before the source terminates, the next emission by the source having the same key will trigger a new GroupedPublisher emission.

Note: A GroupedFlowable will cache the items it is to emit until such time as it is subscribed to. For this reason, in order to avoid memory leaks, you should not simply ignore those GroupedPublishers that do not concern you. Instead, you can signal to them that they may discard their buffers by applying an operator like ignoreElements() to them.

Backpressure:
Both the returned and its inner Publishers honor backpressure and the source Publisher is consumed in a bounded mode (i.e., requested a fixed amount upfront and replenished based on downstream consumption). Note that both the returned and its inner Publishers use unbounded internal buffers and if the source Publisher doesn't honor backpressure, that may lead to OutOfMemoryError.
Scheduler:
groupBy does not operate by default on a particular Scheduler.

Parameters
keySelector a function that extracts the key for each item
Returns
  • a Publisher that emits GroupedFlowables, each of which corresponds to a unique key value and each of which emits those items from the source Publisher that share that key value

public final Flowable<GroupedFlowable<K, V>> groupBy (Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector)

Groups the items emitted by a Publisher according to a specified criterion, and emits these grouped items as GroupedFlowables. The emitted GroupedPublisher allows only a single Subscriber during its lifetime and if this Subscriber cancels before the source terminates, the next emission by the source having the same key will trigger a new GroupedPublisher emission.

Note: A GroupedFlowable will cache the items it is to emit until such time as it is subscribed to. For this reason, in order to avoid memory leaks, you should not simply ignore those GroupedPublishers that do not concern you. Instead, you can signal to them that they may discard their buffers by applying an operator like ignoreElements() to them.

Backpressure:
Both the returned and its inner Publishers honor backpressure and the source Publisher is consumed in a bounded mode (i.e., requested a fixed amount upfront and replenished based on downstream consumption). Note that both the returned and its inner Publishers use unbounded internal buffers and if the source Publisher doesn't honor backpressure, that may lead to OutOfMemoryError.
Scheduler:
groupBy does not operate by default on a particular Scheduler.

Parameters
keySelector a function that extracts the key for each item
valueSelector a function that extracts the return element for each item
Returns
  • a Publisher that emits GroupedFlowables, each of which corresponds to a unique key value and each of which emits those items from the source Publisher that share that key value

public final Flowable<GroupedFlowable<K, V>> groupBy (Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector, boolean delayError)

Groups the items emitted by a Publisher according to a specified criterion, and emits these grouped items as GroupedFlowables. The emitted GroupedPublisher allows only a single Subscriber during its lifetime and if this Subscriber cancels before the source terminates, the next emission by the source having the same key will trigger a new GroupedPublisher emission.

Note: A GroupedFlowable will cache the items it is to emit until such time as it is subscribed to. For this reason, in order to avoid memory leaks, you should not simply ignore those GroupedPublishers that do not concern you. Instead, you can signal to them that they may discard their buffers by applying an operator like ignoreElements() to them.

Backpressure:
Both the returned and its inner Publishers honor backpressure and the source Publisher is consumed in a bounded mode (i.e., requested a fixed amount upfront and replenished based on downstream consumption). Note that both the returned and its inner Publishers use unbounded internal buffers and if the source Publisher doesn't honor backpressure, that may lead to OutOfMemoryError.
Scheduler:
groupBy does not operate by default on a particular Scheduler.

Parameters
keySelector a function that extracts the key for each item
valueSelector a function that extracts the return element for each item
delayError if true, the exception from the current Flowable is delayed in each group until that specific group emitted the normal values; if false, the exception bypasses values in the groups and is reported immediately.
Returns
  • a Publisher that emits GroupedFlowables, each of which corresponds to a unique key value and each of which emits those items from the source Publisher that share that key value

public final Flowable<GroupedFlowable<K, V>> groupBy (Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector, boolean delayError, int bufferSize)

Groups the items emitted by a Publisher according to a specified criterion, and emits these grouped items as GroupedFlowables. The emitted GroupedPublisher allows only a single Subscriber during its lifetime and if this Subscriber cancels before the source terminates, the next emission by the source having the same key will trigger a new GroupedPublisher emission.

Note: A GroupedFlowable will cache the items it is to emit until such time as it is subscribed to. For this reason, in order to avoid memory leaks, you should not simply ignore those GroupedPublishers that do not concern you. Instead, you can signal to them that they may discard their buffers by applying an operator like ignoreElements() to them.

Backpressure:
Both the returned and its inner Publishers honor backpressure and the source Publisher is consumed in a bounded mode (i.e., requested a fixed amount upfront and replenished based on downstream consumption). Note that both the returned and its inner Publishers use unbounded internal buffers and if the source Publisher doesn't honor backpressure, that may lead to OutOfMemoryError.
Scheduler:
groupBy does not operate by default on a particular Scheduler.

Parameters
keySelector a function that extracts the key for each item
valueSelector a function that extracts the return element for each item
delayError if true, the exception from the current Flowable is delayed in each group until that specific group emitted the normal values; if false, the exception bypasses values in the groups and is reported immediately.
bufferSize the hint for how many GroupedFlowables and element in each GroupedFlowable should be buffered
Returns
  • a Publisher that emits GroupedFlowables, each of which corresponds to a unique key value and each of which emits those items from the source Publisher that share that key value

public final Flowable<R> groupJoin (Publisher<? extends TRight> other, Function<? super T, ? extends Publisher<TLeftEnd>> leftEnd, Function<? super TRight, ? extends Publisher<TRightEnd>> rightEnd, BiFunction<? super T, ? super Flowable<TRight>, ? extends R> resultSelector)

Returns a Flowable that correlates two Publishers when they overlap in time and groups the results.

There are no guarantees in what order the items get combined when multiple items from one or both source Publishers overlap.

Backpressure:
The operator doesn't support backpressure and consumes all participating Publishers in an unbounded mode (i.e., not applying any backpressure to them).
Scheduler:
groupJoin does not operate by default on a particular Scheduler.

Parameters
other the other Publisher to correlate items from the source Publisher with
leftEnd a function that returns a Publisher whose emissions indicate the duration of the values of the source Publisher
rightEnd a function that returns a Publisher whose emissions indicate the duration of the values of the right Publisher
resultSelector a function that takes an item emitted by each Publisher and returns the value to be emitted by the resulting Publisher
Returns
  • a Flowable that emits items based on combining those items emitted by the source Publishers whose durations overlap

public final Flowable<T> hide ()

Hides the identity of this Flowable and its Subscription.

Allows hiding extra features such as Processor's Subscriber methods or preventing certain identity-based optimizations (fusion).

Backpressure:
The operator is a pass-through for backpressure, the behavior is determined by the upstream's backpressure behavior.
Scheduler:
hide does not operate by default on a particular Scheduler.

Returns
  • the new Flowable instance

public final Completable ignoreElements ()

Ignores all items emitted by the source Publisher and only calls onComplete or onError.

Backpressure:
This operator ignores backpressure as it doesn't emit any elements and consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it).
Scheduler:
ignoreElements does not operate by default on a particular Scheduler.

Returns
  • a Completable that only calls onComplete or onError, based on which one is called by the source Publisher

public static Flowable<Long> interval (long period, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits a sequential number every specified interval of time, on a specified Scheduler.

Backpressure:
The operator generates values based on time and ignores downstream backpressure which may lead to MissingBackpressureException at some point in the chain. Consumers should consider applying one of the onBackpressureXXX operators as well.
Scheduler:
You specify which Scheduler this operator will use

Parameters
period the period size in time units (see below)
unit time units to use for the interval size
scheduler the Scheduler to use for scheduling the items
Returns
  • a Flowable that emits a sequential number each time interval

public static Flowable<Long> interval (long period, TimeUnit unit)

Returns a Flowable that emits a sequential number every specified interval of time.

Backpressure:
The operator signals a MissingBackpressureException if the downstream is not ready to receive the next value.
Scheduler:
interval operates by default on the computation Scheduler.

Parameters
period the period size in time units (see below)
unit time units to use for the interval size
Returns
  • a Flowable that emits a sequential number each time interval

public static Flowable<Long> interval (long initialDelay, long period, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits a 0L after the initialDelay and ever increasing numbers after each period of time thereafter, on a specified Scheduler.

Backpressure:
The operator generates values based on time and ignores downstream backpressure which may lead to MissingBackpressureException at some point in the chain. Consumers should consider applying one of the onBackpressureXXX operators as well.
Scheduler:
You specify which Scheduler this operator will use

Parameters
initialDelay the initial delay time to wait before emitting the first value of 0L
period the period of time between emissions of the subsequent numbers
unit the time unit for both initialDelay and period
scheduler the Scheduler on which the waiting happens and items are emitted
Returns
  • a Flowable that emits a 0L after the initialDelay and ever increasing numbers after each period of time thereafter, while running on the given Scheduler

public static Flowable<Long> interval (long initialDelay, long period, TimeUnit unit)

Returns a Flowable that emits a 0L after the initialDelay and ever increasing numbers after each period of time thereafter.

Backpressure:
The operator generates values based on time and ignores downstream backpressure which may lead to MissingBackpressureException at some point in the chain. Consumers should consider applying one of the onBackpressureXXX operators as well.
Scheduler:
interval operates by default on the computation Scheduler.

Parameters
initialDelay the initial delay time to wait before emitting the first value of 0L
period the period of time between emissions of the subsequent numbers
unit the time unit for both initialDelay and period
Returns
  • a Flowable that emits a 0L after the initialDelay and ever increasing numbers after each period of time thereafter

public static Flowable<Long> intervalRange (long start, long count, long initialDelay, long period, TimeUnit unit, Scheduler scheduler)

Signals a range of long values, the first after some initial delay and the rest periodically after.

The sequence completes immediately after the last value (start + count - 1) has been reached.

Backpressure:
The operator signals a MissingBackpressureException if the downstream can't keep up.
Scheduler:
you provide the Scheduler.

Parameters
start that start value of the range
count the number of values to emit in total, if zero, the operator emits an onComplete after the initial delay.
initialDelay the initial delay before signalling the first value (the start)
period the period between subsequent values
unit the unit of measure of the initialDelay and period amounts
scheduler the target scheduler where the values and terminal signals will be emitted
Returns
  • the new Flowable instance

public static Flowable<Long> intervalRange (long start, long count, long initialDelay, long period, TimeUnit unit)

Signals a range of long values, the first after some initial delay and the rest periodically after.

The sequence completes immediately after the last value (start + count - 1) has been reached.

Backpressure:
The operator signals a MissingBackpressureException if the downstream can't keep up.
Scheduler:
intervalRange by default operates on the computation Scheduler.

Parameters
start that start value of the range
count the number of values to emit in total, if zero, the operator emits an onComplete after the initial delay.
initialDelay the initial delay before signalling the first value (the start)
period the period between subsequent values
unit the unit of measure of the initialDelay and period amounts
Returns
  • the new Flowable instance

public final Single<Boolean> isEmpty ()

Returns a Single that emits true if the source Publisher is empty, otherwise false.

In Rx.Net this is negated as the any Subscriber but we renamed this in RxJava to better match Java naming idioms.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure).
Scheduler:
isEmpty does not operate by default on a particular Scheduler.

Returns
  • a Flowable that emits a Boolean

public final Flowable<R> join (Publisher<? extends TRight> other, Function<? super T, ? extends Publisher<TLeftEnd>> leftEnd, Function<? super TRight, ? extends Publisher<TRightEnd>> rightEnd, BiFunction<? super T, ? super TRight, ? extends R> resultSelector)

Correlates the items emitted by two Publishers based on overlapping durations.

There are no guarantees in what order the items get combined when multiple items from one or both source Publishers overlap.

Backpressure:
The operator doesn't support backpressure and consumes all participating Publishers in an unbounded mode (i.e., not applying any backpressure to them).
Scheduler:
join does not operate by default on a particular Scheduler.

Parameters
other the second Publisher to join items from
leftEnd a function to select a duration for each item emitted by the source Publisher, used to determine overlap
rightEnd a function to select a duration for each item emitted by the right Publisher, used to determine overlap
resultSelector a function that computes an item to be emitted by the resulting Publisher for any two overlapping items emitted by the two Publishers
Returns
  • a Flowable that emits items correlating to items emitted by the source Publishers that have overlapping durations

public static Flowable<T> just (T item1, T item2, T item3, T item4, T item5, T item6)

Converts six items into a Publisher that emits those items.

Backpressure:
The operator honors backpressure from downstream and signals each value on-demand (i.e., when requested).
Scheduler:
just does not operate by default on a particular Scheduler.

Parameters
item1 first item
item2 second item
item3 third item
item4 fourth item
item5 fifth item
item6 sixth item
Returns
  • a Flowable that emits each item

public static Flowable<T> just (T item1, T item2)

Converts two items into a Publisher that emits those items.

Backpressure:
The operator honors backpressure from downstream and signals each value on-demand (i.e., when requested).
Scheduler:
just does not operate by default on a particular Scheduler.

Parameters
item1 first item
item2 second item
Returns
  • a Flowable that emits each item

public static Flowable<T> just (T item1, T item2, T item3, T item4)

Converts four items into a Publisher that emits those items.

Backpressure:
The operator honors backpressure from downstream and signals each value on-demand (i.e., when requested).
Scheduler:
just does not operate by default on a particular Scheduler.

Parameters
item1 first item
item2 second item
item3 third item
item4 fourth item
Returns
  • a Flowable that emits each item

public static Flowable<T> just (T item)

Returns a Flowable that emits a single item and then completes.

To convert any object into a Publisher that emits that object, pass that object into the just method.

This is similar to the fromArray(java.lang.Object[]) method, except that from will convert an Iterable object into a Publisher that emits each of the items in the Iterable, one at a time, while the just method converts an Iterable into a Publisher that emits the entire Iterable as a single item.

Backpressure:
The operator honors backpressure from downstream.
Scheduler:
just does not operate by default on a particular Scheduler.

Parameters
item the item to emit
Returns
  • a Flowable that emits value as a single item and then completes

public static Flowable<T> just (T item1, T item2, T item3, T item4, T item5)

Converts five items into a Publisher that emits those items.

Backpressure:
The operator honors backpressure from downstream and signals each value on-demand (i.e., when requested).
Scheduler:
just does not operate by default on a particular Scheduler.

Parameters
item1 first item
item2 second item
item3 third item
item4 fourth item
item5 fifth item
Returns
  • a Flowable that emits each item

public static Flowable<T> just (T item1, T item2, T item3, T item4, T item5, T item6, T item7)

Converts seven items into a Publisher that emits those items.

Backpressure:
The operator honors backpressure from downstream and signals each value on-demand (i.e., when requested).
Scheduler:
just does not operate by default on a particular Scheduler.

Parameters
item1 first item
item2 second item
item3 third item
item4 fourth item
item5 fifth item
item6 sixth item
item7 seventh item
Returns
  • a Flowable that emits each item

public static Flowable<T> just (T item1, T item2, T item3, T item4, T item5, T item6, T item7, T item8)

Converts eight items into a Publisher that emits those items.

Backpressure:
The operator honors backpressure from downstream and signals each value on-demand (i.e., when requested).
Scheduler:
just does not operate by default on a particular Scheduler.

Parameters
item1 first item
item2 second item
item3 third item
item4 fourth item
item5 fifth item
item6 sixth item
item7 seventh item
item8 eighth item
Returns
  • a Flowable that emits each item

public static Flowable<T> just (T item1, T item2, T item3, T item4, T item5, T item6, T item7, T item8, T item9)

Converts nine items into a Publisher that emits those items.

Backpressure:
The operator honors backpressure from downstream and signals each value on-demand (i.e., when requested).
Scheduler:
just does not operate by default on a particular Scheduler.

Parameters
item1 first item
item2 second item
item3 third item
item4 fourth item
item5 fifth item
item6 sixth item
item7 seventh item
item8 eighth item
item9 ninth item
Returns
  • a Flowable that emits each item

public static Flowable<T> just (T item1, T item2, T item3, T item4, T item5, T item6, T item7, T item8, T item9, T item10)

Converts ten items into a Publisher that emits those items.

Backpressure:
The operator honors backpressure from downstream and signals each value on-demand (i.e., when requested).
Scheduler:
just does not operate by default on a particular Scheduler.

Parameters
item1 first item
item2 second item
item3 third item
item4 fourth item
item5 fifth item
item6 sixth item
item7 seventh item
item8 eighth item
item9 ninth item
item10 tenth item
Returns
  • a Flowable that emits each item

public static Flowable<T> just (T item1, T item2, T item3)

Converts three items into a Publisher that emits those items.

Backpressure:
The operator honors backpressure from downstream and signals each value on-demand (i.e., when requested).
Scheduler:
just does not operate by default on a particular Scheduler.

Parameters
item1 first item
item2 second item
item3 third item
Returns
  • a Flowable that emits each item

public final Single<T> last (T defaultItem)

Returns a Single that emits only the last item emitted by this Flowable, or a default item if this Flowable completes without emitting any items.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure).
Scheduler:
last does not operate by default on a particular Scheduler.

Parameters
defaultItem the default item to emit if the source Publisher is empty
Returns
  • the new Single instance

public final Maybe<T> lastElement ()

Returns a Maybe that emits the last item emitted by this Flowable or completes if this Flowable is empty.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure).
Scheduler:
lastElement does not operate by default on a particular Scheduler.

Returns
  • a new Maybe instance

public final Single<T> lastOrError ()

Returns a Single that emits only the last item emitted by this Flowable or signals a NoSuchElementException if this Flowable is empty.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure).
Scheduler:
lastOrError does not operate by default on a particular Scheduler.

Returns
  • the new Single instance

public final Flowable<R> lift (FlowableOperator<? extends R, ? super T> lifter)

This method requires advanced knowledge about building operators; please consider other standard composition methods first; Lifts a function to the current Publisher and returns a new Publisher that when subscribed to will pass the values of the current Publisher through the Operator function.

In other words, this allows chaining Subscribers together on a Publisher for acting on the values within the Publisher.

Publisher.map(...).filter(...).take(5).lift(new OperatorA()).lift(new OperatorB(...)).subscribe()

If the operator you are creating is designed to act on the individual items emitted by a source Publisher, use lift. If your operator is designed to transform the source Publisher as a whole (for instance, by applying a particular set of existing RxJava operators to it) use compose(FlowableTransformer).

Backpressure:
The Operator instance provided is responsible to be backpressure-aware or document the fact that the consumer of the returned Publisher has to apply one of the onBackpressureXXX operators.
Scheduler:
lift does not operate by default on a particular Scheduler.

Parameters
lifter the Operator that implements the Publisher-operating function to be applied to the source Publisher
Returns
  • a Flowable that is the result of applying the lifted Operator to the source Publisher

public final Flowable<R> map (Function<? super T, ? extends R> mapper)

Returns a Flowable that applies a specified function to each item emitted by the source Publisher and emits the results of these function applications.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
map does not operate by default on a particular Scheduler.

Parameters
mapper a function to apply to each item emitted by the Publisher
Returns
  • a Flowable that emits the items from the source Publisher, transformed by the specified function

public final Flowable<Notification<T>> materialize ()

Returns a Flowable that represents all of the emissions and notifications from the source Publisher into emissions marked with their original types within Notification objects.

Backpressure:
The operator honors backpressure from downstream and expects it from the source Publisher. If this expectation is violated, the operator may throw an IllegalStateException.
Scheduler:
materialize does not operate by default on a particular Scheduler.

Returns
  • a Flowable that emits items that are the result of materializing the items and notifications of the source Publisher

public static Flowable<T> merge (Publisher<? extends Publisher<? extends T>> sources)

Flattens a Publisher that emits Publishers into a single Publisher that emits the items emitted by those Publishers, without any transformation.

You can combine the items emitted by multiple Publishers so that they appear as a single Publisher, by using the merge method.

Backpressure:
The operator honors backpressure from downstream. The outer Publisher is consumed in unbounded mode (i.e., no backpressure is applied to it). The inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
merge does not operate by default on a particular Scheduler.

Parameters
sources a Publisher that emits Publishers
Returns
  • a Flowable that emits items that are the result of flattening the Publishers emitted by the source Publisher

public static Flowable<T> merge (Publisher<? extends T> source1, Publisher<? extends T> source2, Publisher<? extends T> source3)

Flattens three Publishers into a single Publisher, without any transformation.

You can combine items emitted by multiple Publishers so that they appear as a single Publisher, by using the merge method.

Backpressure:
The operator honors backpressure from downstream. The source Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
merge does not operate by default on a particular Scheduler.

Parameters
source1 a Publisher to be merged
source2 a Publisher to be merged
source3 a Publisher to be merged
Returns
  • a Flowable that emits all of the items emitted by the source Publishers

public static Flowable<T> merge (Publisher<? extends Publisher<? extends T>> sources, int maxConcurrency)

Flattens a Publisher that emits Publishers into a single Publisher that emits the items emitted by those Publishers, without any transformation, while limiting the maximum number of concurrent subscriptions to these Publishers.

You can combine the items emitted by multiple Publishers so that they appear as a single Publisher, by using the merge method.

Backpressure:
The operator honors backpressure from downstream. Both the outer and inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
merge does not operate by default on a particular Scheduler.

Parameters
sources a Publisher that emits Publishers
maxConcurrency the maximum number of Publishers that may be subscribed to concurrently
Returns
  • a Flowable that emits items that are the result of flattening the Publishers emitted by the source Publisher
Throws
IllegalArgumentException if maxConcurrency is less than or equal to 0

public static Flowable<T> merge (Iterable<? extends Publisher<? extends T>> sources, int maxConcurrency)

Flattens an Iterable of Publishers into one Publisher, without any transformation, while limiting the number of concurrent subscriptions to these Publishers.

You can combine the items emitted by multiple Publishers so that they appear as a single Publisher, by using the merge method.

Backpressure:
The operator honors backpressure from downstream. The source Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
merge does not operate by default on a particular Scheduler.

Parameters
sources the Iterable of Publishers
maxConcurrency the maximum number of Publishers that may be subscribed to concurrently
Returns
  • a Flowable that emits items that are the result of flattening the items emitted by the Publishers in the Iterable
Throws
IllegalArgumentException if maxConcurrency is less than or equal to 0

public static Flowable<T> merge (Publisher<? extends T> source1, Publisher<? extends T> source2)

Flattens two Publishers into a single Publisher, without any transformation.

You can combine items emitted by multiple Publishers so that they appear as a single Publisher, by using the merge method.

Backpressure:
The operator honors backpressure from downstream. The source Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
merge does not operate by default on a particular Scheduler.

Parameters
source1 a Publisher to be merged
source2 a Publisher to be merged
Returns
  • a Flowable that emits all of the items emitted by the source Publishers

public static Flowable<T> merge (Iterable<? extends Publisher<? extends T>> sources)

Flattens an Iterable of Publishers into one Publisher, without any transformation.

You can combine the items emitted by multiple Publishers so that they appear as a single Publisher, by using the merge method.

Backpressure:
The operator honors backpressure from downstream. The source Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
merge does not operate by default on a particular Scheduler.

Parameters
sources the Iterable of Publishers
Returns
  • a Flowable that emits items that are the result of flattening the items emitted by the Publishers in the Iterable

public static Flowable<T> merge (Publisher<? extends T> source1, Publisher<? extends T> source2, Publisher<? extends T> source3, Publisher<? extends T> source4)

Flattens four Publishers into a single Publisher, without any transformation.

You can combine items emitted by multiple Publishers so that they appear as a single Publisher, by using the merge method.

Backpressure:
The operator honors backpressure from downstream. The source Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
merge does not operate by default on a particular Scheduler.

Parameters
source1 a Publisher to be merged
source2 a Publisher to be merged
source3 a Publisher to be merged
source4 a Publisher to be merged
Returns
  • a Flowable that emits all of the items emitted by the source Publishers

public static Flowable<T> merge (Iterable<? extends Publisher<? extends T>> sources, int maxConcurrency, int bufferSize)

Flattens an Iterable of Publishers into one Publisher, without any transformation, while limiting the number of concurrent subscriptions to these Publishers.

You can combine the items emitted by multiple Publishers so that they appear as a single Publisher, by using the merge method.

Backpressure:
The operator honors backpressure from downstream. The source Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
merge does not operate by default on a particular Scheduler.

Parameters
sources the Iterable of Publishers
maxConcurrency the maximum number of Publishers that may be subscribed to concurrently
bufferSize the number of items to prefetch from each inner Publisher
Returns
  • a Flowable that emits items that are the result of flattening the items emitted by the Publishers in the Iterable
Throws
IllegalArgumentException if maxConcurrency is less than or equal to 0

public static Flowable<T> mergeArray (Publisher...<? extends T> sources)

Flattens an Array of Publishers into one Publisher, without any transformation.

You can combine items emitted by multiple Publishers so that they appear as a single Publisher, by using the merge method.

Backpressure:
The operator honors backpressure from downstream. The source Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
mergeArray does not operate by default on a particular Scheduler.

Parameters
sources the array of Publishers
Returns
  • a Flowable that emits all of the items emitted by the Publishers in the Array

public static Flowable<T> mergeArray (int maxConcurrency, int bufferSize, Publisher...<? extends T> sources)

Flattens an Iterable of Publishers into one Publisher, without any transformation, while limiting the number of concurrent subscriptions to these Publishers.

You can combine the items emitted by multiple Publishers so that they appear as a single Publisher, by using the merge method.

Backpressure:
The operator honors backpressure from downstream. The source Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
mergeArray does not operate by default on a particular Scheduler.

Parameters
maxConcurrency the maximum number of Publishers that may be subscribed to concurrently
bufferSize the number of items to prefetch from each inner Publisher
sources the array of Publishers
Returns
  • a Flowable that emits items that are the result of flattening the items emitted by the Publishers in the Iterable
Throws
IllegalArgumentException if maxConcurrency is less than or equal to 0

public static Flowable<T> mergeArrayDelayError (int maxConcurrency, int bufferSize, Publisher...<? extends T> sources)

Flattens an array of Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from each of the source Publishers without being interrupted by an error notification from one of them, while limiting the number of concurrent subscriptions to these Publishers.

This behaves like merge(Publisher) except that if any of the merged Publishers notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Publishers have finished emitting items.

Even if multiple merged Publishers send onError notifications, mergeDelayError will only invoke the onError method of its Subscribers once.

Backpressure:
The operator honors backpressure from downstream. All source Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
mergeArrayDelayError does not operate by default on a particular Scheduler.

Parameters
maxConcurrency the maximum number of Publishers that may be subscribed to concurrently
bufferSize the number of items to prefetch from each inner Publisher
sources the array of Publishers
Returns
  • a Flowable that emits items that are the result of flattening the items emitted by the Publishers in the Iterable

public static Flowable<T> mergeArrayDelayError (Publisher...<? extends T> sources)

Flattens an array of Publishers into one Flowable, in a way that allows a Subscriber to receive all successfully emitted items from each of the source Publishers without being interrupted by an error notification from one of them.

This behaves like merge(Publisher) except that if any of the merged Publishers notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Publishers have finished emitting items.

Even if multiple merged Publishers send onError notifications, mergeDelayError will only invoke the onError method of its Subscribers once.

Backpressure:
The operator honors backpressure from downstream. Both the outer and inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
mergeArrayDelayError does not operate by default on a particular Scheduler.

Parameters
sources the Iterable of Publishers
Returns
  • a Flowable that emits items that are the result of flattening the items emitted by the Publishers in the Iterable

public static Flowable<T> mergeDelayError (Publisher<? extends T> source1, Publisher<? extends T> source2, Publisher<? extends T> source3)

Flattens three Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from all of the source Publishers without being interrupted by an error notification from one of them.

This behaves like merge(Publisher, Publisher, Publisher) except that if any of the merged Publishers notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Publishers have finished emitting items.

Even if multiple merged Publishers send onError notifications, mergeDelayError will only invoke the onError method of its Subscribers once.

Backpressure:
The operator honors backpressure from downstream. The source Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
mergeDelayError does not operate by default on a particular Scheduler.

Parameters
source1 a Publisher to be merged
source2 a Publisher to be merged
source3 a Publisher to be merged
Returns
  • a Flowable that emits all of the items that are emitted by the source Publishers

public static Flowable<T> mergeDelayError (Publisher<? extends Publisher<? extends T>> sources, int maxConcurrency)

Flattens a Publisher that emits Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from all of the source Publishers without being interrupted by an error notification from one of them, while limiting the number of concurrent subscriptions to these Publishers.

This behaves like merge(Publisher) except that if any of the merged Publishers notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Publishers have finished emitting items.

Even if multiple merged Publishers send onError notifications, mergeDelayError will only invoke the onError method of its Subscribers once.

Backpressure:
The operator honors backpressure from downstream. Both the outer and inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
mergeDelayError does not operate by default on a particular Scheduler.

Parameters
sources a Publisher that emits Publishers
maxConcurrency the maximum number of Publishers that may be subscribed to concurrently
Returns
  • a Flowable that emits all of the items emitted by the Publishers emitted by the source Publisher

public static Flowable<T> mergeDelayError (Publisher<? extends Publisher<? extends T>> sources)

Flattens a Publisher that emits Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from all of the source Publishers without being interrupted by an error notification from one of them.

This behaves like merge(Publisher) except that if any of the merged Publishers notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Publishers have finished emitting items.

Even if multiple merged Publishers send onError notifications, mergeDelayError will only invoke the onError method of its Subscribers once.

Backpressure:
The operator honors backpressure from downstream. The outer Publisher is consumed in unbounded mode (i.e., no backpressure is applied to it). The inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
mergeDelayError does not operate by default on a particular Scheduler.

Parameters
sources a Publisher that emits Publishers
Returns
  • a Flowable that emits all of the items emitted by the Publishers emitted by the source Publisher

public static Flowable<T> mergeDelayError (Iterable<? extends Publisher<? extends T>> sources, int maxConcurrency, int bufferSize)

Flattens an Iterable of Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from each of the source Publishers without being interrupted by an error notification from one of them, while limiting the number of concurrent subscriptions to these Publishers.

This behaves like merge(Publisher) except that if any of the merged Publishers notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Publishers have finished emitting items.

Even if multiple merged Publishers send onError notifications, mergeDelayError will only invoke the onError method of its Subscribers once.

Backpressure:
The operator honors backpressure from downstream. All inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
mergeDelayError does not operate by default on a particular Scheduler.

Parameters
sources the Iterable of Publishers
maxConcurrency the maximum number of Publishers that may be subscribed to concurrently
bufferSize the number of items to prefetch from each inner Publisher
Returns
  • a Flowable that emits items that are the result of flattening the items emitted by the Publishers in the Iterable

public static Flowable<T> mergeDelayError (Publisher<? extends T> source1, Publisher<? extends T> source2)

Flattens two Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from each of the source Publishers without being interrupted by an error notification from one of them.

This behaves like merge(Publisher, Publisher) except that if any of the merged Publishers notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Publishers have finished emitting items.

Even if both merged Publishers send onError notifications, mergeDelayError will only invoke the onError method of its Subscribers once.

Backpressure:
The operator honors backpressure from downstream. The source Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
mergeDelayError does not operate by default on a particular Scheduler.

Parameters
source1 a Publisher to be merged
source2 a Publisher to be merged
Returns
  • a Flowable that emits all of the items that are emitted by the two source Publishers

public static Flowable<T> mergeDelayError (Iterable<? extends Publisher<? extends T>> sources, int maxConcurrency)

Flattens an Iterable of Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from each of the source Publishers without being interrupted by an error notification from one of them, while limiting the number of concurrent subscriptions to these Publishers.

This behaves like merge(Publisher) except that if any of the merged Publishers notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Publishers have finished emitting items.

Even if multiple merged Publishers send onError notifications, mergeDelayError will only invoke the onError method of its Subscribers once.

Backpressure:
The operator honors backpressure from downstream. All inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
mergeDelayError does not operate by default on a particular Scheduler.

Parameters
sources the Iterable of Publishers
maxConcurrency the maximum number of Publishers that may be subscribed to concurrently
Returns
  • a Flowable that emits items that are the result of flattening the items emitted by the Publishers in the Iterable

public static Flowable<T> mergeDelayError (Iterable<? extends Publisher<? extends T>> sources)

Flattens an Iterable of Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from each of the source Publishers without being interrupted by an error notification from one of them.

This behaves like merge(Publisher) except that if any of the merged Publishers notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Publishers have finished emitting items.

Even if multiple merged Publishers send onError notifications, mergeDelayError will only invoke the onError method of its Subscribers once.

Backpressure:
The operator honors backpressure from downstream. All inner Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
mergeDelayError does not operate by default on a particular Scheduler.

Parameters
sources the Iterable of Publishers
Returns
  • a Flowable that emits items that are the result of flattening the items emitted by the Publishers in the Iterable

public static Flowable<T> mergeDelayError (Publisher<? extends T> source1, Publisher<? extends T> source2, Publisher<? extends T> source3, Publisher<? extends T> source4)

Flattens four Publishers into one Publisher, in a way that allows a Subscriber to receive all successfully emitted items from all of the source Publishers without being interrupted by an error notification from one of them.

This behaves like merge(Publisher, Publisher, Publisher, Publisher) except that if any of the merged Publishers notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Publishers have finished emitting items.

Even if multiple merged Publishers send onError notifications, mergeDelayError will only invoke the onError method of its Subscribers once.

Backpressure:
The operator honors backpressure from downstream. The source Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
mergeDelayError does not operate by default on a particular Scheduler.

Parameters
source1 a Publisher to be merged
source2 a Publisher to be merged
source3 a Publisher to be merged
source4 a Publisher to be merged
Returns
  • a Flowable that emits all of the items that are emitted by the source Publishers

public final Flowable<T> mergeWith (Publisher<? extends T> other)

Flattens this and another Publisher into a single Publisher, without any transformation.

You can combine items emitted by multiple Publishers so that they appear as a single Publisher, by using the mergeWith method.

Backpressure:
The operator honors backpressure from downstream. This and the other Publishers are expected to honor backpressure; if violated, the operator may signal MissingBackpressureException.
Scheduler:
mergeWith does not operate by default on a particular Scheduler.

Parameters
other a Publisher to be merged
Returns
  • a Flowable that emits all of the items emitted by the source Publishers

public static Flowable<T> never ()

Returns a Flowable that never sends any items or notifications to a Subscriber.

This Publisher is useful primarily for testing purposes.

Backpressure:
This source doesn't produce any elements and effectively ignores downstream backpressure.
Scheduler:
never does not operate by default on a particular Scheduler.

Returns
  • a Flowable that never emits any items or sends any notifications to a Subscriber

public final Flowable<T> observeOn (Scheduler scheduler, boolean delayError)

Modifies a Publisher to perform its emissions and notifications on a specified Scheduler, asynchronously with a bounded buffer and optionally delays onError notifications.

Backpressure:
This operator honors backpressure from downstream and expects it from the source Publisher. Violating this expectation will lead to MissingBackpressureException. This is the most common operator where the exception pops up; look for sources up the chain that don't support backpressure, such as interval, timer, {code PublishSubject} or BehaviorSubject and apply any of the onBackpressureXXX operators before applying observeOn itself.
Scheduler:
You specify which Scheduler this operator will use

Parameters
scheduler the Scheduler to notify Subscribers on
delayError indicates if the onError notification may not cut ahead of onNext notification on the other side of the scheduling boundary. If true a sequence ending in onError will be replayed in the same order as was received from upstream
Returns
  • the source Publisher modified so that its Subscribers are notified on the specified Scheduler

public final Flowable<T> observeOn (Scheduler scheduler)

Modifies a Publisher to perform its emissions and notifications on a specified Scheduler, asynchronously with a bounded buffer of bufferSize() slots.

Note that onError notifications will cut ahead of onNext notifications on the emission thread if Scheduler is truly asynchronous. If strict event ordering is required, consider using the observeOn(Scheduler, boolean) overload.

Backpressure:
This operator honors backpressure from downstream and expects it from the source Publisher. Violating this expectation will lead to MissingBackpressureException. This is the most common operator where the exception pops up; look for sources up the chain that don't support backpressure, such as interval, timer, {code PublishSubject} or BehaviorSubject and apply any of the onBackpressureXXX operators before applying observeOn itself.
Scheduler:
You specify which Scheduler this operator will use

Parameters
scheduler the Scheduler to notify Subscribers on
Returns
  • the source Publisher modified so that its Subscribers are notified on the specified Scheduler

public final Flowable<T> observeOn (Scheduler scheduler, boolean delayError, int bufferSize)

Modifies a Publisher to perform its emissions and notifications on a specified Scheduler, asynchronously with a bounded buffer of configurable size and optionally delays onError notifications.

Backpressure:
This operator honors backpressure from downstream and expects it from the source Publisher. Violating this expectation will lead to MissingBackpressureException. This is the most common operator where the exception pops up; look for sources up the chain that don't support backpressure, such as interval, timer, {code PublishSubject} or BehaviorSubject and apply any of the onBackpressureXXX operators before applying observeOn itself.
Scheduler:
You specify which Scheduler this operator will use

Parameters
scheduler the Scheduler to notify Subscribers on
delayError indicates if the onError notification may not cut ahead of onNext notification on the other side of the scheduling boundary. If true a sequence ending in onError will be replayed in the same order as was received from upstream
bufferSize the size of the buffer.
Returns
  • the source Publisher modified so that its Subscribers are notified on the specified Scheduler

public final Flowable<U> ofType (Class<U> clazz)

Filters the items emitted by a Publisher, only emitting those of the specified type.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
ofType does not operate by default on a particular Scheduler.

Parameters
clazz the class type to filter the items emitted by the source Publisher
Returns
  • a Flowable that emits items from the source Publisher of type clazz

public final Flowable<T> onBackpressureBuffer (int capacity, boolean delayError, boolean unbounded)

Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to a given amount of items until they can be emitted. The resulting Publisher will onError emitting a BufferOverflowException as soon as the buffer's capacity is exceeded, dropping all undelivered items, and cancelling the source.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., not applying backpressure to it).
Scheduler:
onBackpressureBuffer does not operate by default on a particular Scheduler.

Parameters
capacity number of slots available in the buffer.
delayError if true, an exception from the current Flowable is delayed until all buffered elements have been consumed by the downstream; if false, an exception is immediately signalled to the downstream, skipping any buffered element
unbounded if true, the capacity value is interpreted as the internal "island" size of the unbounded buffer
Returns
  • the source Publisher modified to buffer items up to the given capacity.

public final Flowable<T> onBackpressureBuffer (int capacity)

Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to a given amount of items until they can be emitted. The resulting Publisher will onError emitting a BufferOverflowException as soon as the buffer's capacity is exceeded, dropping all undelivered items, and cancelling the source.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., not applying backpressure to it).
Scheduler:
onBackpressureBuffer does not operate by default on a particular Scheduler.

Parameters
capacity number of slots available in the buffer.
Returns
  • the source Publisher modified to buffer items up to the given capacity.

public final Flowable<T> onBackpressureBuffer (long capacity, Action onOverflow, BackpressureOverflowStrategy overflowStrategy)

Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to a given amount of items until they can be emitted. The resulting Publisher will behave as determined by overflowStrategy if the buffer capacity is exceeded.

  • BackpressureOverflow.Strategy.ON_OVERFLOW_ERROR (default) will onError dropping all undelivered items, cancelling the source, and notifying the producer with onOverflow.
  • BackpressureOverflow.Strategy.ON_OVERFLOW_DROP_LATEST will drop any new items emitted by the producer while the buffer is full, without generating any onError. Each drop will however invoke onOverflow to signal the overflow to the producer.
  • j
  • BackpressureOverflow.Strategy.ON_OVERFLOW_DROP_OLDEST will drop the oldest items in the buffer in order to make room for newly emitted ones. Overflow will not generate anonError, but each drop will invoke onOverflow to signal the overflow to the producer.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., not applying backpressure to it).
Scheduler:
onBackpressureBuffer does not operate by default on a particular Scheduler.

Parameters
capacity number of slots available in the buffer.
onOverflow action to execute if an item needs to be buffered, but there are no available slots. Null is allowed.
overflowStrategy how should the Publisher react to buffer overflows. Null is not allowed.
Returns
  • the source Flowable modified to buffer items up to the given capacity

public final Flowable<T> onBackpressureBuffer (boolean delayError)

Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer these items indefinitely until they can be emitted.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., not applying backpressure to it).
Scheduler:
onBackpressureBuffer does not operate by default on a particular Scheduler.

Parameters
delayError if true, an exception from the current Flowable is delayed until all buffered elements have been consumed by the downstream; if false, an exception is immediately signalled to the downstream, skipping any buffered element
Returns
  • the source Publisher modified to buffer items to the extent system resources allow

public final Flowable<T> onBackpressureBuffer (int capacity, boolean delayError, boolean unbounded, Action onOverflow)

Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to a given amount of items until they can be emitted. The resulting Publisher will onError emitting a BufferOverflowException as soon as the buffer's capacity is exceeded, dropping all undelivered items, cancelling the source, and notifying the producer with onOverflow.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., not applying backpressure to it).
Scheduler:
onBackpressureBuffer does not operate by default on a particular Scheduler.

Parameters
capacity number of slots available in the buffer.
delayError if true, an exception from the current Flowable is delayed until all buffered elements have been consumed by the downstream; if false, an exception is immediately signalled to the downstream, skipping any buffered element
unbounded if true, the capacity value is interpreted as the internal "island" size of the unbounded buffer
onOverflow action to execute if an item needs to be buffered, but there are no available slots. Null is allowed.
Returns
  • the source Publisher modified to buffer items up to the given capacity

public final Flowable<T> onBackpressureBuffer (int capacity, Action onOverflow)

Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to a given amount of items until they can be emitted. The resulting Publisher will onError emitting a BufferOverflowException as soon as the buffer's capacity is exceeded, dropping all undelivered items, cancelling the source, and notifying the producer with onOverflow.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., not applying backpressure to it).
Scheduler:
onBackpressureBuffer does not operate by default on a particular Scheduler.

Parameters
capacity number of slots available in the buffer.
onOverflow action to execute if an item needs to be buffered, but there are no available slots. Null is allowed.
Returns
  • the source Publisher modified to buffer items up to the given capacity

public final Flowable<T> onBackpressureBuffer (int capacity, boolean delayError)

Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to a given amount of items until they can be emitted. The resulting Publisher will onError emitting a BufferOverflowException as soon as the buffer's capacity is exceeded, dropping all undelivered items, and cancelling the source.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., not applying backpressure to it).
Scheduler:
onBackpressureBuffer does not operate by default on a particular Scheduler.

Parameters
capacity number of slots available in the buffer.
delayError if true, an exception from the current Flowable is delayed until all buffered elements have been consumed by the downstream; if false, an exception is immediately signalled to the downstream, skipping any buffered element
Returns
  • the source Publisher modified to buffer items up to the given capacity.

public final Flowable<T> onBackpressureBuffer ()

Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer these items indefinitely until they can be emitted.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., not applying backpressure to it).
Scheduler:
onBackpressureBuffer does not operate by default on a particular Scheduler.

Returns
  • the source Publisher modified to buffer items to the extent system resources allow

public final Flowable<T> onBackpressureDrop ()

Instructs a Publisher that is emitting items faster than its Subscriber can consume them to discard, rather than emit, those items that its Subscriber is not prepared to observe.

If the downstream request count hits 0 then the Publisher will refrain from calling onNext until the Subscriber invokes request(n) again to increase the request count.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., not applying backpressure to it).
Scheduler:
onBackpressureDrop does not operate by default on a particular Scheduler.

Returns
  • the source Publisher modified to drop onNext notifications on overflow

public final Flowable<T> onBackpressureDrop (Consumer<? super T> onDrop)

Instructs a Publisher that is emitting items faster than its Subscriber can consume them to discard, rather than emit, those items that its Subscriber is not prepared to observe.

If the downstream request count hits 0 then the Publisher will refrain from calling onNext until the Subscriber invokes request(n) again to increase the request count.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., not applying backpressure to it).
Scheduler:
onBackpressureDrop does not operate by default on a particular Scheduler.

Parameters
onDrop the action to invoke for each item dropped. onDrop action should be fast and should never block.
Returns
  • the source Publisher modified to drop onNext notifications on overflow

public final Flowable<T> onBackpressureLatest ()

Instructs a Publisher that is emitting items faster than its Subscriber can consume them to hold onto the latest value and emit that on request.

Its behavior is logically equivalent to blockingLatest() with the exception that the downstream is not blocking while requesting more values.

Note that if the upstream Publisher does support backpressure, this operator ignores that capability and doesn't propagate any backpressure requests from downstream.

Note that due to the nature of how backpressure requests are propagated through subscribeOn/observeOn, requesting more than 1 from downstream doesn't guarantee a continuous delivery of onNext events.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., not applying backpressure to it).
Scheduler:
onBackpressureLatest does not operate by default on a particular Scheduler.

Returns
  • the source Publisher modified so that it emits the most recently-received item upon request

public final Flowable<T> onErrorResumeNext (Publisher<? extends T> next)

Instructs a Publisher to pass control to another Publisher rather than invoking onError if it encounters an error.

By default, when a Publisher encounters an error that prevents it from emitting the expected item to its Subscriber, the Publisher invokes its Subscriber's onError method, and then quits without invoking any more of its Subscriber's methods. The onErrorResumeNext method changes this behavior. If you pass another Publisher (resumeSequence) to a Publisher's onErrorResumeNext method, if the original Publisher encounters an error, instead of invoking its Subscriber's onError method, it will instead relinquish control to resumeSequence which will invoke the Subscriber's onNext method if it is able to do so. In such a case, because no Publisher necessarily invokes onError, the Subscriber may never know that an error happened.

You can use this to prevent errors from propagating or to supply fallback data should errors be encountered.

Backpressure:
The operator honors backpressure from downstream. This and the resuming Publishers are expected to honor backpressure as well. If any of them violate this expectation, the operator may throw an IllegalStateException when the source Publisher completes or MissingBackpressureException is signalled somewhere downstream.
Scheduler:
onErrorResumeNext does not operate by default on a particular Scheduler.

Parameters
next the next Publisher source that will take over if the source Publisher encounters an error
Returns
  • the original Publisher, with appropriately modified behavior

public final Flowable<T> onErrorResumeNext (Function<? super Throwable, ? extends Publisher<? extends T>> resumeFunction)

Instructs a Publisher to pass control to another Publisher rather than invoking onError if it encounters an error.

By default, when a Publisher encounters an error that prevents it from emitting the expected item to its Subscriber, the Publisher invokes its Subscriber's onError method, and then quits without invoking any more of its Subscriber's methods. The onErrorResumeNext method changes this behavior. If you pass a function that returns a Publisher (resumeFunction) to onErrorResumeNext, if the original Publisher encounters an error, instead of invoking its Subscriber's onError method, it will instead relinquish control to the Publisher returned from resumeFunction, which will invoke the Subscriber's onNext method if it is able to do so. In such a case, because no Publisher necessarily invokes onError, the Subscriber may never know that an error happened.

You can use this to prevent errors from propagating or to supply fallback data should errors be encountered.

Backpressure:
The operator honors backpressure from downstream. This and the resuming Publishers are expected to honor backpressure as well. If any of them violate this expectation, the operator may throw an IllegalStateException when the source Publisher completes or a MissingBackpressureException is signalled somewhere downstream.
Scheduler:
onErrorResumeNext does not operate by default on a particular Scheduler.

Parameters
resumeFunction a function that returns a Publisher that will take over if the source Publisher encounters an error
Returns
  • the original Publisher, with appropriately modified behavior

public final Flowable<T> onErrorReturn (Function<? super Throwable, ? extends T> valueSupplier)

Instructs a Publisher to emit an item (returned by a specified function) rather than invoking onError if it encounters an error.

By default, when a Publisher encounters an error that prevents it from emitting the expected item to its Subscriber, the Publisher invokes its Subscriber's onError method, and then quits without invoking any more of its Subscriber's methods. The onErrorReturn method changes this behavior. If you pass a function (resumeFunction) to a Publisher's onErrorReturn method, if the original Publisher encounters an error, instead of invoking its Subscriber's onError method, it will instead emit the return value of resumeFunction.

You can use this to prevent errors from propagating or to supply fallback data should errors be encountered.

Backpressure:
The operator honors backpressure from downstream. The source Publishers is expected to honor backpressure as well. If it this expectation is violated, the operator may throw IllegalStateException when the source Publisher completes or MissingBackpressureException is signalled somewhere downstream.
Scheduler:
onErrorReturn does not operate by default on a particular Scheduler.

Parameters
valueSupplier a function that returns a single value that will be emitted along with a regular onComplete in case the current Flowable signals an onError event
Returns
  • the original Publisher with appropriately modified behavior

public final Flowable<T> onErrorReturnItem (T item)

Instructs a Publisher to emit an item (returned by a specified function) rather than invoking onError if it encounters an error.

By default, when a Publisher encounters an error that prevents it from emitting the expected item to its Subscriber, the Publisher invokes its Subscriber's onError method, and then quits without invoking any more of its Subscriber's methods. The onErrorReturn method changes this behavior. If you pass a function (resumeFunction) to a Publisher's onErrorReturn method, if the original Publisher encounters an error, instead of invoking its Subscriber's onError method, it will instead emit the return value of resumeFunction.

You can use this to prevent errors from propagating or to supply fallback data should errors be encountered.

Backpressure:
The operator honors backpressure from downstream. The source Publishers is expected to honor backpressure as well. If it this expectation is violated, the operator may throw IllegalStateException when the source Publisher completes or MissingBackpressureException is signalled somewhere downstream.
Scheduler:
onErrorReturnItem does not operate by default on a particular Scheduler.

Parameters
item the value that is emitted along with a regular onComplete in case the current Flowable signals an exception
Returns
  • the original Publisher with appropriately modified behavior

public final Flowable<T> onExceptionResumeNext (Publisher<? extends T> next)

Instructs a Publisher to pass control to another Publisher rather than invoking onError if it encounters an Exception.

This differs from onErrorResumeNext(Function>) in that this one does not handle Throwable or java.lang.Error but lets those continue through.

By default, when a Publisher encounters an exception that prevents it from emitting the expected item to its Subscriber, the Publisher invokes its Subscriber's onError method, and then quits without invoking any more of its Subscriber's methods. The onExceptionResumeNext method changes this behavior. If you pass another Publisher (resumeSequence) to a Publisher's onExceptionResumeNext method, if the original Publisher encounters an exception, instead of invoking its Subscriber's onError method, it will instead relinquish control to resumeSequence which will invoke the Subscriber's onNext method if it is able to do so. In such a case, because no Publisher necessarily invokes onError, the Subscriber may never know that an exception happened.

You can use this to prevent exceptions from propagating or to supply fallback data should exceptions be encountered.

Backpressure:
The operator honors backpressure from downstream. This and the resuming Publishers are expected to honor backpressure as well. If any of them violate this expectation, the operator may throw an IllegalStateException when the source Publisher completes or MissingBackpressureException is signalled somewhere downstream.
Scheduler:
onExceptionResumeNext does not operate by default on a particular Scheduler.

Parameters
next the next Publisher that will take over if the source Publisher encounters an exception
Returns
  • the original Publisher, with appropriately modified behavior

public final Flowable<T> onTerminateDetach ()

Nulls out references to the upstream producer and downstream Subscriber if the sequence is terminated or downstream cancels.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
onTerminateDetach does not operate by default on a particular Scheduler.

Returns
  • a Flowable which out references to the upstream producer and downstream Subscriber if the sequence is terminated or downstream cancels

public final ParallelFlowable<T> parallel ()

Parallelizes the flow by creating multiple 'rails' (equal to the number of CPUs) and dispatches the upstream items to them in a round-robin fashion.

Note that the rails don't execute in parallel on their own and one needs to apply runOn(Scheduler) to specify the Scheduler where each rail will execute.

To merge the parallel 'rails' back into a single sequence, use sequential().

Backpressure:
The operator requires the upstream to honor backpressure and each 'rail' honors backpressure as well.
Scheduler:
parallel does not operate by default on a particular Scheduler.

History: 2.0.5 - experimental

Returns
  • the new ParallelFlowable instance

public final ParallelFlowable<T> parallel (int parallelism, int prefetch)

Parallelizes the flow by creating the specified number of 'rails' and dispatches the upstream items to them in a round-robin fashion and uses the defined per-'rail' prefetch amount.

Note that the rails don't execute in parallel on their own and one needs to apply runOn(Scheduler) to specify the Scheduler where each rail will execute.

To merge the parallel 'rails' back into a single sequence, use sequential().

Backpressure:
The operator requires the upstream to honor backpressure and each 'rail' honors backpressure as well.
Scheduler:
parallel does not operate by default on a particular Scheduler.

History: 2.0.5 - experimental

Parameters
parallelism the number of 'rails' to use
prefetch the number of items each 'rail' should prefetch
Returns
  • the new ParallelFlowable instance

public final ParallelFlowable<T> parallel (int parallelism)

Parallelizes the flow by creating the specified number of 'rails' and dispatches the upstream items to them in a round-robin fashion.

Note that the rails don't execute in parallel on their own and one needs to apply runOn(Scheduler) to specify the Scheduler where each rail will execute.

To merge the parallel 'rails' back into a single sequence, use sequential().

Backpressure:
The operator requires the upstream to honor backpressure and each 'rail' honors backpressure as well.
Scheduler:
parallel does not operate by default on a particular Scheduler.

History: 2.0.5 - experimental

Parameters
parallelism the number of 'rails' to use
Returns
  • the new ParallelFlowable instance

public final ConnectableFlowable<T> publish ()

Returns a ConnectableFlowable, which is a variety of Publisher that waits until its connect method is called before it begins emitting items to those Subscribers that have subscribed to it.

Backpressure:
The returned ConnectableFlowable honors backpressure for each of its Subscribers and expects the source Publisher to honor backpressure as well. If this expectation is violated, the operator will signal a MissingBackpressureException to its Subscribers and disconnect.
Scheduler:
publish does not operate by default on a particular Scheduler.

Returns
  • a ConnectableFlowable that upon connection causes the source Publisher to emit items to its Subscribers

public final Flowable<R> publish (Function<? super Flowable<T>, ? extends Publisher<? extends R>> selector, int prefetch)

Returns a Flowable that emits the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the underlying sequence.

Backpressure:
The operator expects the source Publisher to honor backpressure and if this expectation is violated, the operator will signal a MissingBackpressureException through the Publisher provided to the function. Since the Publisher returned by the selector may be independent from the provided Publisher to the function, the output's backpressure behavior is determined by this returned Publisher.
Scheduler:
publish does not operate by default on a particular Scheduler.

Parameters
selector a function that can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription forward.
prefetch the number of elements to prefetch from the current Flowable
Returns
  • a Flowable that emits the results of invoking the selector on the items emitted by a ConnectableFlowable that shares a single subscription to the underlying sequence

public final ConnectableFlowable<T> publish (int bufferSize)

Returns a ConnectableFlowable, which is a variety of Publisher that waits until its connect method is called before it begins emitting items to those Subscribers that have subscribed to it.

Backpressure:
The returned ConnectableFlowable honors backpressure for each of its Subscribers and expects the source Publisher to honor backpressure as well. If this expectation is violated, the operator will signal a MissingBackpressureException to its Subscribers and disconnect.
Scheduler:
publish does not operate by default on a particular Scheduler.

Parameters
bufferSize the number of elements to prefetch from the current Flowable
Returns
  • a ConnectableFlowable that upon connection causes the source Publisher to emit items to its Subscribers

public final Flowable<R> publish (Function<? super Flowable<T>, ? extends Publisher<R>> selector)

Returns a Flowable that emits the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the underlying sequence.

Backpressure:
The operator expects the source Publisher to honor backpressure and if this expectation is violated, the operator will signal a MissingBackpressureException through the Publisher provided to the function. Since the Publisher returned by the selector may be independent from the provided Publisher to the function, the output's backpressure behavior is determined by this returned Publisher.
Scheduler:
publish does not operate by default on a particular Scheduler.

Parameters
selector a function that can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription forward.
Returns
  • a Flowable that emits the results of invoking the selector on the items emitted by a ConnectableFlowable that shares a single subscription to the underlying sequence

public static Flowable<Integer> range (int start, int count)

Returns a Flowable that emits a sequence of Integers within a specified range.

Backpressure:
The operator honors backpressure from downstream and signals values on-demand (i.e., when requested).
Scheduler:
range does not operate by default on a particular Scheduler.

Parameters
start the value of the first Integer in the sequence
count the number of sequential Integers to generate
Returns
  • a Flowable that emits a range of sequential Integers
Throws
IllegalArgumentException if count is less than zero, or if start + count − 1 exceeds Integer.MAX_VALUE

public static Flowable<Long> rangeLong (long start, long count)

Returns a Flowable that emits a sequence of Longs within a specified range.

Backpressure:
The operator honors backpressure from downstream and signals values on-demand (i.e., when requested).
Scheduler:
rangeLong does not operate by default on a particular Scheduler.

Parameters
start the value of the first Long in the sequence
count the number of sequential Longs to generate
Returns
  • a Flowable that emits a range of sequential Longs
Throws
IllegalArgumentException if count is less than zero, or if start + count − 1 exceeds Long.MAX_VALUE

public final Flowable<T> rebatchRequests (int n)

Requests n initially from the upstream and then 75% of n subsequently after 75% of n values have been emitted to the downstream.

This operator allows preventing the downstream to trigger unbounded mode via request(Long.MAX_VALUE) or compensate for the per-item overhead of small and frequent requests.

Backpressure:
The operator expects backpressure from upstream and honors backpressure from downstream.
Scheduler:
rebatchRequests does not operate by default on a particular Scheduler.

Parameters
n the initial request amount, further request will happen after 75% of this value
Returns
  • the Publisher that rebatches request amounts from downstream

public final Maybe<T> reduce (BiFunction<T, T, T> reducer)

Returns a Maybe that applies a specified accumulator function to the first item emitted by a source Publisher, then feeds the result of that function along with the second item emitted by the source Publisher into the same function, and so on until all items have been emitted by the source Publisher, and emits the final result from the final call to your function as its sole item.

If the source is empty, a NoSuchElementException is signalled.

This technique, which is called "reduce" here, is sometimes called "aggregate," "fold," "accumulate," "compress," or "inject" in other programming contexts. Groovy, for instance, has an inject method that does a similar operation on lists.

Backpressure:
The operator honors backpressure of its downstream consumer and consumes the upstream source in unbounded mode.
Scheduler:
reduce does not operate by default on a particular Scheduler.

Parameters
reducer an accumulator function to be invoked on each item emitted by the source Publisher, whose result will be used in the next accumulator call
Returns
  • a Maybe that emits a single item that is the result of accumulating the items emitted by the source Flowable

public final Single<R> reduce (R seed, BiFunction<R, ? super T, R> reducer)

Returns a Single that applies a specified accumulator function to the first item emitted by a source Publisher and a specified seed value, then feeds the result of that function along with the second item emitted by a Publisher into the same function, and so on until all items have been emitted by the source Publisher, emitting the final result from the final call to your function as its sole item.

This technique, which is called "reduce" here, is sometimes called "aggregate," "fold," "accumulate," "compress," or "inject" in other programming contexts. Groovy, for instance, has an inject method that does a similar operation on lists.

Note that the seed is shared among all subscribers to the resulting Publisher and may cause problems if it is mutable. To make sure each subscriber gets its own value, defer the application of this operator via defer(Callable):


 Publisher<T> source = ...
 Single.defer(() -> source.reduce(new ArrayList<>(), (list, item) -> list.add(item)));

 // alternatively, by using compose to stay fluent

 source.compose(o ->
     Flowable.defer(() -> o.reduce(new ArrayList<>(), (list, item) -> list.add(item)).toFlowable())
 ).firstOrError();

 // or, by using reduceWith instead of reduce

 source.reduceWith(() -> new ArrayList<>(), (list, item) -> list.add(item)));
 
Backpressure:
The operator honors backpressure of its downstream consumer and consumes the upstream source in unbounded mode.
Scheduler:
reduce does not operate by default on a particular Scheduler.

Parameters
seed the initial (seed) accumulator value
reducer an accumulator function to be invoked on each item emitted by the source Publisher, the result of which will be used in the next accumulator call
Returns
  • a Single that emits a single item that is the result of accumulating the output from the items emitted by the source Publisher

public final Single<R> reduceWith (Callable<R> seedSupplier, BiFunction<R, ? super T, R> reducer)

Returns a Single that applies a specified accumulator function to the first item emitted by a source Publisher and a seed value derived from calling a specified seedSupplier, then feeds the result of that function along with the second item emitted by a Publisher into the same function, and so on until all items have been emitted by the source Publisher, emitting the final result from the final call to your function as its sole item.

This technique, which is called "reduce" here, is sometimes called "aggregate," "fold," "accumulate," "compress," or "inject" in other programming contexts. Groovy, for instance, has an inject method that does a similar operation on lists.

Backpressure:
The operator honors backpressure of its downstream consumer and consumes the upstream source in unbounded mode.
Scheduler:
reduceWith does not operate by default on a particular Scheduler.

Parameters
seedSupplier the Callable that provides the initial (seed) accumulator value for each individual Subscriber
reducer an accumulator function to be invoked on each item emitted by the source Publisher, the result of which will be used in the next accumulator call
Returns
  • a Single that emits a single item that is the result of accumulating the output from the items emitted by the source Publisher

public final Flowable<T> repeat ()

Returns a Flowable that repeats the sequence of items emitted by the source Publisher indefinitely.

Backpressure:
The operator honors downstream backpressure and expects the source Publisher to honor backpressure as well. If this expectation is violated, the operator may throw an IllegalStateException.
Scheduler:
repeat does not operate by default on a particular Scheduler.

Returns
  • a Flowable that emits the items emitted by the source Publisher repeatedly and in sequence

public final Flowable<T> repeat (long times)

Returns a Flowable that repeats the sequence of items emitted by the source Publisher at most count times.

Backpressure:
The operator honors downstream backpressure and expects the source Publisher to honor backpressure as well. If this expectation is violated, the operator may throw an IllegalStateException.
Scheduler:
repeat does not operate by default on a particular Scheduler.

Parameters
times the number of times the source Publisher items are repeated, a count of 0 will yield an empty sequence
Returns
  • a Flowable that repeats the sequence of items emitted by the source Publisher at most count times
Throws
IllegalArgumentException if count is less than zero

public final Flowable<T> repeatUntil (BooleanSupplier stop)

Returns a Flowable that repeats the sequence of items emitted by the source Publisher until the provided stop function returns true.

Backpressure:
The operator honors downstream backpressure and expects the source Publisher to honor backpressure as well. If this expectation is violated, the operator may throw an IllegalStateException.
Scheduler:
repeatUntil does not operate by default on a particular Scheduler.

Parameters
stop a boolean supplier that is called when the current Flowable completes and unless it returns false, the current Flowable is resubscribed
Returns
  • the new Flowable instance
Throws
NullPointerException if stop is null

public final Flowable<T> repeatWhen (Function<? super Flowable<Object>, ? extends Publisher<?>> handler)

Returns a Flowable that emits the same values as the source Publisher with the exception of an onComplete. An onComplete notification from the source will result in the emission of a void item to the Publisher provided as an argument to the notificationHandler function. If that Publisher calls onComplete or onError then repeatWhen will call onComplete or onError on the child subscription. Otherwise, this Publisher will resubscribe to the source Publisher.

Backpressure:
The operator honors downstream backpressure and expects the source Publisher to honor backpressure as well. If this expectation is violated, the operator may throw an IllegalStateException.
Scheduler:
repeatWhen does not operate by default on a particular Scheduler.

Parameters
handler receives a Publisher of notifications with which a user can complete or error, aborting the repeat.
Returns
  • the source Publisher modified with repeat logic

public final Flowable<R> replay (Function<? super Flowable<T>, ? extends Publisher<R>> selector, Scheduler scheduler)

Returns a Flowable that emits items that are the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher.

Backpressure:
This operator supports backpressure. Note that the upstream requests are determined by the child Subscriber which requests the largest amount: i.e., two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence.
Scheduler:
You specify which Scheduler this operator will use

Parameters
selector a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the Publisher
scheduler the Scheduler where the replay is observed
Returns
  • a Flowable that emits items that are the results of invoking the selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, replaying all items

public final Flowable<R> replay (Function<? super Flowable<T>, ? extends Publisher<R>> selector, int bufferSize)

Returns a Flowable that emits items that are the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, replaying bufferSize notifications.

Backpressure:
This operator supports backpressure. Note that the upstream requests are determined by the child Subscriber which requests the largest amount: i.e., two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence.
Scheduler:
This version of replay does not operate by default on a particular Scheduler.

Parameters
selector the selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the Publisher
bufferSize the buffer size that limits the number of items the connectable Publisher can replay
Returns
  • a Flowable that emits items that are the results of invoking the selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher replaying no more than bufferSize items

public final Flowable<R> replay (Function<? super Flowable<T>, ? extends Publisher<R>> selector, int bufferSize, Scheduler scheduler)

Returns a Flowable that emits items that are the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, replaying a maximum of bufferSize items.

Backpressure:
This operator supports backpressure. Note that the upstream requests are determined by the child Subscriber which requests the largest amount: i.e., two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence.
Scheduler:
You specify which Scheduler this operator will use

Parameters
selector a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the Publisher
bufferSize the buffer size that limits the number of items the connectable Publisher can replay
scheduler the Scheduler on which the replay is observed
Returns
  • a Flowable that emits items that are the results of invoking the selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, replaying no more than bufferSize notifications

public final ConnectableFlowable<T> replay (int bufferSize, long time, TimeUnit unit)

Returns a ConnectableFlowable that shares a single subscription to the source Publisher and replays at most bufferSize items that were emitted during a specified time window. A Connectable Publisher resembles an ordinary Publisher, except that it does not begin emitting items when it is subscribed to, but only when its connect method is called.

Backpressure:
This operator supports backpressure. Note that the upstream requests are determined by the child Subscriber which requests the largest amount: i.e., two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence.
Scheduler:
This version of replay operates by default on the computation Scheduler.

Parameters
bufferSize the buffer size that limits the number of items that can be replayed
time the duration of the window in which the replayed items must have been emitted
unit the time unit of time
Returns
  • a ConnectableFlowable that shares a single subscription to the source Publisher and replays at most bufferSize items that were emitted during the window defined by time

public final ConnectableFlowable<T> replay (int bufferSize, long time, TimeUnit unit, Scheduler scheduler)

Returns a ConnectableFlowable that shares a single subscription to the source Publisher and that replays a maximum of bufferSize items that are emitted within a specified time window. A Connectable Publisher resembles an ordinary Publisher, except that it does not begin emitting items when it is subscribed to, but only when its connect method is called.

Backpressure:
This operator supports backpressure. Note that the upstream requests are determined by the child Subscriber which requests the largest amount: i.e., two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence.
Scheduler:
You specify which Scheduler this operator will use

Parameters
bufferSize the buffer size that limits the number of items that can be replayed
time the duration of the window in which the replayed items must have been emitted
unit the time unit of time
scheduler the scheduler that is used as a time source for the window
Returns
  • a ConnectableFlowable that shares a single subscription to the source Publisher and replays at most bufferSize items that were emitted during the window defined by time
Throws
IllegalArgumentException if bufferSize is less than zero

public final ConnectableFlowable<T> replay (int bufferSize)

Returns a ConnectableFlowable that shares a single subscription to the source Publisher that replays at most bufferSize items emitted by that Publisher. A Connectable Publisher resembles an ordinary Publisher, except that it does not begin emitting items when it is subscribed to, but only when its connect method is called.

Backpressure:
This operator supports backpressure. Note that the upstream requests are determined by the child Subscriber which requests the largest amount: i.e., two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence.
Scheduler:
This version of replay does not operate by default on a particular Scheduler.

Parameters
bufferSize the buffer size that limits the number of items that can be replayed
Returns
  • a ConnectableFlowable that shares a single subscription to the source Publisher and replays at most bufferSize items emitted by that Publisher

public final ConnectableFlowable<T> replay ()

Returns a ConnectableFlowable that shares a single subscription to the underlying Publisher that will replay all of its items and notifications to any future Subscriber. A Connectable Publisher resembles an ordinary Publisher, except that it does not begin emitting items when it is subscribed to, but only when its connect method is called.

Backpressure:
This operator supports backpressure. Note that the upstream requests are determined by the child Subscriber which requests the largest amount: i.e., two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence.
Scheduler:
This version of replay does not operate by default on a particular Scheduler.

Returns
  • a ConnectableFlowable that upon connection causes the source Publisher to emit its items to its Subscribers

public final Flowable<R> replay (Function<? super Flowable<T>, ? extends Publisher<R>> selector)

Returns a Flowable that emits items that are the results of invoking a specified selector on the items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher.

Backpressure:
This operator supports backpressure. Note that the upstream requests are determined by the child Subscriber which requests the largest amount: i.e., two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence.
Scheduler:
This version of replay does not operate by default on a particular Scheduler.

Parameters
selector the selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the Publisher
Returns
  • a Flowable that emits items that are the results of invoking the selector on a ConnectableFlowable that shares a single subscription to the source Publisher

public final Flowable<R> replay (Function<? super Flowable<T>, ? extends Publisher<R>> selector, int bufferSize, long time, TimeUnit unit)

Returns a Flowable that emits items that are the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, replaying no more than bufferSize items that were emitted within a specified time window.

Backpressure:
This operator supports backpressure. Note that the upstream requests are determined by the child Subscriber which requests the largest amount: i.e., two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence.
Scheduler:
This version of replay operates by default on the computation Scheduler.

Parameters
selector a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the Publisher
bufferSize the buffer size that limits the number of items the connectable Publisher can replay
time the duration of the window in which the replayed items must have been emitted
unit the time unit of time
Returns
  • a Flowable that emits items that are the results of invoking the selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, and replays no more than bufferSize items that were emitted within the window defined by time

public final Flowable<R> replay (Function<? super Flowable<T>, ? extends Publisher<R>> selector, long time, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits items that are the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, replaying all items that were emitted within a specified time window.

Backpressure:
This operator supports backpressure. Note that the upstream requests are determined by the child Subscriber which requests the largest amount: i.e., two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence.
Scheduler:
You specify which Scheduler this operator will use

Parameters
selector a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the Publisher
time the duration of the window in which the replayed items must have been emitted
unit the time unit of time
scheduler the scheduler that is the time source for the window
Returns
  • a Flowable that emits items that are the results of invoking the selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, replaying all items that were emitted within the window defined by time

public final ConnectableFlowable<T> replay (long time, TimeUnit unit)

Returns a ConnectableFlowable that shares a single subscription to the source Publisher and replays all items emitted by that Publisher within a specified time window. A Connectable Publisher resembles an ordinary Publisher, except that it does not begin emitting items when it is subscribed to, but only when its connect method is called.

Backpressure:
This operator supports backpressure. Note that the upstream requests are determined by the child Subscriber which requests the largest amount: i.e., two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence.
Scheduler:
This version of replay operates by default on the computation Scheduler.

Parameters
time the duration of the window in which the replayed items must have been emitted
unit the time unit of time
Returns
  • a ConnectableFlowable that shares a single subscription to the source Publisher and replays the items that were emitted during the window defined by time

public final ConnectableFlowable<T> replay (Scheduler scheduler)

Returns a ConnectableFlowable that shares a single subscription to the source Publisher that will replay all of its items and notifications to any future Subscriber on the given Scheduler. A Connectable Publisher resembles an ordinary Publisher, except that it does not begin emitting items when it is subscribed to, but only when its connect method is called.

Backpressure:
This operator supports backpressure. Note that the upstream requests are determined by the child Subscriber which requests the largest amount: i.e., two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence.
Scheduler:
You specify which Scheduler this operator will use

Parameters
scheduler the Scheduler on which the Subscribers will observe the emitted items
Returns
  • a ConnectableFlowable that shares a single subscription to the source Publisher that will replay all of its items and notifications to any future Subscriber on the given Scheduler

public final ConnectableFlowable<T> replay (int bufferSize, Scheduler scheduler)

Returns a ConnectableFlowable that shares a single subscription to the source Publisher and replays at most bufferSize items emitted by that Publisher. A Connectable Publisher resembles an ordinary Publisher, except that it does not begin emitting items when it is subscribed to, but only when its connect method is called.

Backpressure:
This operator supports backpressure. Note that the upstream requests are determined by the child Subscriber which requests the largest amount: i.e., two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence.
Scheduler:
You specify which Scheduler this operator will use

Parameters
bufferSize the buffer size that limits the number of items that can be replayed
scheduler the scheduler on which the Subscribers will observe the emitted items
Returns
  • a ConnectableFlowable that shares a single subscription to the source Publisher and replays at most bufferSize items that were emitted by the Publisher

public final ConnectableFlowable<T> replay (long time, TimeUnit unit, Scheduler scheduler)

Returns a ConnectableFlowable that shares a single subscription to the source Publisher and replays all items emitted by that Publisher within a specified time window. A Connectable Publisher resembles an ordinary Publisher, except that it does not begin emitting items when it is subscribed to, but only when its connect method is called.

Backpressure:
This operator supports backpressure. Note that the upstream requests are determined by the child Subscriber which requests the largest amount: i.e., two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence.
Scheduler:
You specify which Scheduler this operator will use

Parameters
time the duration of the window in which the replayed items must have been emitted
unit the time unit of time
scheduler the Scheduler that is the time source for the window
Returns
  • a ConnectableFlowable that shares a single subscription to the source Publisher and replays the items that were emitted during the window defined by time

public final Flowable<R> replay (Function<? super Flowable<T>, ? extends Publisher<R>> selector, long time, TimeUnit unit)

Returns a Flowable that emits items that are the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, replaying all items that were emitted within a specified time window.

Backpressure:
This operator supports backpressure. Note that the upstream requests are determined by the child Subscriber which requests the largest amount: i.e., two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence.
Scheduler:
This version of replay operates by default on the computation Scheduler.

Parameters
selector a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the Publisher
time the duration of the window in which the replayed items must have been emitted
unit the time unit of time
Returns
  • a Flowable that emits items that are the results of invoking the selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, replaying all items that were emitted within the window defined by time

public final Flowable<R> replay (Function<? super Flowable<T>, ? extends Publisher<R>> selector, int bufferSize, long time, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits items that are the results of invoking a specified selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, replaying no more than bufferSize items that were emitted within a specified time window.

Backpressure:
This operator supports backpressure. Note that the upstream requests are determined by the child Subscriber which requests the largest amount: i.e., two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence.
Scheduler:
You specify which Scheduler this operator will use

Parameters
selector a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the Publisher
bufferSize the buffer size that limits the number of items the connectable Publisher can replay
time the duration of the window in which the replayed items must have been emitted
unit the time unit of time
scheduler the Scheduler that is the time source for the window
Returns
  • a Flowable that emits items that are the results of invoking the selector on items emitted by a ConnectableFlowable that shares a single subscription to the source Publisher, and replays no more than bufferSize items that were emitted within the window defined by time
Throws
IllegalArgumentException if bufferSize is less than zero

public final Flowable<T> retry ()

Returns a Flowable that mirrors the source Publisher, resubscribing to it if it calls onError (infinite retry count).

If the source Publisher calls onError(Throwable), this method will resubscribe to the source Publisher rather than propagating the onError call.

Any and all items emitted by the source Publisher will be emitted by the resulting Publisher, even those emitted during failed subscriptions. For example, if a Publisher fails at first but emits [1, 2] then succeeds the second time and emits [1, 2, 3, 4, 5] then the complete sequence of emissions and notifications would be [1, 2, 1, 2, 3, 4, 5, onComplete].

Backpressure:
The operator honors downstream backpressure and expects the source Publisher to honor backpressure as well. If this expectation is violated, the operator may throw an IllegalStateException.
Scheduler:
retry does not operate by default on a particular Scheduler.

Returns
  • the source Publisher modified with retry logic

public final Flowable<T> retry (long count)

Returns a Flowable that mirrors the source Publisher, resubscribing to it if it calls onError up to a specified number of retries.

If the source Publisher calls onError(Throwable), this method will resubscribe to the source Publisher for a maximum of count resubscriptions rather than propagating the onError call.

Any and all items emitted by the source Publisher will be emitted by the resulting Publisher, even those emitted during failed subscriptions. For example, if a Publisher fails at first but emits [1, 2] then succeeds the second time and emits [1, 2, 3, 4, 5] then the complete sequence of emissions and notifications would be [1, 2, 1, 2, 3, 4, 5, onComplete].

Backpressure:
The operator honors downstream backpressure and expects the source Publisher to honor backpressure as well. If this expectation is violated, the operator may throw an IllegalStateException.
Scheduler:
retry does not operate by default on a particular Scheduler.

Parameters
count number of retry attempts before failing
Returns
  • the source Publisher modified with retry logic

public final Flowable<T> retry (long times, Predicate<? super Throwable> predicate)

Retries at most times or until the predicate returns false, whichever happens first.

Backpressure:
The operator honors downstream backpressure and expects the source Publisher to honor backpressure as well. If this expectation is violated, the operator may throw an IllegalStateException.
Scheduler:
retry does not operate by default on a particular Scheduler.

Parameters
times the number of times to repeat
predicate the predicate called with the failure Throwable and should return true to trigger a retry.
Returns
  • the new Flowable instance

public final Flowable<T> retry (BiPredicate<? super Integer, ? super Throwable> predicate)

Returns a Flowable that mirrors the source Publisher, resubscribing to it if it calls onError and the predicate returns true for that specific exception and retry count.

Backpressure:
The operator honors downstream backpressure and expects the source Publisher to honor backpressure as well. If this expectation is violated, the operator may throw an IllegalStateException.
Scheduler:
retry does not operate by default on a particular Scheduler.

Parameters
predicate the predicate that determines if a resubscription may happen in case of a specific exception and retry count
Returns
  • the source Publisher modified with retry logic

public final Flowable<T> retry (Predicate<? super Throwable> predicate)

Retries the current Flowable if the predicate returns true.

Backpressure:
The operator honors downstream backpressure and expects the source Publisher to honor backpressure as well. If this expectation is violated, the operator may throw an IllegalStateException.
Scheduler:
retry does not operate by default on a particular Scheduler.

Parameters
predicate the predicate that receives the failure Throwable and should return true to trigger a retry.
Returns
  • the new Flowable instance

public final Flowable<T> retryUntil (BooleanSupplier stop)

Retries until the given stop function returns true.

Backpressure:
The operator honors downstream backpressure and expects the source Publisher to honor backpressure as well. If this expectation is violated, the operator may throw an IllegalStateException.
Scheduler:
retryUntil does not operate by default on a particular Scheduler.

Parameters
stop the function that should return true to stop retrying
Returns
  • the new Flowable instance

public final Flowable<T> retryWhen (Function<? super Flowable<Throwable>, ? extends Publisher<?>> handler)

Returns a Flowable that emits the same values as the source Publisher with the exception of an onError. An onError notification from the source will result in the emission of a Throwable item to the Publisher provided as an argument to the notificationHandler function. If that Publisher calls onComplete or onError then retry will call onComplete or onError on the child subscription. Otherwise, this Publisher will resubscribe to the source Publisher.

Example: This retries 3 times, each time incrementing the number of seconds it waits.


  Publisher.create((Subscriber<? super String> s) -> {
      System.out.println("subscribing");
      s.onError(new RuntimeException("always fails"));
  }).retryWhen(attempts -> {
      return attempts.zipWith(Flowable.range(1, 3), (n, i) -> i).flatMap(i -> {
          System.out.println("delay retry by " + i + " second(s)");
          return Publisher.timer(i, TimeUnit.SECONDS);
      });
  }).blockingForEach(System.out::println);
 
Output is:
 subscribing
 delay retry by 1 second(s)
 subscribing
 delay retry by 2 second(s)
 subscribing
 delay retry by 3 second(s)
 subscribing
  
Backpressure:
The operator honors downstream backpressure and expects the source Publisher to honor backpressure as well. If this expectation is violated, the operator may throw an IllegalStateException.
Scheduler:
retryWhen does not operate by default on a particular Scheduler.

Parameters
handler receives a Publisher of notifications with which a user can complete or error, aborting the retry
Returns
  • the source Publisher modified with retry logic

public final void safeSubscribe (Subscriber<? super T> s)

Subscribes to the current Flowable and wraps the given Subscriber into a SafeSubscriber (if not already a SafeSubscriber) that deals with exceptions thrown by a misbehaving Subscriber (that doesn't follow the Reactive-Streams specification).

Backpressure:
This operator leaves the reactive world and the backpressure behavior depends on the Subscriber's behavior.
Scheduler:
safeSubscribe does not operate by default on a particular Scheduler.

Parameters
s the incoming Subscriber instance
Throws
NullPointerException if s is null

public final Flowable<T> sample (long period, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits the most recently emitted item (if any) emitted by the source Publisher within periodic time intervals, where the intervals are defined on a particular Scheduler.

Backpressure:
This operator does not support backpressure as it uses time to control data flow.
Scheduler:
You specify which Scheduler this operator will use

Parameters
period the sampling rate
unit the TimeUnit in which period is defined
scheduler the Scheduler to use when sampling
Returns
  • a Flowable that emits the results of sampling the items emitted by the source Publisher at the specified time interval

public final Flowable<T> sample (long period, TimeUnit unit)

Returns a Flowable that emits the most recently emitted item (if any) emitted by the source Publisher within periodic time intervals.

Backpressure:
This operator does not support backpressure as it uses time to control data flow.
Scheduler:
sample operates by default on the computation Scheduler.

Parameters
period the sampling rate
unit the TimeUnit in which period is defined
Returns
  • a Flowable that emits the results of sampling the items emitted by the source Publisher at the specified time interval

public final Flowable<T> sample (Publisher<U> sampler)

Returns a Flowable that, when the specified sampler Publisher emits an item or completes, emits the most recently emitted item (if any) emitted by the source Publisher since the previous emission from the sampler Publisher.

Backpressure:
This operator does not support backpressure as it uses the emissions of the sampler Publisher to control data flow.
Scheduler:
This version of sample does not operate by default on a particular Scheduler.

Parameters
sampler the Publisher to use for sampling the source Publisher
Returns
  • a Flowable that emits the results of sampling the items emitted by this Publisher whenever the sampler Publisher emits an item or completes

public final Flowable<T> sample (long period, TimeUnit unit, boolean emitLast)

Returns a Flowable that emits the most recently emitted item (if any) emitted by the source Publisher within periodic time intervals and optionally emit the very last upstream item when the upstream completes.

Backpressure:
This operator does not support backpressure as it uses time to control data flow.
Scheduler:
sample operates by default on the computation Scheduler.

History: 2.0.5 - experimental

Parameters
period the sampling rate
unit the TimeUnit in which period is defined
emitLast if true and the upstream completes while there is still an unsampled item available, that item is emitted to downstream before completion if false, an unsampled last item is ignored.
Returns
  • a Flowable that emits the results of sampling the items emitted by the source Publisher at the specified time interval

public final Flowable<T> sample (long period, TimeUnit unit, Scheduler scheduler, boolean emitLast)

Returns a Flowable that emits the most recently emitted item (if any) emitted by the source Publisher within periodic time intervals, where the intervals are defined on a particular Scheduler and optionally emit the very last upstream item when the upstream completes.

Backpressure:
This operator does not support backpressure as it uses time to control data flow.
Scheduler:
You specify which Scheduler this operator will use

History: 2.0.5 - experimental

Parameters
period the sampling rate
unit the TimeUnit in which period is defined
scheduler the Scheduler to use when sampling
emitLast if true and the upstream completes while there is still an unsampled item available, that item is emitted to downstream before completion if false, an unsampled last item is ignored.
Returns
  • a Flowable that emits the results of sampling the items emitted by the source Publisher at the specified time interval

public final Flowable<T> sample (Publisher<U> sampler, boolean emitLast)

Returns a Flowable that, when the specified sampler Publisher emits an item or completes, emits the most recently emitted item (if any) emitted by the source Publisher since the previous emission from the sampler Publisher and optionally emit the very last upstream item when the upstream or other Publisher complete.

Backpressure:
This operator does not support backpressure as it uses the emissions of the sampler Publisher to control data flow.
Scheduler:
This version of sample does not operate by default on a particular Scheduler.

History: 2.0.5 - experimental

Parameters
sampler the Publisher to use for sampling the source Publisher
emitLast if true and the upstream completes while there is still an unsampled item available, that item is emitted to downstream before completion if false, an unsampled last item is ignored.
Returns
  • a Flowable that emits the results of sampling the items emitted by this Publisher whenever the sampler Publisher emits an item or completes

public final Flowable<R> scan (R initialValue, BiFunction<R, ? super T, R> accumulator)

Returns a Flowable that applies a specified accumulator function to the first item emitted by a source Publisher and a seed value, then feeds the result of that function along with the second item emitted by the source Publisher into the same function, and so on until all items have been emitted by the source Publisher, emitting the result of each of these iterations.

This sort of function is sometimes called an accumulator.

Note that the Publisher that results from this method will emit initialValue as its first emitted item.

Note that the initialValue is shared among all subscribers to the resulting Publisher and may cause problems if it is mutable. To make sure each subscriber gets its own value, defer the application of this operator via defer(Callable):


 Publisher<T> source = ...
 Flowable.defer(() -> source.scan(new ArrayList<>(), (list, item) -> list.add(item)));

 // alternatively, by using compose to stay fluent

 source.compose(o ->
     Flowable.defer(() -> o.scan(new ArrayList<>(), (list, item) -> list.add(item)))
 );
 
Backpressure:
The operator honors downstream backpressure and expects the source Publisher to honor backpressure as well. Violating this expectation, a MissingBackpressureException may get signalled somewhere downstream.
Scheduler:
scan does not operate by default on a particular Scheduler.

Parameters
initialValue the initial (seed) accumulator item
accumulator an accumulator function to be invoked on each item emitted by the source Publisher, whose result will be emitted to Subscribers via onNext and used in the next accumulator call
Returns
  • a Flowable that emits initialValue followed by the results of each call to the accumulator function

public final Flowable<T> scan (BiFunction<T, T, T> accumulator)

Returns a Flowable that applies a specified accumulator function to the first item emitted by a source Publisher, then feeds the result of that function along with the second item emitted by the source Publisher into the same function, and so on until all items have been emitted by the source Publisher, emitting the result of each of these iterations.

This sort of function is sometimes called an accumulator.

Backpressure:
The operator honors downstream backpressure and expects the source Publisher to honor backpressure as well. Violating this expectation, a MissingBackpressureException may get signalled somewhere downstream.
Scheduler:
scan does not operate by default on a particular Scheduler.

Parameters
accumulator an accumulator function to be invoked on each item emitted by the source Publisher, whose result will be emitted to Subscribers via onNext and used in the next accumulator call
Returns
  • a Flowable that emits the results of each call to the accumulator function

public final Flowable<R> scanWith (Callable<R> seedSupplier, BiFunction<R, ? super T, R> accumulator)

Returns a Flowable that applies a specified accumulator function to the first item emitted by a source Publisher and a seed value, then feeds the result of that function along with the second item emitted by the source Publisher into the same function, and so on until all items have been emitted by the source Publisher, emitting the result of each of these iterations.

This sort of function is sometimes called an accumulator.

Note that the Publisher that results from this method will emit the value returned by the seedSupplier as its first item.

Backpressure:
The operator honors downstream backpressure and expects the source Publisher to honor backpressure as well. Violating this expectation, a MissingBackpressureException may get signalled somewhere downstream.
Scheduler:
scanWith does not operate by default on a particular Scheduler.

Parameters
seedSupplier a Callable that returns the initial (seed) accumulator item for each individual Subscriber
accumulator an accumulator function to be invoked on each item emitted by the source Publisher, whose result will be emitted to Subscribers via onNext and used in the next accumulator call
Returns
  • a Flowable that emits initialValue followed by the results of each call to the accumulator function

public static Single<Boolean> sequenceEqual (Publisher<? extends T> source1, Publisher<? extends T> source2, BiPredicate<? super T, ? super T> isEqual, int bufferSize)

Returns a Single that emits a Boolean value that indicates whether two Publisher sequences are the same by comparing the items emitted by each Publisher pairwise based on the results of a specified equality function.

Backpressure:
The operator honors backpressure from downstream. The source Publishers are expected to honor backpressure; if violated, the operator signals a MissingBackpressureException.
Scheduler:
sequenceEqual does not operate by default on a particular Scheduler.

Parameters
source1 the first Publisher to compare
source2 the second Publisher to compare
isEqual a function used to compare items emitted by each Publisher
bufferSize the number of items to prefetch from the first and second source Publisher
Returns
  • a Single that emits a Boolean value that indicates whether the two Publisher sequences are the same according to the specified function

public static Single<Boolean> sequenceEqual (Publisher<? extends T> source1, Publisher<? extends T> source2, int bufferSize)

Returns a Single that emits a Boolean value that indicates whether two Publisher sequences are the same by comparing the items emitted by each Publisher pairwise.

Backpressure:
This operator honors downstream backpressure and expects both of its sources to honor backpressure as well. If violated, the operator will emit a MissingBackpressureException.
Scheduler:
sequenceEqual does not operate by default on a particular Scheduler.

Parameters
source1 the first Publisher to compare
source2 the second Publisher to compare
bufferSize the number of items to prefetch from the first and second source Publisher
Returns
  • a Single that emits a Boolean value that indicates whether the two sequences are the same

public static Single<Boolean> sequenceEqual (Publisher<? extends T> source1, Publisher<? extends T> source2)

Returns a Single that emits a Boolean value that indicates whether two Publisher sequences are the same by comparing the items emitted by each Publisher pairwise.

Backpressure:
This operator honors downstream backpressure and expects both of its sources to honor backpressure as well. If violated, the operator will emit a MissingBackpressureException.
Scheduler:
sequenceEqual does not operate by default on a particular Scheduler.

Parameters
source1 the first Publisher to compare
source2 the second Publisher to compare
Returns
  • a Flowable that emits a Boolean value that indicates whether the two sequences are the same

public static Single<Boolean> sequenceEqual (Publisher<? extends T> source1, Publisher<? extends T> source2, BiPredicate<? super T, ? super T> isEqual)

Returns a Single that emits a Boolean value that indicates whether two Publisher sequences are the same by comparing the items emitted by each Publisher pairwise based on the results of a specified equality function.

Backpressure:
The operator honors backpressure from downstream. The source Publishers are expected to honor backpressure; if violated, the operator signals a MissingBackpressureException.
Scheduler:
sequenceEqual does not operate by default on a particular Scheduler.

Parameters
source1 the first Publisher to compare
source2 the second Publisher to compare
isEqual a function used to compare items emitted by each Publisher
Returns
  • a Single that emits a Boolean value that indicates whether the two Publisher sequences are the same according to the specified function

public final Flowable<T> serialize ()

Forces a Publisher's emissions and notifications to be serialized and for it to obey the Publisher contract in other ways.

It is possible for a Publisher to invoke its Subscribers' methods asynchronously, perhaps from different threads. This could make such a Publisher poorly-behaved, in that it might try to invoke onComplete or onError before one of its onNext invocations, or it might call onNext from two different threads concurrently. You can force such a Publisher to be well-behaved and sequential by applying the serialize method to it.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
serialize does not operate by default on a particular Scheduler.

Returns
  • a Publisher that is guaranteed to be well-behaved and to make only serialized calls to its Subscribers

public final Flowable<T> share ()

Returns a new Publisher that multicasts (shares) the original Publisher. As long as there is at least one Subscriber this Publisher will be subscribed and emitting data. When all subscribers have cancelled it will cancel the source Publisher.

This is an alias for publish().refCount().

Backpressure:
The operator honors backpressure and and expects the source Publisher to honor backpressure as well. If this expectation is violated, the operator will signal a MissingBackpressureException to its Subscribers.
Scheduler:
share does not operate by default on a particular Scheduler.

Returns
  • a Publisher that upon connection causes the source Publisher to emit items to its Subscribers

public final Single<T> single (T defaultItem)

Returns a Single that emits the single item emitted by the source Publisher, if that Publisher emits only a single item, or a default item if the source Publisher emits no items. If the source Publisher emits more than one item, an IllegalArgumentException is signalled instead.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure).
Scheduler:
single does not operate by default on a particular Scheduler.

Parameters
defaultItem a default value to emit if the source Publisher emits no item
Returns
  • a Single that emits the single item emitted by the source Publisher, or a default item if the source Publisher is empty

public final Maybe<T> singleElement ()

Returns a Maybe that completes if this Flowable is empty, signals one item if this Flowable signals exactly one item or signals an IllegalArgumentException if this Flowable signals more than one item.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure).
Scheduler:
singleElement does not operate by default on a particular Scheduler.

Returns
  • a Maybe that emits the single item emitted by the source Publisher

public final Single<T> singleOrError ()

Returns a Single that emits the single item emitted by this Flowable, if this Flowable emits only a single item, otherwise if this Flowable completes without emitting any items a NoSuchElementException will be signalled and if this Flowable emits more than one item, an IllegalArgumentException will be signalled.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure).
Scheduler:
singleOrError does not operate by default on a particular Scheduler.

Returns
  • the new Single instance

public final Flowable<T> skip (long count)

Returns a Flowable that skips the first count items emitted by the source Publisher and emits the remainder.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
This version of skip does not operate by default on a particular Scheduler.

Parameters
count the number of items to skip
Returns
  • a Flowable that is identical to the source Publisher except that it does not emit the first count items that the source Publisher emits

public final Flowable<T> skip (long time, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that skips values emitted by the source Publisher before a specified time window on a specified Scheduler elapses.

Backpressure:
The operator doesn't support backpressure as it uses time to skip arbitrary number of elements and thus has to consume the source Publisher in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
You specify which Scheduler this operator will use for the timed skipping

Parameters
time the length of the time window to skip
unit the time unit of time
scheduler the Scheduler on which the timed wait happens
Returns
  • a Flowable that skips values emitted by the source Publisher before the time window defined by time and scheduler elapses, and then emits the remainder

public final Flowable<T> skip (long time, TimeUnit unit)

Returns a Flowable that skips values emitted by the source Publisher before a specified time window elapses.

Backpressure:
The operator doesn't support backpressure as it uses time to skip arbitrary number of elements and thus has to consume the source Publisher in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
skip does not operate on any particular scheduler but uses the current time from the computation Scheduler.

Parameters
time the length of the time window to skip
unit the time unit of time
Returns
  • a Flowable that skips values emitted by the source Publisher before the time window defined by time elapses and the emits the remainder

public final Flowable<T> skipLast (int count)

Returns a Flowable that drops a specified number of items from the end of the sequence emitted by the source Publisher.

This Subscriber accumulates a queue long enough to store the first count items. As more items are received, items are taken from the front of the queue and emitted by the returned Publisher. This causes such items to be delayed.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
This version of skipLast does not operate by default on a particular Scheduler.

Parameters
count number of items to drop from the end of the source sequence
Returns
  • a Flowable that emits the items emitted by the source Publisher except for the dropped ones at the end
Throws
IndexOutOfBoundsException if count is less than zero

public final Flowable<T> skipLast (long time, TimeUnit unit)

Returns a Flowable that drops items emitted by the source Publisher during a specified time window before the source completes.

Note: this action will cache the latest items arriving in the specified time window.

Backpressure:
The operator doesn't support backpressure as it uses time to skip arbitrary number of elements and thus has to consume the source Publisher in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
skipLast does not operate on any particular scheduler but uses the current time from the computation Scheduler.

Parameters
time the length of the time window
unit the time unit of time
Returns
  • a Flowable that drops those items emitted by the source Publisher in a time window before the source completes defined by time

public final Flowable<T> skipLast (long time, TimeUnit unit, boolean delayError)

Returns a Flowable that drops items emitted by the source Publisher during a specified time window before the source completes.

Note: this action will cache the latest items arriving in the specified time window.

Backpressure:
The operator doesn't support backpressure as it uses time to skip arbitrary number of elements and thus has to consume the source Publisher in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
skipLast does not operate on any particular scheduler but uses the current time from the computation Scheduler.

Parameters
time the length of the time window
unit the time unit of time
delayError if true, an exception signalled by the current Flowable is delayed until the regular elements are consumed by the downstream; if false, an exception is immediately signalled and all regular elements dropped
Returns
  • a Flowable that drops those items emitted by the source Publisher in a time window before the source completes defined by time

public final Flowable<T> skipLast (long time, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that drops items emitted by the source Publisher during a specified time window (defined on a specified scheduler) before the source completes.

Note: this action will cache the latest items arriving in the specified time window.

Backpressure:
The operator doesn't support backpressure as it uses time to skip arbitrary number of elements and thus has to consume the source Publisher in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
You specify which Scheduler this operator will use for tracking the current time

Parameters
time the length of the time window
unit the time unit of time
scheduler the scheduler used as the time source
Returns
  • a Flowable that drops those items emitted by the source Publisher in a time window before the source completes defined by time and scheduler

public final Flowable<T> skipLast (long time, TimeUnit unit, Scheduler scheduler, boolean delayError, int bufferSize)

Returns a Flowable that drops items emitted by the source Publisher during a specified time window (defined on a specified scheduler) before the source completes.

Note: this action will cache the latest items arriving in the specified time window.

Backpressure:
The operator doesn't support backpressure as it uses time to skip arbitrary number of elements and thus has to consume the source Publisher in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
You specify which Scheduler this operator will use

Parameters
time the length of the time window
unit the time unit of time
scheduler the scheduler used as the time source
delayError if true, an exception signalled by the current Flowable is delayed until the regular elements are consumed by the downstream; if false, an exception is immediately signalled and all regular elements dropped
bufferSize the hint about how many elements to expect to be skipped
Returns
  • a Flowable that drops those items emitted by the source Publisher in a time window before the source completes defined by time and scheduler

public final Flowable<T> skipLast (long time, TimeUnit unit, Scheduler scheduler, boolean delayError)

Returns a Flowable that drops items emitted by the source Publisher during a specified time window (defined on a specified scheduler) before the source completes.

Note: this action will cache the latest items arriving in the specified time window.

Backpressure:
The operator doesn't support backpressure as it uses time to skip arbitrary number of elements and thus has to consume the source Publisher in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
You specify which Scheduler this operator will use to track the current time

Parameters
time the length of the time window
unit the time unit of time
scheduler the scheduler used as the time source
delayError if true, an exception signalled by the current Flowable is delayed until the regular elements are consumed by the downstream; if false, an exception is immediately signalled and all regular elements dropped
Returns
  • a Flowable that drops those items emitted by the source Publisher in a time window before the source completes defined by time and scheduler

public final Flowable<T> skipUntil (Publisher<U> other)

Returns a Flowable that skips items emitted by the source Publisher until a second Publisher emits an item.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
skipUntil does not operate by default on a particular Scheduler.

Parameters
other the second Publisher that has to emit an item before the source Publisher's elements begin to be mirrored by the resulting Publisher
Returns
  • a Flowable that skips items from the source Publisher until the second Publisher emits an item, then emits the remaining items

public final Flowable<T> skipWhile (Predicate<? super T> predicate)

Returns a Flowable that skips all items emitted by the source Publisher as long as a specified condition holds true, but emits all further source items as soon as the condition becomes false.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
skipWhile does not operate by default on a particular Scheduler.

Parameters
predicate a function to test each item emitted from the source Publisher
Returns
  • a Flowable that begins emitting items emitted by the source Publisher when the specified predicate becomes false

public final Flowable<T> sorted ()

Returns a Flowable that emits the events emitted by source Publisher, in a sorted order. Each item emitted by the Publisher must implement Comparable with respect to all other items in the sequence.

If any item emitted by this Flowable does not implement Comparable with respect to all other items emitted by this Flowable, no items will be emitted and the sequence is terminated with a ClassCastException.

Note that calling sorted with long, non-terminating or infinite sources might cause OutOfMemoryError

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure to it).
Scheduler:
sorted does not operate by default on a particular Scheduler.

Returns
  • a Flowable that emits the items emitted by the source Publisher in sorted order

public final Flowable<T> sorted (Comparator<? super T> sortFunction)

Returns a Flowable that emits the events emitted by source Publisher, in a sorted order based on a specified comparison function.

Note that calling sorted with long, non-terminating or infinite sources might cause OutOfMemoryError

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure to it).
Scheduler:
sorted does not operate by default on a particular Scheduler.

Parameters
sortFunction a function that compares two items emitted by the source Publisher and returns an Integer that indicates their sort order
Returns
  • a Flowable that emits the items emitted by the source Publisher in sorted order

public final Flowable<T> startWith (Publisher<? extends T> other)

Returns a Flowable that emits the items in a specified Publisher before it begins to emit items emitted by the source Publisher.

Backpressure:
The operator honors backpressure from downstream. Both this and the other Publishers are expected to honor backpressure as well. If any of then violates this rule, it may throw an IllegalStateException when the source Publisher completes.
Scheduler:
startWith does not operate by default on a particular Scheduler.

Parameters
other a Publisher that contains the items you want the modified Publisher to emit first
Returns
  • a Flowable that emits the items in the specified Publisher and then emits the items emitted by the source Publisher

public final Flowable<T> startWith (Iterable<? extends T> items)

Returns a Flowable that emits the items in a specified Iterable before it begins to emit items emitted by the source Publisher.

Backpressure:
The operator honors backpressure from downstream. The source Publisher is expected to honor backpressure as well. If it violates this rule, it may throw an IllegalStateException when the source Publisher completes.
Scheduler:
startWith does not operate by default on a particular Scheduler.

Parameters
items an Iterable that contains the items you want the modified Publisher to emit first
Returns
  • a Flowable that emits the items in the specified Iterable and then emits the items emitted by the source Publisher

public final Flowable<T> startWith (T value)

Returns a Flowable that emits a specified item before it begins to emit items emitted by the source Publisher.

Backpressure:
The operator honors backpressure from downstream. The source Publisher is expected to honor backpressure as well. If it violates this rule, it may throw an IllegalStateException when the source Publisher completes.
Scheduler:
startWith does not operate by default on a particular Scheduler.

Parameters
value the item to emit first
Returns
  • a Flowable that emits the specified item before it begins to emit items emitted by the source Publisher

public final Flowable<T> startWithArray (T... items)

Returns a Flowable that emits the specified items before it begins to emit items emitted by the source Publisher.

Backpressure:
The operator honors backpressure from downstream. The source Publisher is expected to honor backpressure as well. If it violates this rule, it may throw an IllegalStateException when the source Publisher completes.
Scheduler:
startWithArray does not operate by default on a particular Scheduler.

Parameters
items the array of values to emit first
Returns
  • a Flowable that emits the specified items before it begins to emit items emitted by the source Publisher

public final void subscribe (FlowableSubscriber<? super T> s)

Establish a connection between this Flowable and the given FlowableSubscriber and start streaming events based on the demand of the FlowableSubscriber.

This is a "factory method" and can be called multiple times, each time starting a new Subscription.

Each Subscription will work for only a single FlowableSubscriber.

If the same FlowableSubscriber instance is subscribed to multiple Flowables and/or the same Flowable multiple times, it must ensure the serialization over its onXXX methods manually.

If the Flowable rejects the subscription attempt or otherwise fails it will signal the error via onError(Throwable).

This subscribe method relaxes the following Reactive-Streams rules:

  • §1.3: onNext should not be called concurrently until onSubscribe returns. FlowableSubscriber.onSubscribe should make sure a sync or async call triggered by request() is safe.
  • §2.3: onError or onComplete must not call cancel. Calling request() or cancel() is NOP at this point.
  • §2.12: onSubscribe must be called at most once on the same instance. FlowableSubscriber reuse is not checked and if happens, it is the responsibility of the FlowableSubscriber to ensure proper serialization of its onXXX methods.
  • §3.9: negative requests should emit an onError(IllegalArgumentException). Non-positive requests signal via RxJavaPlugins.onError and the stream is not affected.
Backpressure:
The backpressure behavior/expectation is determined by the supplied FlowableSubscriber.
Scheduler:
subscribe does not operate by default on a particular Scheduler.

History: 2.0.7 - experimental

Parameters
s the FlowableSubscriber that will consume signals from this Flowable

public final void subscribe (Subscriber<? super T> s)

public final Disposable subscribe (Consumer<? super T> onNext, Consumer<? super Throwable> onError, Action onComplete)

Subscribes to a Publisher and provides callbacks to handle the items it emits and any error or completion notification it issues.

Backpressure:
The operator consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it).
Scheduler:
subscribe does not operate by default on a particular Scheduler.

Parameters
onNext the Consumer<T> you have designed to accept emissions from the Publisher
onError the Consumer<Throwable> you have designed to accept any error notification from the Publisher
onComplete the Action you have designed to accept a completion notification from the Publisher
Returns
  • a Disposable reference with which the caller can stop receiving items before the Publisher has finished sending them
Throws
NullPointerException if onNext is null, or if onError is null, or if onComplete is null

public final Disposable subscribe (Consumer<? super T> onNext, Consumer<? super Throwable> onError, Action onComplete, Consumer<? super Subscription> onSubscribe)

Subscribes to a Publisher and provides callbacks to handle the items it emits and any error or completion notification it issues.

Backpressure:
The operator consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it).
Scheduler:
subscribe does not operate by default on a particular Scheduler.

Parameters
onNext the Consumer<T> you have designed to accept emissions from the Publisher
onError the Consumer<Throwable> you have designed to accept any error notification from the Publisher
onComplete the Action you have designed to accept a completion notification from the Publisher
onSubscribe the Consumer that receives the upstream's Subscription
Returns
  • a Disposable reference with which the caller can stop receiving items before the Publisher has finished sending them
Throws
NullPointerException if onNext is null, or if onError is null, or if onComplete is null

public final Disposable subscribe ()

Subscribes to a Publisher and ignores onNext and onComplete emissions.

If the Flowable emits an error, it is wrapped into an OnErrorNotImplementedException and routed to the RxJavaPlugins.onError handler.

Backpressure:
The operator consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it).
Scheduler:
subscribe does not operate by default on a particular Scheduler.

Returns
  • a Disposable reference with which the caller can stop receiving items before the Publisher has finished sending them

public final Disposable subscribe (Consumer<? super T> onNext)

Subscribes to a Publisher and provides a callback to handle the items it emits.

If the Flowable emits an error, it is wrapped into an OnErrorNotImplementedException and routed to the RxJavaPlugins.onError handler.

Backpressure:
The operator consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it).
Scheduler:
subscribe does not operate by default on a particular Scheduler.

Parameters
onNext the Consumer<T> you have designed to accept emissions from the Publisher
Returns
  • a Disposable reference with which the caller can stop receiving items before the Publisher has finished sending them
Throws
NullPointerException if onNext is null

public final Disposable subscribe (Consumer<? super T> onNext, Consumer<? super Throwable> onError)

Subscribes to a Publisher and provides callbacks to handle the items it emits and any error notification it issues.

Backpressure:
The operator consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it).
Scheduler:
subscribe does not operate by default on a particular Scheduler.

Parameters
onNext the Consumer<T> you have designed to accept emissions from the Publisher
onError the Consumer<Throwable> you have designed to accept any error notification from the Publisher
Returns
  • a Disposable reference with which the caller can stop receiving items before the Publisher has finished sending them
Throws
NullPointerException if onNext is null, or if onError is null

public final Flowable<T> subscribeOn (Scheduler scheduler)

Asynchronously subscribes Subscribers to this Publisher on the specified Scheduler.

If there is a create(FlowableOnSubscribe, BackpressureStrategy) type source up in the chain, it is recommended to use subscribeOn(scheduler, false) instead to avoid same-pool deadlock because requests may pile up behind an eager/blocking emitter.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
You specify which Scheduler this operator will use

Parameters
scheduler the Scheduler to perform subscription actions on
Returns
  • the source Publisher modified so that its subscriptions happen on the specified Scheduler

public final Flowable<T> subscribeOn (Scheduler scheduler, boolean requestOn)

Asynchronously subscribes Subscribers to this Publisher on the specified Scheduler optionally reroutes requests from other threads to the same Scheduler thread.

If there is a create(FlowableOnSubscribe, BackpressureStrategy) type source up in the chain, it is recommended to have requestOn false to avoid same-pool deadlock because requests may pile up behind an eager/blocking emitter.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
You specify which Scheduler this operator will use

Parameters
scheduler the Scheduler to perform subscription actions on
requestOn if true, requests are rerouted to the given Scheduler as well (strong pipelining) if false, requests coming from any thread are simply forwarded to the upstream on the same thread (weak pipelining)
Returns
  • the source Publisher modified so that its subscriptions happen on the specified Scheduler

public final E subscribeWith (E subscriber)

Subscribes a given Subscriber (subclass) to this Flowable and returns the given Subscriber as is.

Usage example:


 Flowable<Integer> source = Flowable.range(1, 10);
 CompositeDisposable composite = new CompositeDisposable();

 ResourceSubscriber<Integer> rs = new ResourceSubscriber<>() {
     // ...
 };

 composite.add(source.subscribeWith(rs));
 
Backpressure:
The backpressure behavior/expectation is determined by the supplied Subscriber.
Scheduler:
subscribeWith does not operate by default on a particular Scheduler.

Parameters
subscriber the Subscriber (subclass) to use and return, not null
Returns
  • the input subscriber
Throws
NullPointerException if subscriber is null

public final Flowable<T> switchIfEmpty (Publisher<? extends T> other)

Returns a Flowable that emits the items emitted by the source Publisher or the items of an alternate Publisher if the source Publisher is empty.

Backpressure:
If the source Publisher is empty, the alternate Publisher is expected to honor backpressure. If the source Publisher is non-empty, it is expected to honor backpressure as instead. In either case, if violated, a MissingBackpressureException may get signalled somewhere downstream.
Scheduler:
switchIfEmpty does not operate by default on a particular Scheduler.

Parameters
other the alternate Publisher to subscribe to if the source does not emit any items
Returns
  • a Publisher that emits the items emitted by the source Publisher or the items of an alternate Publisher if the source Publisher is empty.

public final Flowable<R> switchMap (Function<? super T, ? extends Publisher<? extends R>> mapper, int bufferSize)

Returns a new Publisher by applying a function that you supply to each item emitted by the source Publisher that returns a Publisher, and then emitting the items emitted by the most recently emitted of these Publishers.

The resulting Publisher completes if both the upstream Publisher and the last inner Publisher, if any, complete. If the upstream Publisher signals an onError, the inner Publisher is cancelled and the error delivered in-sequence.

Backpressure:
The operator honors backpressure from downstream. The outer Publisher is consumed in an unbounded manner (i.e., without backpressure) and the inner Publishers are expected to honor backpressure but it is not enforced; the operator won't signal a MissingBackpressureException but the violation may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
switchMap does not operate by default on a particular Scheduler.

Parameters
mapper a function that, when applied to an item emitted by the source Publisher, returns an Publisher
bufferSize the number of elements to prefetch from the current active inner Publisher
Returns
  • a Flowable that emits the items emitted by the Publisher returned from applying func to the most recently emitted item emitted by the source Publisher

public final Flowable<R> switchMap (Function<? super T, ? extends Publisher<? extends R>> mapper)

Returns a new Publisher by applying a function that you supply to each item emitted by the source Publisher that returns a Publisher, and then emitting the items emitted by the most recently emitted of these Publishers.

The resulting Publisher completes if both the upstream Publisher and the last inner Publisher, if any, complete. If the upstream Publisher signals an onError, the inner Publisher is cancelled and the error delivered in-sequence.

Backpressure:
The operator honors backpressure from downstream. The outer Publisher is consumed in an unbounded manner (i.e., without backpressure) and the inner Publishers are expected to honor backpressure but it is not enforced; the operator won't signal a MissingBackpressureException but the violation may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
switchMap does not operate by default on a particular Scheduler.

Parameters
mapper a function that, when applied to an item emitted by the source Publisher, returns an Publisher
Returns
  • a Flowable that emits the items emitted by the Publisher returned from applying func to the most recently emitted item emitted by the source Publisher

public final Flowable<R> switchMapDelayError (Function<? super T, ? extends Publisher<? extends R>> mapper)

Returns a new Publisher by applying a function that you supply to each item emitted by the source Publisher that returns a Publisher, and then emitting the items emitted by the most recently emitted of these Publishers and delays any error until all Publishers terminate.

The resulting Publisher completes if both the upstream Publisher and the last inner Publisher, if any, complete. If the upstream Publisher signals an onError, the termination of the last inner Publisher will emit that error as is or wrapped into a CompositeException along with the other possible errors the former inner Publishers signalled.

Backpressure:
The operator honors backpressure from downstream. The outer Publisher is consumed in an unbounded manner (i.e., without backpressure) and the inner Publishers are expected to honor backpressure but it is not enforced; the operator won't signal a MissingBackpressureException but the violation may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
switchMapDelayError does not operate by default on a particular Scheduler.

Parameters
mapper a function that, when applied to an item emitted by the source Publisher, returns an Publisher
Returns
  • a Flowable that emits the items emitted by the Publisher returned from applying func to the most recently emitted item emitted by the source Publisher

public final Flowable<R> switchMapDelayError (Function<? super T, ? extends Publisher<? extends R>> mapper, int bufferSize)

Returns a new Publisher by applying a function that you supply to each item emitted by the source Publisher that returns a Publisher, and then emitting the items emitted by the most recently emitted of these Publishers and delays any error until all Publishers terminate.

The resulting Publisher completes if both the upstream Publisher and the last inner Publisher, if any, complete. If the upstream Publisher signals an onError, the termination of the last inner Publisher will emit that error as is or wrapped into a CompositeException along with the other possible errors the former inner Publishers signalled.

Backpressure:
The operator honors backpressure from downstream. The outer Publisher is consumed in an unbounded manner (i.e., without backpressure) and the inner Publishers are expected to honor backpressure but it is not enforced; the operator won't signal a MissingBackpressureException but the violation may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
switchMapDelayError does not operate by default on a particular Scheduler.

Parameters
mapper a function that, when applied to an item emitted by the source Publisher, returns an Publisher
bufferSize the number of elements to prefetch from the current active inner Publisher
Returns
  • a Flowable that emits the items emitted by the Publisher returned from applying func to the most recently emitted item emitted by the source Publisher

public static Flowable<T> switchOnNext (Publisher<? extends Publisher<? extends T>> sources, int bufferSize)

Converts a Publisher that emits Publishers into a Publisher that emits the items emitted by the most recently emitted of those Publishers.

switchOnNext subscribes to a Publisher that emits Publishers. Each time it observes one of these emitted Publishers, the Publisher returned by switchOnNext begins emitting the items emitted by that Publisher. When a new Publisher is emitted, switchOnNext stops emitting items from the earlier-emitted Publisher and begins emitting items from the new one.

The resulting Publisher completes if both the outer Publisher and the last inner Publisher, if any, complete. If the outer Publisher signals an onError, the inner Publisher is cancelled and the error delivered in-sequence.

Backpressure:
The operator honors backpressure from downstream. The outer Publisher is consumed in an unbounded manner (i.e., without backpressure) and the inner Publishers are expected to honor backpressure but it is not enforced; the operator won't signal a MissingBackpressureException but the violation may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
switchOnNext does not operate by default on a particular Scheduler.

Parameters
sources the source Publisher that emits Publishers
bufferSize the number of items to prefetch from the inner Publishers
Returns
  • a Flowable that emits the items emitted by the Publisher most recently emitted by the source Publisher

public static Flowable<T> switchOnNext (Publisher<? extends Publisher<? extends T>> sources)

Converts a Publisher that emits Publishers into a Publisher that emits the items emitted by the most recently emitted of those Publishers.

switchOnNext subscribes to a Publisher that emits Publishers. Each time it observes one of these emitted Publishers, the Publisher returned by switchOnNext begins emitting the items emitted by that Publisher. When a new Publisher is emitted, switchOnNext stops emitting items from the earlier-emitted Publisher and begins emitting items from the new one.

The resulting Publisher completes if both the outer Publisher and the last inner Publisher, if any, complete. If the outer Publisher signals an onError, the inner Publisher is cancelled and the error delivered in-sequence.

Backpressure:
The operator honors backpressure from downstream. The outer Publisher is consumed in an unbounded manner (i.e., without backpressure) and the inner Publishers are expected to honor backpressure but it is not enforced; the operator won't signal a MissingBackpressureException but the violation may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
switchOnNext does not operate by default on a particular Scheduler.

Parameters
sources the source Publisher that emits Publishers
Returns
  • a Flowable that emits the items emitted by the Publisher most recently emitted by the source Publisher

public static Flowable<T> switchOnNextDelayError (Publisher<? extends Publisher<? extends T>> sources, int prefetch)

Converts a Publisher that emits Publishers into a Publisher that emits the items emitted by the most recently emitted of those Publishers and delays any exception until all Publishers terminate.

switchOnNext subscribes to a Publisher that emits Publishers. Each time it observes one of these emitted Publishers, the Publisher returned by switchOnNext begins emitting the items emitted by that Publisher. When a new Publisher is emitted, switchOnNext stops emitting items from the earlier-emitted Publisher and begins emitting items from the new one.

The resulting Publisher completes if both the main Publisher and the last inner Publisher, if any, complete. If the main Publisher signals an onError, the termination of the last inner Publisher will emit that error as is or wrapped into a CompositeException along with the other possible errors the former inner Publishers signalled.

Backpressure:
The operator honors backpressure from downstream. The outer Publisher is consumed in an unbounded manner (i.e., without backpressure) and the inner Publishers are expected to honor backpressure but it is not enforced; the operator won't signal a MissingBackpressureException but the violation may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
switchOnNextDelayError does not operate by default on a particular Scheduler.

Parameters
sources the source Publisher that emits Publishers
prefetch the number of items to prefetch from the inner Publishers
Returns
  • a Flowable that emits the items emitted by the Publisher most recently emitted by the source Publisher

public static Flowable<T> switchOnNextDelayError (Publisher<? extends Publisher<? extends T>> sources)

Converts a Publisher that emits Publishers into a Publisher that emits the items emitted by the most recently emitted of those Publishers and delays any exception until all Publishers terminate.

switchOnNext subscribes to a Publisher that emits Publishers. Each time it observes one of these emitted Publishers, the Publisher returned by switchOnNext begins emitting the items emitted by that Publisher. When a new Publisher is emitted, switchOnNext stops emitting items from the earlier-emitted Publisher and begins emitting items from the new one.

The resulting Publisher completes if both the main Publisher and the last inner Publisher, if any, complete. If the main Publisher signals an onError, the termination of the last inner Publisher will emit that error as is or wrapped into a CompositeException along with the other possible errors the former inner Publishers signalled.

Backpressure:
The operator honors backpressure from downstream. The outer Publisher is consumed in an unbounded manner (i.e., without backpressure) and the inner Publishers are expected to honor backpressure but it is not enforced; the operator won't signal a MissingBackpressureException but the violation may lead to OutOfMemoryError due to internal buffer bloat.
Scheduler:
switchOnNextDelayError does not operate by default on a particular Scheduler.

Parameters
sources the source Publisher that emits Publishers
Returns
  • a Flowable that emits the items emitted by the Publisher most recently emitted by the source Publisher

public final Flowable<T> take (long time, TimeUnit unit)

Returns a Flowable that emits those items emitted by source Publisher before a specified time runs out.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
This version of take operates by default on the computation Scheduler.

Parameters
time the length of the time window
unit the time unit of time
Returns
  • a Flowable that emits those items emitted by the source Publisher before the time runs out

public final Flowable<T> take (long time, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits those items emitted by source Publisher before a specified time (on a specified Scheduler) runs out.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
You specify which Scheduler this operator will use

Parameters
time the length of the time window
unit the time unit of time
scheduler the Scheduler used for time source
Returns
  • a Flowable that emits those items emitted by the source Publisher before the time runs out, according to the specified Scheduler

public final Flowable<T> take (long count)

Returns a Flowable that emits only the first count items emitted by the source Publisher. If the source emits fewer than count items then all of its items are emitted.

This method returns a Publisher that will invoke a subscribing Subscriber's onNext function a maximum of count times before invoking onComplete.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior in case the first request is smaller than the count. Otherwise, the source Publisher is consumed in an unbounded manner (i.e., without applying backpressure to it).
Scheduler:
This version of take does not operate by default on a particular Scheduler.

Parameters
count the maximum number of items to emit
Returns
  • a Flowable that emits only the first count items emitted by the source Publisher, or all of the items from the source Publisher if that Publisher emits fewer than count items

public final Flowable<T> takeLast (long time, TimeUnit unit, boolean delayError)

Returns a Flowable that emits the items from the source Publisher that were emitted in a specified window of time before the Publisher completed.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it) but note that this may lead to OutOfMemoryError due to internal buffer bloat. Consider using takeLast(long, long, TimeUnit) in this case.
Scheduler:
This version of takeLast operates by default on the computation Scheduler.

Parameters
time the length of the time window
unit the time unit of time
delayError if true, an exception signalled by the current Flowable is delayed until the regular elements are consumed by the downstream; if false, an exception is immediately signalled and all regular elements dropped
Returns
  • a Flowable that emits the items from the source Publisher that were emitted in the window of time before the Publisher completed specified by time

public final Flowable<T> takeLast (long count, long time, TimeUnit unit, Scheduler scheduler, boolean delayError, int bufferSize)

Returns a Flowable that emits at most a specified number of items from the source Publisher that were emitted in a specified window of time before the Publisher completed, where the timing information is provided by a given Scheduler.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it).
Scheduler:
You specify which Scheduler this operator will use for tracking the current time

Parameters
count the maximum number of items to emit
time the length of the time window
unit the time unit of time
scheduler the Scheduler that provides the timestamps for the observed items
delayError if true, an exception signalled by the current Flowable is delayed until the regular elements are consumed by the downstream; if false, an exception is immediately signalled and all regular elements dropped
bufferSize the hint about how many elements to expect to be last
Returns
  • a Flowable that emits at most count items from the source Publisher that were emitted in a specified window of time before the Publisher completed, where the timing information is provided by the given scheduler
Throws
IndexOutOfBoundsException if count is less than zero

public final Flowable<T> takeLast (long time, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits the items from the source Publisher that were emitted in a specified window of time before the Publisher completed, where the timing information is provided by a specified Scheduler.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it) but note that this may lead to OutOfMemoryError due to internal buffer bloat. Consider using takeLast(long, long, TimeUnit, Scheduler) in this case.
Scheduler:
You specify which Scheduler this operator will use

Parameters
time the length of the time window
unit the time unit of time
scheduler the Scheduler that provides the timestamps for the Observed items
Returns
  • a Flowable that emits the items from the source Publisher that were emitted in the window of time before the Publisher completed specified by time, where the timing information is provided by scheduler

public final Flowable<T> takeLast (long time, TimeUnit unit, Scheduler scheduler, boolean delayError)

Returns a Flowable that emits the items from the source Publisher that were emitted in a specified window of time before the Publisher completed, where the timing information is provided by a specified Scheduler.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it) but note that this may lead to OutOfMemoryError due to internal buffer bloat. Consider using takeLast(long, long, TimeUnit, Scheduler) in this case.
Scheduler:
You specify which Scheduler this operator will use

Parameters
time the length of the time window
unit the time unit of time
scheduler the Scheduler that provides the timestamps for the Observed items
delayError if true, an exception signalled by the current Flowable is delayed until the regular elements are consumed by the downstream; if false, an exception is immediately signalled and all regular elements dropped
Returns
  • a Flowable that emits the items from the source Publisher that were emitted in the window of time before the Publisher completed specified by time, where the timing information is provided by scheduler

public final Flowable<T> takeLast (int count)

Returns a Flowable that emits at most the last count items emitted by the source Publisher. If the source emits fewer than count items then all of its items are emitted.

Backpressure:
The operator honors backpressure from downstream if the count is non-zero; ignores backpressure if the count is zero as it doesn't signal any values.
Scheduler:
This version of takeLast does not operate by default on a particular Scheduler.

Parameters
count the maximum number of items to emit from the end of the sequence of items emitted by the source Publisher
Returns
  • a Flowable that emits at most the last count items emitted by the source Publisher
Throws
IndexOutOfBoundsException if count is less than zero

public final Flowable<T> takeLast (long time, TimeUnit unit)

Returns a Flowable that emits the items from the source Publisher that were emitted in a specified window of time before the Publisher completed.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it) but note that this may lead to OutOfMemoryError due to internal buffer bloat. Consider using takeLast(long, long, TimeUnit) in this case.
Scheduler:
This version of takeLast operates by default on the computation Scheduler.

Parameters
time the length of the time window
unit the time unit of time
Returns
  • a Flowable that emits the items from the source Publisher that were emitted in the window of time before the Publisher completed specified by time

public final Flowable<T> takeLast (long count, long time, TimeUnit unit)

Returns a Flowable that emits at most a specified number of items from the source Publisher that were emitted in a specified window of time before the Publisher completed.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it).
Scheduler:
takeLast does not operate on any particular scheduler but uses the current time from the computation Scheduler.

Parameters
count the maximum number of items to emit
time the length of the time window
unit the time unit of time
Returns
  • a Flowable that emits at most count items from the source Publisher that were emitted in a specified window of time before the Publisher completed

public final Flowable<T> takeLast (long count, long time, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits at most a specified number of items from the source Publisher that were emitted in a specified window of time before the Publisher completed, where the timing information is provided by a given Scheduler.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it).
Scheduler:
You specify which Scheduler this operator will use for tracking the current time

Parameters
count the maximum number of items to emit
time the length of the time window
unit the time unit of time
scheduler the Scheduler that provides the timestamps for the observed items
Returns
  • a Flowable that emits at most count items from the source Publisher that were emitted in a specified window of time before the Publisher completed, where the timing information is provided by the given scheduler
Throws
IndexOutOfBoundsException if count is less than zero

public final Flowable<T> takeLast (long time, TimeUnit unit, Scheduler scheduler, boolean delayError, int bufferSize)

Returns a Flowable that emits the items from the source Publisher that were emitted in a specified window of time before the Publisher completed, where the timing information is provided by a specified Scheduler.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., no backpressure is applied to it) but note that this may lead to OutOfMemoryError due to internal buffer bloat. Consider using takeLast(long, long, TimeUnit, Scheduler) in this case.
Scheduler:
You specify which Scheduler this operator will use

Parameters
time the length of the time window
unit the time unit of time
scheduler the Scheduler that provides the timestamps for the Observed items
delayError if true, an exception signalled by the current Flowable is delayed until the regular elements are consumed by the downstream; if false, an exception is immediately signalled and all regular elements dropped
bufferSize the hint about how many elements to expect to be last
Returns
  • a Flowable that emits the items from the source Publisher that were emitted in the window of time before the Publisher completed specified by time, where the timing information is provided by scheduler

public final Flowable<T> takeUntil (Publisher<U> other)

Returns a Flowable that emits the items emitted by the source Publisher until a second Publisher emits an item.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
takeUntil does not operate by default on a particular Scheduler.

Parameters
other the Publisher whose first emitted item will cause takeUntil to stop emitting items from the source Publisher
Returns
  • a Flowable that emits the items emitted by the source Publisher until such time as other emits its first item

public final Flowable<T> takeUntil (Predicate<? super T> stopPredicate)

Returns a Flowable that emits items emitted by the source Publisher, checks the specified predicate for each item, and then completes when the condition is satisfied.

The difference between this operator and takeWhile(Predicate) is that here, the condition is evaluated after the item is emitted.

Backpressure:
The operator is a pass-through for backpressure; the backpressure behavior is determined by the upstream source and the downstream consumer.
Scheduler:
takeUntil does not operate by default on a particular Scheduler.

Parameters
stopPredicate a function that evaluates an item emitted by the source Publisher and returns a Boolean
Returns
  • a Flowable that first emits items emitted by the source Publisher, checks the specified condition after each item, and then completes when the condition is satisfied.

public final Flowable<T> takeWhile (Predicate<? super T> predicate)

Returns a Flowable that emits items emitted by the source Publisher so long as each item satisfied a specified condition, and then completes as soon as this condition is not satisfied.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
takeWhile does not operate by default on a particular Scheduler.

Parameters
predicate a function that evaluates an item emitted by the source Publisher and returns a Boolean
Returns
  • a Flowable that emits the items from the source Publisher so long as each item satisfies the condition defined by predicate, then completes

public final TestSubscriber<T> test (long initialRequest)

Creates a TestSubscriber with the given initial request amount and subscribes it to this Flowable.

Backpressure:
The returned TestSubscriber requests the given initialRequest amount upfront.
Scheduler:
test does not operate by default on a particular Scheduler.

Parameters
initialRequest the initial request amount, positive
Returns
  • the new TestSubscriber instance

public final TestSubscriber<T> test ()

Creates a TestSubscriber that requests Long.MAX_VALUE and subscribes it to this Flowable.

Backpressure:
The returned TestSubscriber consumes this Flowable in an unbounded fashion.
Scheduler:
test does not operate by default on a particular Scheduler.

Returns
  • the new TestSubscriber instance

public final TestSubscriber<T> test (long initialRequest, boolean cancel)

Creates a TestSubscriber with the given initial request amount, optionally cancels it before the subscription and subscribes it to this Flowable.

Backpressure:
The returned TestSubscriber requests the given initialRequest amount upfront.
Scheduler:
test does not operate by default on a particular Scheduler.

Parameters
initialRequest the initial request amount, positive
cancel should the TestSubscriber be cancelled before the subscription?
Returns
  • the new TestSubscriber instance

public final Flowable<T> throttleFirst (long windowDuration, TimeUnit unit)

Returns a Flowable that emits only the first item emitted by the source Publisher during sequential time windows of a specified duration.

This differs from throttleLast(long, TimeUnit) in that this only tracks passage of time whereas throttleLast(long, TimeUnit) ticks at scheduled intervals.

Backpressure:
This operator does not support backpressure as it uses time to control data flow.
Scheduler:
throttleFirst operates by default on the computation Scheduler.

Parameters
windowDuration time to wait before emitting another item after emitting the last item
unit the unit of time of windowDuration
Returns
  • a Flowable that performs the throttle operation

public final Flowable<T> throttleFirst (long skipDuration, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits only the first item emitted by the source Publisher during sequential time windows of a specified duration, where the windows are managed by a specified Scheduler.

This differs from throttleLast(long, TimeUnit) in that this only tracks passage of time whereas throttleLast(long, TimeUnit) ticks at scheduled intervals.

Backpressure:
This operator does not support backpressure as it uses time to control data flow.
Scheduler:
You specify which Scheduler this operator will use

Parameters
skipDuration time to wait before emitting another item after emitting the last item
unit the unit of time of skipDuration
scheduler the Scheduler to use internally to manage the timers that handle timeout for each event
Returns
  • a Flowable that performs the throttle operation

public final Flowable<T> throttleLast (long intervalDuration, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits only the last item emitted by the source Publisher during sequential time windows of a specified duration, where the duration is governed by a specified Scheduler.

This differs from throttleFirst(long, TimeUnit) in that this ticks along at a scheduled interval whereas throttleFirst(long, TimeUnit) does not tick, it just tracks passage of time.

Backpressure:
This operator does not support backpressure as it uses time to control data flow.
Scheduler:
You specify which Scheduler this operator will use

Parameters
intervalDuration duration of windows within which the last item emitted by the source Publisher will be emitted
unit the unit of time of intervalDuration
scheduler the Scheduler to use internally to manage the timers that handle timeout for each event
Returns
  • a Flowable that performs the throttle operation

public final Flowable<T> throttleLast (long intervalDuration, TimeUnit unit)

Returns a Flowable that emits only the last item emitted by the source Publisher during sequential time windows of a specified duration.

This differs from throttleFirst(long, TimeUnit) in that this ticks along at a scheduled interval whereas throttleFirst(long, TimeUnit) does not tick, it just tracks passage of time.

Backpressure:
This operator does not support backpressure as it uses time to control data flow.
Scheduler:
throttleLast operates by default on the computation Scheduler.

Parameters
intervalDuration duration of windows within which the last item emitted by the source Publisher will be emitted
unit the unit of time of intervalDuration
Returns
  • a Flowable that performs the throttle operation

public final Flowable<T> throttleWithTimeout (long timeout, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that only emits those items emitted by the source Publisher that are not followed by another emitted item within a specified time window, where the time window is governed by a specified Scheduler.

Note: If the source Publisher keeps emitting items more frequently than the length of the time window then no items will be emitted by the resulting Publisher.

Information on debounce vs throttle:

Backpressure:
This operator does not support backpressure as it uses time to control data flow.
Scheduler:
You specify which Scheduler this operator will use

Parameters
timeout the length of the window of time that must pass after the emission of an item from the source Publisher in which that Publisher emits no items in order for the item to be emitted by the resulting Publisher
unit the TimeUnit of timeout
scheduler the Scheduler to use internally to manage the timers that handle the timeout for each item
Returns
  • a Flowable that filters out items that are too quickly followed by newer items

public final Flowable<T> throttleWithTimeout (long timeout, TimeUnit unit)

Returns a Flowable that only emits those items emitted by the source Publisher that are not followed by another emitted item within a specified time window.

Note: If the source Publisher keeps emitting items more frequently than the length of the time window then no items will be emitted by the resulting Publisher.

Information on debounce vs throttle:

Backpressure:
This operator does not support backpressure as it uses time to control data flow.
Scheduler:
throttleWithTimeout operates by default on the computation Scheduler.

Parameters
timeout the length of the window of time that must pass after the emission of an item from the source Publisher in which that Publisher emits no items in order for the item to be emitted by the resulting Publisher
unit the TimeUnit of timeout
Returns
  • a Flowable that filters out items that are too quickly followed by newer items

public final Flowable<Timed<T>> timeInterval (Scheduler scheduler)

Returns a Flowable that emits records of the time interval between consecutive items emitted by the source Publisher, where this interval is computed on a specified Scheduler.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
The operator does not operate on any particular scheduler but uses the current time from the specified Scheduler.

Parameters
scheduler the Scheduler used to compute time intervals
Returns
  • a Flowable that emits time interval information items

public final Flowable<Timed<T>> timeInterval (TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits records of the time interval between consecutive items emitted by the source Publisher, where this interval is computed on a specified Scheduler.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
The operator does not operate on any particular scheduler but uses the current time from the specified Scheduler.

Parameters
unit the time unit for the current time
scheduler the Scheduler used to compute time intervals
Returns
  • a Flowable that emits time interval information items

public final Flowable<Timed<T>> timeInterval ()

Returns a Flowable that emits records of the time interval between consecutive items emitted by the source Publisher.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
timeInterval does not operate on any particular scheduler but uses the current time from the computation Scheduler.

Returns
  • a Flowable that emits time interval information items

public final Flowable<Timed<T>> timeInterval (TimeUnit unit)

Returns a Flowable that emits records of the time interval between consecutive items emitted by the source Publisher.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
timeInterval does not operate on any particular scheduler but uses the current time from the computation Scheduler.

Parameters
unit the time unit for the current time
Returns
  • a Flowable that emits time interval information items

public final Flowable<T> timeout (Function<? super T, ? extends Publisher<V>> itemTimeoutIndicator)

Returns a Flowable that mirrors the source Publisher, but notifies Subscribers of a TimeoutException if an item emitted by the source Publisher doesn't arrive within a window of time after the emission of the previous item, where that period of time is measured by a Publisher that is a function of the previous item.

Note: The arrival of the first source item is never timed out.

Backpressure:
The operator honors backpressure from downstream. The Publisher sources are expected to honor backpressure as well. If any of the source Publishers violate this, it may throw an IllegalStateException when the source Publisher completes.
Scheduler:
This version of timeout operates by default on the immediate Scheduler.

Parameters
itemTimeoutIndicator a function that returns a Publisher for each item emitted by the source Publisher and that determines the timeout window for the subsequent item
Returns
  • a Flowable that mirrors the source Publisher, but notifies Subscribers of a TimeoutException if an item emitted by the source Publisher takes longer to arrive than the time window defined by the selector for the previously emitted item

public final Flowable<T> timeout (Publisher<U> firstTimeoutIndicator, Function<? super T, ? extends Publisher<V>> itemTimeoutIndicator)

Returns a Flowable that mirrors the source Publisher, but notifies Subscribers of a TimeoutException if either the first item emitted by the source Publisher or any subsequent item doesn't arrive within time windows defined by other Publishers.

Backpressure:
The operator honors backpressure from downstream. Both this and the returned Publishers are expected to honor backpressure as well. If any of then violates this rule, it may throw an IllegalStateException when the Publisher completes.
Scheduler:
timeout does not operates by default on any Scheduler.

Parameters
firstTimeoutIndicator a function that returns a Publisher that determines the timeout window for the first source item
itemTimeoutIndicator a function that returns a Publisher for each item emitted by the source Publisher and that determines the timeout window in which the subsequent source item must arrive in order to continue the sequence
Returns
  • a Flowable that mirrors the source Publisher, but notifies Subscribers of a TimeoutException if either the first item or any subsequent item doesn't arrive within the time windows specified by the timeout selectors

public final Flowable<T> timeout (long timeout, TimeUnit timeUnit)

Returns a Flowable that mirrors the source Publisher but applies a timeout policy for each emitted item. If the next item isn't emitted within the specified timeout duration starting from its predecessor, the resulting Publisher terminates and notifies Subscribers of a TimeoutException.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
This version of timeout operates by default on the computation Scheduler.

Parameters
timeout maximum duration between emitted items before a timeout occurs
timeUnit the unit of time that applies to the timeout argument.
Returns
  • the source Publisher modified to notify Subscribers of a TimeoutException in case of a timeout

public final Flowable<T> timeout (Publisher<U> firstTimeoutIndicator, Function<? super T, ? extends Publisher<V>> itemTimeoutIndicator, Publisher<? extends T> other)

Returns a Flowable that mirrors the source Publisher, but switches to a fallback Publisher if either the first item emitted by the source Publisher or any subsequent item doesn't arrive within time windows defined by other Publishers.

Backpressure:
The operator honors backpressure from downstream. The Publisher sources are expected to honor backpressure as well. If any of the source Publishers violate this, it may throw an IllegalStateException when the source Publisher completes.
Scheduler:
timeout does not operates by default on any Scheduler.

Parameters
firstTimeoutIndicator a function that returns a Publisher which determines the timeout window for the first source item
itemTimeoutIndicator a function that returns a Publisher for each item emitted by the source Publisher and that determines the timeout window in which the subsequent source item must arrive in order to continue the sequence
other the fallback Publisher to switch to if the source Publisher times out
Returns
  • a Flowable that mirrors the source Publisher, but switches to the other Publisher if either the first item emitted by the source Publisher or any subsequent item doesn't arrive within time windows defined by the timeout selectors
Throws
NullPointerException if itemTimeoutIndicator is null

public final Flowable<T> timeout (Function<? super T, ? extends Publisher<V>> itemTimeoutIndicator, Flowable<? extends T> other)

Returns a Flowable that mirrors the source Publisher, but that switches to a fallback Publisher if an item emitted by the source Publisher doesn't arrive within a window of time after the emission of the previous item, where that period of time is measured by a Publisher that is a function of the previous item.

Note: The arrival of the first source item is never timed out.

Backpressure:
The operator honors backpressure from downstream. The Publisher sources are expected to honor backpressure as well. If any of the source Publishers violate this, it may throw an IllegalStateException when the source Publisher completes.
Scheduler:
This version of timeout operates by default on the immediate Scheduler.

Parameters
itemTimeoutIndicator a function that returns a Publisher, for each item emitted by the source Publisher, that determines the timeout window for the subsequent item
other the fallback Publisher to switch to if the source Publisher times out
Returns
  • a Flowable that mirrors the source Publisher, but switches to mirroring a fallback Publisher if an item emitted by the source Publisher takes longer to arrive than the time window defined by the selector for the previously emitted item

public final Flowable<T> timeout (long timeout, TimeUnit timeUnit, Publisher<? extends T> other)

Returns a Flowable that mirrors the source Publisher but applies a timeout policy for each emitted item. If the next item isn't emitted within the specified timeout duration starting from its predecessor, the resulting Publisher begins instead to mirror a fallback Publisher.

Backpressure:
The operator honors backpressure from downstream. The Publisher sources are expected to honor backpressure as well. If any of the source Publishers violate this, it may throw an IllegalStateException when the source Publisher completes.
Scheduler:
This version of timeout operates by default on the computation Scheduler.

Parameters
timeout maximum duration between items before a timeout occurs
timeUnit the unit of time that applies to the timeout argument
other the fallback Publisher to use in case of a timeout
Returns
  • the source Publisher modified to switch to the fallback Publisher in case of a timeout

public final Flowable<T> timeout (long timeout, TimeUnit timeUnit, Scheduler scheduler, Publisher<? extends T> other)

Returns a Flowable that mirrors the source Publisher but applies a timeout policy for each emitted item using a specified Scheduler. If the next item isn't emitted within the specified timeout duration starting from its predecessor, the resulting Publisher begins instead to mirror a fallback Publisher.

Backpressure:
The operator honors backpressure from downstream. The Publisher sources are expected to honor backpressure as well. If any of the source Publishers violate this, it may throw an IllegalStateException when the source Publisher completes.
Scheduler:
You specify which Scheduler this operator will use

Parameters
timeout maximum duration between items before a timeout occurs
timeUnit the unit of time that applies to the timeout argument
scheduler the Scheduler to run the timeout timers on
other the Publisher to use as the fallback in case of a timeout
Returns
  • the source Publisher modified so that it will switch to the fallback Publisher in case of a timeout

public final Flowable<T> timeout (long timeout, TimeUnit timeUnit, Scheduler scheduler)

Returns a Flowable that mirrors the source Publisher but applies a timeout policy for each emitted item, where this policy is governed on a specified Scheduler. If the next item isn't emitted within the specified timeout duration starting from its predecessor, the resulting Publisher terminates and notifies Subscribers of a TimeoutException.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
You specify which Scheduler this operator will use

Parameters
timeout maximum duration between items before a timeout occurs
timeUnit the unit of time that applies to the timeout argument
scheduler the Scheduler to run the timeout timers on
Returns
  • the source Publisher modified to notify Subscribers of a TimeoutException in case of a timeout

public static Flowable<Long> timer (long delay, TimeUnit unit)

Returns a Flowable that emits 0L after a specified delay, and then completes.

Backpressure:
This operator does not support backpressure as it uses time. If the downstream needs a slower rate it should slow the timer or use something like onBackpressureDrop().
Scheduler:
timer operates by default on the computation Scheduler.

Parameters
delay the initial delay before emitting a single 0L
unit time units to use for delay
Returns
  • a Flowable that emits 0L after a specified delay, and then completes

public static Flowable<Long> timer (long delay, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits 0L after a specified delay, on a specified Scheduler, and then completes.

Backpressure:
This operator does not support backpressure as it uses time. If the downstream needs a slower rate it should slow the timer or use something like onBackpressureDrop().
Scheduler:
You specify which Scheduler this operator will use

Parameters
delay the initial delay before emitting a single 0L
unit time units to use for delay
scheduler the Scheduler to use for scheduling the item
Returns
  • a Flowable that emits 0L after a specified delay, on a specified Scheduler, and then completes

public final Flowable<Timed<T>> timestamp (TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits each item emitted by the source Publisher, wrapped in a Timed object whose timestamps are provided by a specified Scheduler.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
This operator does not operate on any particular scheduler but uses the current time from the specified Scheduler.

Parameters
unit the time unit for the current time
scheduler the Scheduler to use as a time source
Returns
  • a Flowable that emits timestamped items from the source Publisher with timestamps provided by the scheduler

public final Flowable<Timed<T>> timestamp ()

Returns a Flowable that emits each item emitted by the source Publisher, wrapped in a Timed object.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
timestamp does not operate on any particular scheduler but uses the current time from the computation Scheduler.

Returns
  • a Flowable that emits timestamped items from the source Publisher

public final Flowable<Timed<T>> timestamp (Scheduler scheduler)

Returns a Flowable that emits each item emitted by the source Publisher, wrapped in a Timed object whose timestamps are provided by a specified Scheduler.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
This operator does not operate on any particular scheduler but uses the current time from the specified Scheduler.

Parameters
scheduler the Scheduler to use as a time source
Returns
  • a Flowable that emits timestamped items from the source Publisher with timestamps provided by the scheduler

public final Flowable<Timed<T>> timestamp (TimeUnit unit)

Returns a Flowable that emits each item emitted by the source Publisher, wrapped in a Timed object.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
timestamp does not operate on any particular scheduler but uses the current time from the computation Scheduler.

Parameters
unit the time unit for the current time
Returns
  • a Flowable that emits timestamped items from the source Publisher

public final R to (Function<? super Flowable<T>, R> converter)

Calls the specified converter function during assembly time and returns its resulting value.

This allows fluent conversion to any other type.

Backpressure:
The backpressure behavior depends on what happens in the converter function.
Scheduler:
to does not operate by default on a particular Scheduler.

Parameters
converter the function that receives the current Flowable instance and returns a value
Returns
  • the value returned by the function

public final Future<T> toFuture ()

Returns a Future representing the single value emitted by this Flowable.

If the Flowable emits more than one item, Future will receive an IllegalArgumentException. If the Flowable is empty, Future will receive an NoSuchElementException.

If the Flowable may emit more than one item, use Flowable.toList().toFuture().

Backpressure:
The operator consumes the source Flowable in an unbounded manner (i.e., no backpressure applied to it).
Scheduler:
toFuture does not operate by default on a particular Scheduler.

Returns
  • a Future that expects a single item to be emitted by this Flowable

public final Single<U> toList (Callable<U> collectionSupplier)

Returns a Single that emits a single item, a list composed of all the items emitted by the finite source Publisher.

Normally, a Publisher that returns multiple items will do so by invoking its Subscriber's onNext method for each such item. You can change this behavior, instructing the Publisher to compose a list of all of these items and then to invoke the Subscriber's onNext function once, passing it the entire list, by calling the Publisher's toList method prior to calling its subscribe() method.

Note that this operator requires the upstream to signal onComplete for the accumulated collection to be emitted. Sources that are infinite and never complete will never emit anything through this operator and an infinite source may lead to a fatal OutOfMemoryError.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure to it).
Scheduler:
toList does not operate by default on a particular Scheduler.

Parameters
collectionSupplier the Callable returning the collection (for each individual Subscriber) to be filled in
Returns
  • a Single that emits a single item: a List containing all of the items emitted by the source Publisher

public final Single<List<T>> toList ()

Returns a Single that emits a single item, a list composed of all the items emitted by the finite upstream source Publisher.

Normally, a Publisher that returns multiple items will do so by invoking its Subscriber's onNext method for each such item. You can change this behavior, instructing the Publisher to compose a list of all of these items and then to invoke the Subscriber's onNext function once, passing it the entire list, by calling the Publisher's toList method prior to calling its subscribe() method.

Note that this operator requires the upstream to signal onComplete for the accumulated list to be emitted. Sources that are infinite and never complete will never emit anything through this operator and an infinite source may lead to a fatal OutOfMemoryError.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure to it).
Scheduler:
toList does not operate by default on a particular Scheduler.

Returns
  • a Single that emits a single item: a List containing all of the items emitted by the source Publisher

public final Single<List<T>> toList (int capacityHint)

Returns a Single that emits a single item, a list composed of all the items emitted by the finite source Publisher.

Normally, a Publisher that returns multiple items will do so by invoking its Subscriber's onNext method for each such item. You can change this behavior, instructing the Publisher to compose a list of all of these items and then to invoke the Subscriber's onNext function once, passing it the entire list, by calling the Publisher's toList method prior to calling its subscribe() method.

Note that this operator requires the upstream to signal onComplete for the accumulated list to be emitted. Sources that are infinite and never complete will never emit anything through this operator and an infinite source may lead to a fatal OutOfMemoryError.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure to it).
Scheduler:
toList does not operate by default on a particular Scheduler.

Parameters
capacityHint the number of elements expected from the current Flowable
Returns
  • a Flowable that emits a single item: a List containing all of the items emitted by the source Publisher

public final Single<Map<K, T>> toMap (Function<? super T, ? extends K> keySelector)

Returns a Single that emits a single HashMap containing all items emitted by the source Publisher, mapped by the keys returned by a specified keySelector function.

If more than one source item maps to the same key, the HashMap will contain the latest of those items.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure to it).
Scheduler:
toMap does not operate by default on a particular Scheduler.

Parameters
keySelector the function that extracts the key from a source item to be used in the HashMap
Returns
  • a Single that emits a single item: a HashMap containing the mapped items from the source Publisher

public final Single<Map<K, V>> toMap (Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector, Callable<? extends Map<K, V>> mapSupplier)

Returns a Single that emits a single Map, returned by a specified mapFactory function, that contains keys and values extracted from the items emitted by the source Publisher.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure to it).
Scheduler:
toMap does not operate by default on a particular Scheduler.

Parameters
keySelector the function that extracts the key from a source item to be used in the Map
valueSelector the function that extracts the value from the source items to be used as value in the Map
mapSupplier the function that returns a Map instance to be used
Returns
  • a Flowable that emits a single item: a Map that contains the mapped items emitted by the source Publisher

public final Single<Map<K, V>> toMap (Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector)

Returns a Single that emits a single HashMap containing values corresponding to items emitted by the source Publisher, mapped by the keys returned by a specified keySelector function.

If more than one source item maps to the same key, the HashMap will contain a single entry that corresponds to the latest of those items.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure to it).
Scheduler:
toMap does not operate by default on a particular Scheduler.

Parameters
keySelector the function that extracts the key from a source item to be used in the HashMap
valueSelector the function that extracts the value from a source item to be used in the HashMap
Returns
  • a Single that emits a single item: a HashMap containing the mapped items from the source Publisher

public final Single<Map<K, Collection<T>>> toMultimap (Function<? super T, ? extends K> keySelector)

Returns a Single that emits a single HashMap that contains an ArrayList of items emitted by the source Publisher keyed by a specified keySelector function.

Backpressure:
This operator does not support backpressure as by intent it is requesting and buffering everything.
Scheduler:
toMultimap does not operate by default on a particular Scheduler.

Parameters
keySelector the function that extracts the key from the source items to be used as key in the HashMap
Returns
  • a Single that emits a single item: a HashMap that contains an ArrayList of items mapped from the source Publisher

public final Single<Map<K, Collection<V>>> toMultimap (Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector, Callable<Map<K, Collection<V>>> mapSupplier)

Returns a Single that emits a single Map, returned by a specified mapFactory function, that contains an ArrayList of values, extracted by a specified valueSelector function from items emitted by the source Publisher and keyed by the keySelector function.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure to it).
Scheduler:
toMultimap does not operate by default on a particular Scheduler.

Parameters
keySelector the function that extracts a key from the source items to be used as the key in the Map
valueSelector the function that extracts a value from the source items to be used as the value in the Map
mapSupplier the function that returns a Map instance to be used
Returns
  • a Single that emits a single item: a Map that contains a list items mapped from the source Publisher

public final Single<Map<K, Collection<V>>> toMultimap (Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector)

Returns a Single that emits a single HashMap that contains an ArrayList of values extracted by a specified valueSelector function from items emitted by the source Publisher, keyed by a specified keySelector function.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure to it).
Scheduler:
toMultimap does not operate by default on a particular Scheduler.

Parameters
keySelector the function that extracts a key from the source items to be used as key in the HashMap
valueSelector the function that extracts a value from the source items to be used as value in the HashMap
Returns
  • a Single that emits a single item: a HashMap that contains an ArrayList of items mapped from the source Publisher

public final Single<Map<K, Collection<V>>> toMultimap (Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector, Callable<? extends Map<K, Collection<V>>> mapSupplier, Function<? super K, ? extends Collection<? super V>> collectionFactory)

Returns a Single that emits a single Map, returned by a specified mapFactory function, that contains a custom collection of values, extracted by a specified valueSelector function from items emitted by the source Publisher, and keyed by the keySelector function.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure to it).
Scheduler:
toMultimap does not operate by default on a particular Scheduler.

Parameters
keySelector the function that extracts a key from the source items to be used as the key in the Map
valueSelector the function that extracts a value from the source items to be used as the value in the Map
mapSupplier the function that returns a Map instance to be used
collectionFactory the function that returns a Collection instance for a particular key to be used in the Map
Returns
  • a Single that emits a single item: a Map that contains the collection of mapped items from the source Publisher

public final Observable<T> toObservable ()

Converts the current Flowable into a non-backpressured Observable.

Backpressure:
Observables don't support backpressure thus the current Flowable is consumed in an unbounded manner (by requesting Long.MAX_VALUE).
Scheduler:
toObservable does not operate by default on a particular Scheduler.

Returns
  • the new Observable instance

public final Single<List<T>> toSortedList (Comparator<? super T> comparator, int capacityHint)

Returns a Single that emits a list that contains the items emitted by the source Publisher, in a sorted order based on a specified comparison function.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure to it).
Scheduler:
toSortedList does not operate by default on a particular Scheduler.

Parameters
comparator a function that compares two items emitted by the source Publisher and returns an Integer that indicates their sort order
capacityHint the initial capacity of the ArrayList used to accumulate items before sorting
Returns
  • a Single that emits a list that contains the items emitted by the source Publisher in sorted order

public final Single<List<T>> toSortedList (Comparator<? super T> comparator)

Returns a Single that emits a list that contains the items emitted by the source Publisher, in a sorted order based on a specified comparison function.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure to it).
Scheduler:
toSortedList does not operate by default on a particular Scheduler.

Parameters
comparator a function that compares two items emitted by the source Publisher and returns an Integer that indicates their sort order
Returns
  • a Single that emits a list that contains the items emitted by the source Publisher in sorted order

public final Single<List<T>> toSortedList ()

Returns a Single that emits a list that contains the items emitted by the source Publisher, in a sorted order. Each item emitted by the Publisher must implement Comparable with respect to all other items in the sequence.

If any item emitted by this Flowable does not implement Comparable with respect to all other items emitted by this Flowable, no items will be emitted and the sequence is terminated with a ClassCastException.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure to it).
Scheduler:
toSortedList does not operate by default on a particular Scheduler.

Returns
  • a Single that emits a list that contains the items emitted by the source Publisher in sorted order

public final Single<List<T>> toSortedList (int capacityHint)

Returns a Flowable that emits a list that contains the items emitted by the source Publisher, in a sorted order. Each item emitted by the Publisher must implement Comparable with respect to all other items in the sequence.

If any item emitted by this Flowable does not implement Comparable with respect to all other items emitted by this Flowable, no items will be emitted and the sequence is terminated with a ClassCastException.

Backpressure:
The operator honors backpressure from downstream and consumes the source Publisher in an unbounded manner (i.e., without applying backpressure to it).
Scheduler:
toSortedList does not operate by default on a particular Scheduler.

Parameters
capacityHint the initial capacity of the ArrayList used to accumulate items before sorting
Returns
  • a Flowable that emits a list that contains the items emitted by the source Publisher in sorted order

public static Flowable<T> unsafeCreate (Publisher<T> onSubscribe)

Create a Flowable by wrapping a Publisher which has to be implemented according to the Reactive-Streams specification by handling backpressure and cancellation correctly; no safeguards are provided by the Flowable itself.

Backpressure:
This operator is a pass-through for backpressure and the behavior is determined by the provided Publisher implementation.
Scheduler:
unsafeCreate by default doesn't operate on any particular Scheduler.

Parameters
onSubscribe the Publisher instance to wrap
Returns
  • the new Flowable instance
Throws
IllegalArgumentException if onSubscribe is a subclass of Flowable; such instances don't need conversion and is possibly a port remnant from 1.x or one should use hide() instead.

public final Flowable<T> unsubscribeOn (Scheduler scheduler)

Modifies the source Publisher so that subscribers will cancel it on a specified Scheduler.

Backpressure:
The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior.
Scheduler:
You specify which Scheduler this operator will use

Parameters
scheduler the Scheduler to perform cancellation actions on
Returns
  • the source Publisher modified so that its cancellations happen on the specified Scheduler

public static Flowable<T> using (Callable<? extends D> resourceSupplier, Function<? super D, ? extends Publisher<? extends T>> sourceSupplier, Consumer<? super D> resourceDisposer)

Constructs a Publisher that creates a dependent resource object which is disposed of on cancellation.

Backpressure:
The operator is a pass-through for backpressure and otherwise depends on the backpressure support of the Publisher returned by the resourceFactory.
Scheduler:
using does not operate by default on a particular Scheduler.

Parameters
resourceSupplier the factory function to create a resource object that depends on the Publisher
sourceSupplier the factory function to create a Publisher
resourceDisposer the function that will dispose of the resource
Returns
  • the Publisher whose lifetime controls the lifetime of the dependent resource object

public static Flowable<T> using (Callable<? extends D> resourceSupplier, Function<? super D, ? extends Publisher<? extends T>> sourceSupplier, Consumer<? super D> resourceDisposer, boolean eager)

Constructs a Publisher that creates a dependent resource object which is disposed of just before termination if you have set disposeEagerly to true and cancellation does not occur before termination. Otherwise resource disposal will occur on cancellation. Eager disposal is particularly appropriate for a synchronous Publisher that reuses resources. disposeAction will only be called once per subscription.

Backpressure:
The operator is a pass-through for backpressure and otherwise depends on the backpressure support of the Publisher returned by the resourceFactory.
Scheduler:
using does not operate by default on a particular Scheduler.

Parameters
resourceSupplier the factory function to create a resource object that depends on the Publisher
sourceSupplier the factory function to create a Publisher
resourceDisposer the function that will dispose of the resource
eager if true then disposal will happen either on cancellation or just before emission of a terminal event (onComplete or onError).
Returns
  • the Publisher whose lifetime controls the lifetime of the dependent resource object

public final Flowable<Flowable<T>> window (Publisher<U> openingIndicator, Function<? super U, ? extends Publisher<V>> closingIndicator)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher emits windows that contain those items emitted by the source Publisher between the time when the windowOpenings Publisher emits an item and when the Publisher returned by closingSelector emits an item.

Backpressure:
The outer Publisher of this operator doesn't support backpressure because the emission of new inner Publishers are controlled by the windowOpenings Publisher. The inner Publishers honor backpressure and buffer everything until the associated closing Publisher signals or completes.
Scheduler:
This version of window does not operate by default on a particular Scheduler.

Parameters
openingIndicator a Publisher that, when it emits an item, causes another window to be created
closingIndicator a Function that produces a Publisher for every window created. When this Publisher emits an item, the associated window is closed and emitted
Returns
  • a Flowable that emits windows of items emitted by the source Publisher that are governed by the specified window-governing Publishers

public final Flowable<Flowable<T>> window (long timespan, long timeskip, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher starts a new window periodically, as determined by the timeskip argument. It emits each window after a fixed timespan, specified by the timespan argument. When the source Publisher completes or Publisher completes or encounters an error, the resulting Publisher emits the current window and propagates the notification from the source Publisher.

Backpressure:
The operator consumes the source Publisher in an unbounded manner. The returned Publisher doesn't support backpressure as it uses time to control the creation of windows. The returned inner Publishers honor backpressure but have an unbounded inner buffer that may lead to OutOfMemoryError if left unconsumed.
Scheduler:
You specify which Scheduler this operator will use

Parameters
timespan the period of time each window collects items before it should be emitted
timeskip the period of time after which a new window will be created
unit the unit of time that applies to the timespan and timeskip arguments
scheduler the Scheduler to use when determining the end and start of a window
Returns
  • a Flowable that emits new windows periodically as a fixed timespan elapses

public final Flowable<Flowable<T>> window (long timespan, TimeUnit unit, Scheduler scheduler, long count, boolean restart)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping windows, each of a fixed duration specified by the timespan argument or a maximum size specified by the count argument (whichever is reached first). When the source Publisher completes or encounters an error, the resulting Publisher emits the current window and propagates the notification from the source Publisher.

Backpressure:
The operator consumes the source Publisher in an unbounded manner. The returned Publisher doesn't support backpressure as it uses time to control the creation of windows. The returned inner Publishers honor backpressure and may hold up to count elements at most.
Scheduler:
You specify which Scheduler this operator will use

Parameters
timespan the period of time each window collects items before it should be emitted and replaced with a new window
unit the unit of time which applies to the timespan argument
scheduler the Scheduler to use when determining the end and start of a window
count the maximum size of each window before it should be emitted
restart if true, when a window reaches the capacity limit, the timer is restarted as well
Returns
  • a Flowable that emits connected, non-overlapping windows of items from the source Publisher that were emitted during a fixed duration of time or when the window has reached maximum capacity (whichever occurs first)

public final Flowable<Flowable<T>> window (long timespan, TimeUnit unit, Scheduler scheduler, long count, boolean restart, int bufferSize)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping windows, each of a fixed duration specified by the timespan argument or a maximum size specified by the count argument (whichever is reached first). When the source Publisher completes or encounters an error, the resulting Publisher emits the current window and propagates the notification from the source Publisher.

Backpressure:
The operator consumes the source Publisher in an unbounded manner. The returned Publisher doesn't support backpressure as it uses time to control the creation of windows. The returned inner Publishers honor backpressure and may hold up to count elements at most.
Scheduler:
You specify which Scheduler this operator will use

Parameters
timespan the period of time each window collects items before it should be emitted and replaced with a new window
unit the unit of time which applies to the timespan argument
scheduler the Scheduler to use when determining the end and start of a window
count the maximum size of each window before it should be emitted
restart if true, when a window reaches the capacity limit, the timer is restarted as well
bufferSize the capacity hint for the buffer in the inner windows
Returns
  • a Flowable that emits connected, non-overlapping windows of items from the source Publisher that were emitted during a fixed duration of time or when the window has reached maximum capacity (whichever occurs first)

public final Flowable<Flowable<T>> window (Callable<? extends Publisher<B>> boundaryIndicatorSupplier, int bufferSize)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping windows. It emits the current window and opens a new one whenever the Publisher produced by the specified closingSelector emits an item.

Backpressure:
The operator consumes the source Publisher in an unbounded manner. The returned Publisher doesn't support backpressure as it uses the closingSelector to control the creation of windows. The returned inner Publishers honor backpressure but have an unbounded inner buffer that may lead to OutOfMemoryError if left unconsumed.
Scheduler:
This version of window does not operate by default on a particular Scheduler.

Parameters
boundaryIndicatorSupplier a Callable that returns a Publisher that governs the boundary between windows. When the source Publisher emits an item, window emits the current window and begins a new one.
bufferSize the capacity hint for the buffer in the inner windows
Returns
  • a Flowable that emits connected, non-overlapping windows of items from the source Publisher whenever closingSelector emits an item

public final Flowable<Flowable<T>> window (long timespan, TimeUnit unit, Scheduler scheduler)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping windows, each of a fixed duration as specified by the timespan argument. When the source Publisher completes or encounters an error, the resulting Publisher emits the current window and propagates the notification from the source Publisher.

Backpressure:
The operator consumes the source Publisher in an unbounded manner. The returned Publisher doesn't support backpressure as it uses time to control the creation of windows. The returned inner Publishers honor backpressure but have an unbounded inner buffer that may lead to OutOfMemoryError if left unconsumed.
Scheduler:
You specify which Scheduler this operator will use

Parameters
timespan the period of time each window collects items before it should be emitted and replaced with a new window
unit the unit of time which applies to the timespan argument
scheduler the Scheduler to use when determining the end and start of a window
Returns
  • a Flowable that emits connected, non-overlapping windows containing items emitted by the source Publisher within a fixed duration

public final Flowable<Flowable<T>> window (long timespan, long timeskip, TimeUnit unit, Scheduler scheduler, int bufferSize)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher starts a new window periodically, as determined by the timeskip argument. It emits each window after a fixed timespan, specified by the timespan argument. When the source Publisher completes or Publisher completes or encounters an error, the resulting Publisher emits the current window and propagates the notification from the source Publisher.

Backpressure:
The operator consumes the source Publisher in an unbounded manner. The returned Publisher doesn't support backpressure as it uses time to control the creation of windows. The returned inner Publishers honor backpressure but have an unbounded inner buffer that may lead to OutOfMemoryError if left unconsumed.
Scheduler:
You specify which Scheduler this operator will use

Parameters
timespan the period of time each window collects items before it should be emitted
timeskip the period of time after which a new window will be created
unit the unit of time that applies to the timespan and timeskip arguments
scheduler the Scheduler to use when determining the end and start of a window
bufferSize the capacity hint for the buffer in the inner windows
Returns
  • a Flowable that emits new windows periodically as a fixed timespan elapses

public final Flowable<Flowable<T>> window (Publisher<U> openingIndicator, Function<? super U, ? extends Publisher<V>> closingIndicator, int bufferSize)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher emits windows that contain those items emitted by the source Publisher between the time when the windowOpenings Publisher emits an item and when the Publisher returned by closingSelector emits an item.

Backpressure:
The outer Publisher of this operator doesn't support backpressure because the emission of new inner Publishers are controlled by the windowOpenings Publisher. The inner Publishers honor backpressure and buffer everything until the associated closing Publisher signals or completes.
Scheduler:
This version of window does not operate by default on a particular Scheduler.

Parameters
openingIndicator a Publisher that, when it emits an item, causes another window to be created
closingIndicator a Function that produces a Publisher for every window created. When this Publisher emits an item, the associated window is closed and emitted
bufferSize the capacity hint for the buffer in the inner windows
Returns
  • a Flowable that emits windows of items emitted by the source Publisher that are governed by the specified window-governing Publishers

public final Flowable<Flowable<T>> window (Publisher<B> boundaryIndicator, int bufferSize)

Returns a Flowable that emits non-overlapping windows of items it collects from the source Publisher where the boundary of each window is determined by the items emitted from a specified boundary-governing Publisher.

Backpressure:
The outer Publisher of this operator does not support backpressure as it uses a boundary Publisher to control data flow. The inner Publishers honor backpressure and buffer everything until the boundary signals the next element.
Scheduler:
This version of window does not operate by default on a particular Scheduler.

Parameters
boundaryIndicator a Publisher whose emitted items close and open windows
bufferSize the capacity hint for the buffer in the inner windows
Returns
  • a Flowable that emits non-overlapping windows of items it collects from the source Publisher where the boundary of each window is determined by the items emitted from the boundary Publisher

public final Flowable<Flowable<T>> window (long count)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping windows, each containing count items. When the source Publisher completes or encounters an error, the resulting Publisher emits the current window and propagates the notification from the source Publisher.

Backpressure:
The operator honors backpressure of its inner and outer subscribers, however, the inner Publisher uses an unbounded buffer that may hold at most count elements.
Scheduler:
This version of window does not operate by default on a particular Scheduler.

Parameters
count the maximum size of each window before it should be emitted
Returns
  • a Flowable that emits connected, non-overlapping windows, each containing at most count items from the source Publisher
Throws
IllegalArgumentException if either count is non-positive

public final Flowable<Flowable<T>> window (long count, long skip)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher emits windows every skip items, each containing no more than count items. When the source Publisher completes or encounters an error, the resulting Publisher emits the current window and propagates the notification from the source Publisher.

Backpressure:
The operator honors backpressure of its inner and outer subscribers, however, the inner Publisher uses an unbounded buffer that may hold at most count elements.
Scheduler:
This version of window does not operate by default on a particular Scheduler.

Parameters
count the maximum size of each window before it should be emitted
skip how many items need to be skipped before starting a new window. Note that if skip and count are equal this is the same operation as window(long).
Returns
  • a Flowable that emits windows every skip items containing at most count items from the source Publisher
Throws
IllegalArgumentException if either count or skip is non-positive

public final Flowable<Flowable<T>> window (long timespan, long timeskip, TimeUnit unit)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher starts a new window periodically, as determined by the timeskip argument. It emits each window after a fixed timespan, specified by the timespan argument. When the source Publisher completes or Publisher completes or encounters an error, the resulting Publisher emits the current window and propagates the notification from the source Publisher.

Backpressure:
The operator consumes the source Publisher in an unbounded manner. The returned Publisher doesn't support backpressure as it uses time to control the creation of windows. The returned inner Publishers honor backpressure but have an unbounded inner buffer that may lead to OutOfMemoryError if left unconsumed.
Scheduler:
This version of window operates by default on the computation Scheduler.

Parameters
timespan the period of time each window collects items before it should be emitted
timeskip the period of time after which a new window will be created
unit the unit of time that applies to the timespan and timeskip arguments
Returns
  • a Flowable that emits new windows periodically as a fixed timespan elapses

public final Flowable<Flowable<T>> window (Callable<? extends Publisher<B>> boundaryIndicatorSupplier)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping windows. It emits the current window and opens a new one whenever the Publisher produced by the specified closingSelector emits an item.

Backpressure:
The operator consumes the source Publisher in an unbounded manner. The returned Publisher doesn't support backpressure as it uses the closingSelector to control the creation of windows. The returned inner Publishers honor backpressure but have an unbounded inner buffer that may lead to OutOfMemoryError if left unconsumed.
Scheduler:
This version of window does not operate by default on a particular Scheduler.

Parameters
boundaryIndicatorSupplier a Callable that returns a Publisher that governs the boundary between windows. When the source Publisher emits an item, window emits the current window and begins a new one.
Returns
  • a Flowable that emits connected, non-overlapping windows of items from the source Publisher whenever closingSelector emits an item

public final Flowable<Flowable<T>> window (long timespan, TimeUnit unit, long count)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping windows, each of a fixed duration as specified by the timespan argument or a maximum size as specified by the count argument (whichever is reached first). When the source Publisher completes or encounters an error, the resulting Publisher emits the current window and propagates the notification from the source Publisher.

Backpressure:
The operator consumes the source Publisher in an unbounded manner. The returned Publisher doesn't support backpressure as it uses time to control the creation of windows. The returned inner Publishers honor backpressure and may hold up to count elements at most.
Scheduler:
This version of window operates by default on the computation Scheduler.

Parameters
timespan the period of time each window collects items before it should be emitted and replaced with a new window
unit the unit of time that applies to the timespan argument
count the maximum size of each window before it should be emitted
Returns
  • a Flowable that emits connected, non-overlapping windows of items from the source Publisher that were emitted during a fixed duration of time or when the window has reached maximum capacity (whichever occurs first)

public final Flowable<Flowable<T>> window (long timespan, TimeUnit unit, long count, boolean restart)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping windows, each of a fixed duration as specified by the timespan argument or a maximum size as specified by the count argument (whichever is reached first). When the source Publisher completes or encounters an error, the resulting Publisher emits the current window and propagates the notification from the source Publisher.

Backpressure:
The operator consumes the source Publisher in an unbounded manner. The returned Publisher doesn't support backpressure as it uses time to control the creation of windows. The returned inner Publishers honor backpressure and may hold up to count elements at most.
Scheduler:
This version of window operates by default on the computation Scheduler.

Parameters
timespan the period of time each window collects items before it should be emitted and replaced with a new window
unit the unit of time that applies to the timespan argument
count the maximum size of each window before it should be emitted
restart if true, when a window reaches the capacity limit, the timer is restarted as well
Returns
  • a Flowable that emits connected, non-overlapping windows of items from the source Publisher that were emitted during a fixed duration of time or when the window has reached maximum capacity (whichever occurs first)

public final Flowable<Flowable<T>> window (Publisher<B> boundaryIndicator)

Returns a Flowable that emits non-overlapping windows of items it collects from the source Publisher where the boundary of each window is determined by the items emitted from a specified boundary-governing Publisher.

Backpressure:
The outer Publisher of this operator does not support backpressure as it uses a boundary Publisher to control data flow. The inner Publishers honor backpressure and buffer everything until the boundary signals the next element.
Scheduler:
This version of window does not operate by default on a particular Scheduler.

Parameters
boundaryIndicator a Publisher whose emitted items close and open windows
Returns
  • a Flowable that emits non-overlapping windows of items it collects from the source Publisher where the boundary of each window is determined by the items emitted from the boundary Publisher

public final Flowable<Flowable<T>> window (long timespan, TimeUnit unit, Scheduler scheduler, long count)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping windows, each of a fixed duration specified by the timespan argument or a maximum size specified by the count argument (whichever is reached first). When the source Publisher completes or encounters an error, the resulting Publisher emits the current window and propagates the notification from the source Publisher.

Backpressure:
The operator consumes the source Publisher in an unbounded manner. The returned Publisher doesn't support backpressure as it uses time to control the creation of windows. The returned inner Publishers honor backpressure and may hold up to count elements at most.
Scheduler:
You specify which Scheduler this operator will use

Parameters
timespan the period of time each window collects items before it should be emitted and replaced with a new window
unit the unit of time which applies to the timespan argument
scheduler the Scheduler to use when determining the end and start of a window
count the maximum size of each window before it should be emitted
Returns
  • a Flowable that emits connected, non-overlapping windows of items from the source Publisher that were emitted during a fixed duration of time or when the window has reached maximum capacity (whichever occurs first)

public final Flowable<Flowable<T>> window (long timespan, TimeUnit unit)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher emits connected, non-overlapping windows, each of a fixed duration specified by the timespan argument. When the source Publisher completes or encounters an error, the resulting Publisher emits the current window and propagates the notification from the source Publisher.

Backpressure:
The operator consumes the source Publisher in an unbounded manner. The returned Publisher doesn't support backpressure as it uses time to control the creation of windows. The returned inner Publishers honor backpressure and may hold up to count elements at most.
Scheduler:
This version of window operates by default on the computation Scheduler.

Parameters
timespan the period of time each window collects items before it should be emitted and replaced with a new window
unit the unit of time that applies to the timespan argument
Returns
  • a Flowable that emits connected, non-overlapping windows representing items emitted by the source Publisher during fixed, consecutive durations

public final Flowable<Flowable<T>> window (long count, long skip, int bufferSize)

Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting Publisher emits windows every skip items, each containing no more than count items. When the source Publisher completes or encounters an error, the resulting Publisher emits the current window and propagates the notification from the source Publisher.

Backpressure:
The operator honors backpressure of its inner and outer subscribers, however, the inner Publisher uses an unbounded buffer that may hold at most count elements.
Scheduler:
This version of window does not operate by default on a particular Scheduler.

Parameters
count the maximum size of each window before it should be emitted
skip how many items need to be skipped before starting a new window. Note that if skip and count are equal this is the same operation as window(long).
bufferSize the capacity hint for the buffer in the inner windows
Returns
  • a Flowable that emits windows every skip items containing at most count items from the source Publisher
Throws
IllegalArgumentException if either count or skip is non-positive

public final Flowable<R> withLatestFrom (Publisher<? extends U> other, BiFunction<? super T, ? super U, ? extends R> combiner)

Merges the specified Publisher into this Publisher sequence by using the resultSelector function only when the source Publisher (this instance) emits an item.

Backpressure:
The operator is a pass-through for backpressure: the backpressure support depends on the upstream and downstream's backpressure behavior. The other Publisher is consumed in an unbounded fashion.
Scheduler:
This operator, by default, doesn't run any particular Scheduler.

Parameters
other the other Publisher
combiner the function to call when this Publisher emits an item and the other Publisher has already emitted an item, to generate the item to be emitted by the resulting Publisher
Returns
  • a Flowable that merges the specified Publisher into this Publisher by using the resultSelector function only when the source Publisher sequence (this instance) emits an item

public final Flowable<R> withLatestFrom (Publisher<T1> source1, Publisher<T2> source2, Publisher<T3> source3, Function4<? super T, ? super T1, ? super T2, ? super T3, R> combiner)

Combines the value emission from this Publisher with the latest emissions from the other Publishers via a function to produce the output item.

Note that this operator doesn't emit anything until all other sources have produced at least one value. The resulting emission only happens when this Publisher emits (and not when any of the other sources emit, unlike combineLatest). If a source doesn't produce any value and just completes, the sequence is completed immediately.

Backpressure:
This operator is a pass-through for backpressure behavior between the source Publisher and the downstream Subscriber. The other Publishers are consumed in an unbounded manner.
Scheduler:
This operator does not operate by default on a particular Scheduler.

Parameters
source1 the first other Publisher
source2 the second other Publisher
source3 the third other Publisher
combiner the function called with an array of values from each participating Publisher
Returns
  • the new Publisher instance

public final Flowable<R> withLatestFrom (Publisher[]<?> others, Function<? super Object[], R> combiner)

Combines the value emission from this Publisher with the latest emissions from the other Publishers via a function to produce the output item.

Note that this operator doesn't emit anything until all other sources have produced at least one value. The resulting emission only happens when this Publisher emits (and not when any of the other sources emit, unlike combineLatest). If a source doesn't produce any value and just completes, the sequence is completed immediately.

Backpressure:
This operator is a pass-through for backpressure behavior between the source Publisher and the downstream Subscriber. The other Publishers are consumed in an unbounded manner.
Scheduler:
This operator does not operate by default on a particular Scheduler.

Parameters
others the array of other sources
combiner the function called with an array of values from each participating Publisher
Returns
  • the new Publisher instance

public final Flowable<R> withLatestFrom (Publisher<T1> source1, Publisher<T2> source2, Function3<? super T, ? super T1, ? super T2, R> combiner)

Combines the value emission from this Publisher with the latest emissions from the other Publishers via a function to produce the output item.

Note that this operator doesn't emit anything until all other sources have produced at least one value. The resulting emission only happens when this Publisher emits (and not when any of the other sources emit, unlike combineLatest). If a source doesn't produce any value and just completes, the sequence is completed immediately.

Backpressure:
This operator is a pass-through for backpressure behavior between the source Publisher and the downstream Subscriber. The other Publishers are consumed in an unbounded manner.
Scheduler:
This operator does not operate by default on a particular Scheduler.

Parameters
source1 the first other Publisher
source2 the second other Publisher
combiner the function called with an array of values from each participating Publisher
Returns
  • the new Publisher instance

public final Flowable<R> withLatestFrom (Publisher<T1> source1, Publisher<T2> source2, Publisher<T3> source3, Publisher<T4> source4, Function5<? super T, ? super T1, ? super T2, ? super T3, ? super T4, R> combiner)

Combines the value emission from this Publisher with the latest emissions from the other Publishers via a function to produce the output item.

Note that this operator doesn't emit anything until all other sources have produced at least one value. The resulting emission only happens when this Publisher emits (and not when any of the other sources emit, unlike combineLatest). If a source doesn't produce any value and just completes, the sequence is completed immediately.

Backpressure:
This operator is a pass-through for backpressure behavior between the source Publisher and the downstream Subscriber. The other Publishers are consumed in an unbounded manner.
Scheduler:
This operator does not operate by default on a particular Scheduler.

Parameters
source1 the first other Publisher
source2 the second other Publisher
source3 the third other Publisher
source4 the fourth other Publisher
combiner the function called with an array of values from each participating Publisher
Returns
  • the new Publisher instance

public final Flowable<R> withLatestFrom (Iterable<? extends Publisher<?>> others, Function<? super Object[], R> combiner)

Combines the value emission from this Publisher with the latest emissions from the other Publishers via a function to produce the output item.

Note that this operator doesn't emit anything until all other sources have produced at least one value. The resulting emission only happens when this Publisher emits (and not when any of the other sources emit, unlike combineLatest). If a source doesn't produce any value and just completes, the sequence is completed immediately.

Backpressure:
This operator is a pass-through for backpressure behavior between the source Publisher and the downstream Subscriber. The other Publishers are consumed in an unbounded manner.
Scheduler:
This operator does not operate by default on a particular Scheduler.

Parameters
others the iterable of other sources
combiner the function called with an array of values from each participating Publisher
Returns
  • the new Publisher instance

public static Flowable<R> zip (Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Publisher<? extends T6> source6, Function6<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? extends R> zipper)

Returns a Flowable that emits the results of a specified combiner function applied to combinations of six items emitted, in sequence, by six other Publishers.

zip applies this function in strict sequence, so the first item emitted by the new Publisher will be the result of the function applied to the first item emitted by each source Publisher, the second item emitted by the new Publisher will be the result of the function applied to the second item emitted by each of those Publishers, and so forth.

The resulting Publisher<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Publisher that emits the fewest items.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancelling the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

zip(range(1, 5).doOnComplete(action1), range(6, 5).doOnComplete(action2), ..., (a, b, c, d, e, f) -> a + b)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.
Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zip does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 a second source Publisher
source3 a third source Publisher
source4 a fourth source Publisher
source5 a fifth source Publisher
source6 a sixth source Publisher
zipper a function that, when applied to an item emitted by each of the source Publishers, results in an item that will be emitted by the resulting Publisher
Returns
  • a Flowable that emits the zipped results

public static Flowable<R> zip (Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Publisher<? extends T6> source6, Publisher<? extends T7> source7, Publisher<? extends T8> source8, Function8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R> zipper)

Returns a Flowable that emits the results of a specified combiner function applied to combinations of eight items emitted, in sequence, by eight other Publishers.

zip applies this function in strict sequence, so the first item emitted by the new Publisher will be the result of the function applied to the first item emitted by each source Publisher, the second item emitted by the new Publisher will be the result of the function applied to the second item emitted by each of those Publishers, and so forth.

The resulting Publisher<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Publisher that emits the fewest items.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancelling the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

zip(range(1, 5).doOnComplete(action1), range(6, 5).doOnComplete(action2), ..., (a, b, c, d, e, f, g, h) -> a + b)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.
Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zip does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 a second source Publisher
source3 a third source Publisher
source4 a fourth source Publisher
source5 a fifth source Publisher
source6 a sixth source Publisher
source7 a seventh source Publisher
source8 an eighth source Publisher
zipper a function that, when applied to an item emitted by each of the source Publishers, results in an item that will be emitted by the resulting Publisher
Returns
  • a Flowable that emits the zipped results

public static Flowable<R> zip (Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Publisher<? extends T6> source6, Publisher<? extends T7> source7, Publisher<? extends T8> source8, Publisher<? extends T9> source9, Function9<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? extends R> zipper)

Returns a Flowable that emits the results of a specified combiner function applied to combinations of nine items emitted, in sequence, by nine other Publishers.

zip applies this function in strict sequence, so the first item emitted by the new Publisher will be the result of the function applied to the first item emitted by each source Publisher, the second item emitted by the new Publisher will be the result of the function applied to the second item emitted by each of those Publishers, and so forth.

The resulting Publisher<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Publisher that emits the fewest items.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancelling the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

zip(range(1, 5).doOnComplete(action1), range(6, 5).doOnComplete(action2), ..., (a, b, c, d, e, f, g, h, i) -> a + b)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.
Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zip does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 a second source Publisher
source3 a third source Publisher
source4 a fourth source Publisher
source5 a fifth source Publisher
source6 a sixth source Publisher
source7 a seventh source Publisher
source8 an eighth source Publisher
source9 a ninth source Publisher
zipper a function that, when applied to an item emitted by each of the source Publishers, results in an item that will be emitted by the resulting Publisher
Returns
  • a Flowable that emits the zipped results

public static Flowable<R> zip (Publisher<? extends Publisher<? extends T>> sources, Function<? super Object[], ? extends R> zipper)

Returns a Flowable that emits the results of a specified combiner function applied to combinations of n items emitted, in sequence, by the n Publishers emitted by a specified Publisher.

zip applies this function in strict sequence, so the first item emitted by the new Publisher will be the result of the function applied to the first item emitted by each of the Publishers emitted by the source Publisher; the second item emitted by the new Publisher will be the result of the function applied to the second item emitted by each of those Publishers; and so forth.

The resulting Publisher<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Publisher that emits the fewest items.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancel the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

zip(just(range(1, 5).doOnComplete(action1), range(6, 5).doOnComplete(action2)), (a) -> a)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.

Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zip does not operate by default on a particular Scheduler.

Parameters
sources a Publisher of source Publishers
zipper a function that, when applied to an item emitted by each of the Publishers emitted by ws, results in an item that will be emitted by the resulting Publisher
Returns
  • a Flowable that emits the zipped results

public static Flowable<R> zip (Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Function5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> zipper)

Returns a Flowable that emits the results of a specified combiner function applied to combinations of five items emitted, in sequence, by five other Publishers.

zip applies this function in strict sequence, so the first item emitted by the new Publisher will be the result of the function applied to the first item emitted by o1, the first item emitted by o2, the first item emitted by o3, the first item emitted by o4, and the first item emitted by o5; the second item emitted by the new Publisher will be the result of the function applied to the second item emitted by each of those Publishers; and so forth.

The resulting Publisher<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Publisher that emits the fewest items.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancelling the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

zip(range(1, 5).doOnComplete(action1), range(6, 5).doOnComplete(action2), ..., (a, b, c, d, e) -> a + b)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.
Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zip does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 a second source Publisher
source3 a third source Publisher
source4 a fourth source Publisher
source5 a fifth source Publisher
zipper a function that, when applied to an item emitted by each of the source Publishers, results in an item that will be emitted by the resulting Publisher
Returns
  • a Flowable that emits the zipped results

public static Flowable<R> zip (Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Publisher<? extends T5> source5, Publisher<? extends T6> source6, Publisher<? extends T7> source7, Function7<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? extends R> zipper)

Returns a Flowable that emits the results of a specified combiner function applied to combinations of seven items emitted, in sequence, by seven other Publishers.

zip applies this function in strict sequence, so the first item emitted by the new Publisher will be the result of the function applied to the first item emitted by each source Publisher, the second item emitted by the new Publisher will be the result of the function applied to the second item emitted by each of those Publishers, and so forth.

The resulting Publisher<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Publisher that emits the fewest items.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancelling the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

zip(range(1, 5).doOnComplete(action1), range(6, 5).doOnComplete(action2), ..., (a, b, c, d, e, f, g) -> a + b)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.
Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zip does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 a second source Publisher
source3 a third source Publisher
source4 a fourth source Publisher
source5 a fifth source Publisher
source6 a sixth source Publisher
source7 a seventh source Publisher
zipper a function that, when applied to an item emitted by each of the source Publishers, results in an item that will be emitted by the resulting Publisher
Returns
  • a Flowable that emits the zipped results

public static Flowable<R> zip (Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Function3<? super T1, ? super T2, ? super T3, ? extends R> zipper)

Returns a Flowable that emits the results of a specified combiner function applied to combinations of three items emitted, in sequence, by three other Publishers.

zip applies this function in strict sequence, so the first item emitted by the new Publisher will be the result of the function applied to the first item emitted by o1, the first item emitted by o2, and the first item emitted by o3; the second item emitted by the new Publisher will be the result of the function applied to the second item emitted by o1, the second item emitted by o2, and the second item emitted by o3; and so forth.

The resulting Publisher<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Publisher that emits the fewest items.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancelling the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

zip(range(1, 5).doOnComplete(action1), range(6, 5).doOnComplete(action2), ..., (a, b, c) -> a + b)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.
Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zip does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 a second source Publisher
source3 a third source Publisher
zipper a function that, when applied to an item emitted by each of the source Publishers, results in an item that will be emitted by the resulting Publisher
Returns
  • a Flowable that emits the zipped results

public static Flowable<R> zip (Publisher<? extends T1> source1, Publisher<? extends T2> source2, Publisher<? extends T3> source3, Publisher<? extends T4> source4, Function4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> zipper)

Returns a Flowable that emits the results of a specified combiner function applied to combinations of four items emitted, in sequence, by four other Publishers.

zip applies this function in strict sequence, so the first item emitted by the new Publisher will be the result of the function applied to the first item emitted by o1, the first item emitted by o2, the first item emitted by o3, and the first item emitted by 04; the second item emitted by the new Publisher will be the result of the function applied to the second item emitted by each of those Publishers; and so forth.

The resulting Publisher<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Publisher that emits the fewest items.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancelling the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

zip(range(1, 5).doOnComplete(action1), range(6, 5).doOnComplete(action2), ..., (a, b, c, d) -> a + b)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.
Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zip does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 a second source Publisher
source3 a third source Publisher
source4 a fourth source Publisher
zipper a function that, when applied to an item emitted by each of the source Publishers, results in an item that will be emitted by the resulting Publisher
Returns
  • a Flowable that emits the zipped results

public static Flowable<R> zip (Publisher<? extends T1> source1, Publisher<? extends T2> source2, BiFunction<? super T1, ? super T2, ? extends R> zipper, boolean delayError, int bufferSize)

Returns a Flowable that emits the results of a specified combiner function applied to combinations of two items emitted, in sequence, by two other Publishers.

zip applies this function in strict sequence, so the first item emitted by the new Publisher will be the result of the function applied to the first item emitted by o1 and the first item emitted by o2; the second item emitted by the new Publisher will be the result of the function applied to the second item emitted by o1 and the second item emitted by o2; and so forth.

The resulting Publisher<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Publisher that emits the fewest items.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancelling the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

zip(range(1, 5).doOnComplete(action1), range(6, 5).doOnComplete(action2), (a, b) -> a + b)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.
Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zip does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 a second source Publisher
zipper a function that, when applied to an item emitted by each of the source Publishers, results in an item that will be emitted by the resulting Publisher
delayError delay errors from any of the source Publishers till the other terminates
bufferSize the number of elements to prefetch from each source Publisher
Returns
  • a Flowable that emits the zipped results

public static Flowable<R> zip (Publisher<? extends T1> source1, Publisher<? extends T2> source2, BiFunction<? super T1, ? super T2, ? extends R> zipper, boolean delayError)

Returns a Flowable that emits the results of a specified combiner function applied to combinations of two items emitted, in sequence, by two other Publishers.

zip applies this function in strict sequence, so the first item emitted by the new Publisher will be the result of the function applied to the first item emitted by o1 and the first item emitted by o2; the second item emitted by the new Publisher will be the result of the function applied to the second item emitted by o1 and the second item emitted by o2; and so forth.

The resulting Publisher<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Publisher that emits the fewest items.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancelling the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

zip(range(1, 5).doOnComplete(action1), range(6, 5).doOnComplete(action2), (a, b) -> a + b)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.
Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zip does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 a second source Publisher
zipper a function that, when applied to an item emitted by each of the source Publishers, results in an item that will be emitted by the resulting Publisher
delayError delay errors from any of the source Publishers till the other terminates
Returns
  • a Flowable that emits the zipped results

public static Flowable<R> zip (Iterable<? extends Publisher<? extends T>> sources, Function<? super Object[], ? extends R> zipper)

Returns a Flowable that emits the results of a specified combiner function applied to combinations of items emitted, in sequence, by an Iterable of other Publishers.

zip applies this function in strict sequence, so the first item emitted by the new Publisher will be the result of the function applied to the first item emitted by each of the source Publishers; the second item emitted by the new Publisher will be the result of the function applied to the second item emitted by each of those Publishers; and so forth.

The resulting Publisher<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Publisher that emits the fewest items.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancelling the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

zip(Arrays.asList(range(1, 5).doOnComplete(action1), range(6, 5).doOnComplete(action2)), (a) -> a)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.

Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zip does not operate by default on a particular Scheduler.

Parameters
sources an Iterable of source Publishers
zipper a function that, when applied to an item emitted by each of the source Publishers, results in an item that will be emitted by the resulting Publisher
Returns
  • a Flowable that emits the zipped results

public static Flowable<R> zip (Publisher<? extends T1> source1, Publisher<? extends T2> source2, BiFunction<? super T1, ? super T2, ? extends R> zipper)

Returns a Flowable that emits the results of a specified combiner function applied to combinations of two items emitted, in sequence, by two other Publishers.

zip applies this function in strict sequence, so the first item emitted by the new Publisher will be the result of the function applied to the first item emitted by o1 and the first item emitted by o2; the second item emitted by the new Publisher will be the result of the function applied to the second item emitted by o1 and the second item emitted by o2; and so forth.

The resulting Publisher<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Publisher that emits the fewest items.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancelling the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

zip(range(1, 5).doOnComplete(action1), range(6, 5).doOnComplete(action2), (a, b) -> a + b)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.
Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zip does not operate by default on a particular Scheduler.

Parameters
source1 the first source Publisher
source2 a second source Publisher
zipper a function that, when applied to an item emitted by each of the source Publishers, results in an item that will be emitted by the resulting Publisher
Returns
  • a Flowable that emits the zipped results

public static Flowable<R> zipArray (Function<? super Object[], ? extends R> zipper, boolean delayError, int bufferSize, Publisher...<? extends T> sources)

Returns a Flowable that emits the results of a specified combiner function applied to combinations of items emitted, in sequence, by an array of other Publishers.

zip applies this function in strict sequence, so the first item emitted by the new Publisher will be the result of the function applied to the first item emitted by each of the source Publishers; the second item emitted by the new Publisher will be the result of the function applied to the second item emitted by each of those Publishers; and so forth.

The resulting Publisher<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Publisher that emits the fewest items.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancelling the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

zip(new Publisher[]{range(1, 5).doOnComplete(action1), range(6, 5).doOnComplete(action2)}, (a) ->
 a)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.

Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zipArray does not operate by default on a particular Scheduler.

Parameters
zipper a function that, when applied to an item emitted by each of the source Publishers, results in an item that will be emitted by the resulting Publisher
delayError delay errors signalled by any of the source Publisher until all Publishers terminate
bufferSize the number of elements to prefetch from each source Publisher
sources an array of source Publishers
Returns
  • a Flowable that emits the zipped results

public static Flowable<R> zipIterable (Iterable<? extends Publisher<? extends T>> sources, Function<? super Object[], ? extends R> zipper, boolean delayError, int bufferSize)

Returns a Flowable that emits the results of a specified combiner function applied to combinations of items emitted, in sequence, by an Iterable of other Publishers.

zip applies this function in strict sequence, so the first item emitted by the new Publisher will be the result of the function applied to the first item emitted by each of the source Publishers; the second item emitted by the new Publisher will be the result of the function applied to the second item emitted by each of those Publishers; and so forth.

The resulting Publisher<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Publisher that emits the fewest items.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancelling the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

zip(Arrays.asList(range(1, 5).doOnComplete(action1), range(6, 5).doOnComplete(action2)), (a) -> a)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.

Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zipIterable does not operate by default on a particular Scheduler.

Parameters
sources an Iterable of source Publishers
zipper a function that, when applied to an item emitted by each of the source Publishers, results in an item that will be emitted by the resulting Publisher
delayError delay errors signalled by any of the source Publisher until all Publishers terminate
bufferSize the number of elements to prefetch from each source Publisher
Returns
  • a Flowable that emits the zipped results

public final Flowable<R> zipWith (Publisher<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper, boolean delayError)

Returns a Flowable that emits items that are the result of applying a specified function to pairs of values, one each from the source Publisher and another specified Publisher.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancelling the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

range(1, 5).doOnComplete(action1).zipWith(range(6, 5).doOnComplete(action2), (a, b) -> a + b)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.
Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zipWith does not operate by default on a particular Scheduler.

Parameters
other the other Publisher
zipper a function that combines the pairs of items from the two Publishers to generate the items to be emitted by the resulting Publisher
delayError if true, errors from the current Flowable or the other Publisher is delayed until both terminate
Returns
  • a Flowable that pairs up values from the source Publisher and the other Publisher and emits the results of zipFunction applied to these pairs

public final Flowable<R> zipWith (Publisher<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper)

Returns a Flowable that emits items that are the result of applying a specified function to pairs of values, one each from the source Publisher and another specified Publisher.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancelling the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

range(1, 5).doOnComplete(action1).zipWith(range(6, 5).doOnComplete(action2), (a, b) -> a + b)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.
Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zipWith does not operate by default on a particular Scheduler.

Parameters
other the other Publisher
zipper a function that combines the pairs of items from the two Publishers to generate the items to be emitted by the resulting Publisher
Returns
  • a Flowable that pairs up values from the source Publisher and the other Publisher and emits the results of zipFunction applied to these pairs

public final Flowable<R> zipWith (Iterable<U> other, BiFunction<? super T, ? super U, ? extends R> zipper)

Returns a Flowable that emits items that are the result of applying a specified function to pairs of values, one each from the source Publisher and a specified Iterable sequence.

Note that the other Iterable is evaluated as items are observed from the source Publisher; it is not pre-consumed. This allows you to zip infinite streams on either side.

Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zipWith does not operate by default on a particular Scheduler.

Parameters
other the Iterable sequence
zipper a function that combines the pairs of items from the Publisher and the Iterable to generate the items to be emitted by the resulting Publisher
Returns
  • a Flowable that pairs up values from the source Publisher and the other Iterable sequence and emits the results of zipFunction applied to these pairs

public final Flowable<R> zipWith (Publisher<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper, boolean delayError, int bufferSize)

Returns a Flowable that emits items that are the result of applying a specified function to pairs of values, one each from the source Publisher and another specified Publisher.

The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while cancelling the other sources. Therefore, it is possible those other sources will never be able to run to completion (and thus not calling doOnComplete()). This can also happen if the sources are exactly the same length; if source A completes and B has been consumed and is about to complete, the operator detects A won't be sending further values and it will cancel B immediately. For example:

range(1, 5).doOnComplete(action1).zipWith(range(6, 5).doOnComplete(action2), (a, b) -> a + b)
action1 will be called but action2 won't.
To work around this termination property, use doOnCancel(Action) as well or use using() to do cleanup in case of completion or cancellation.
Backpressure:
The operator expects backpressure from the sources and honors backpressure from the downstream. (I.e., zipping with interval(long, TimeUnit) may result in MissingBackpressureException, use one of the onBackpressureX to handle similar, backpressure-ignoring sources.
Scheduler:
zipWith does not operate by default on a particular Scheduler.

Parameters
other the other Publisher
zipper a function that combines the pairs of items from the two Publishers to generate the items to be emitted by the resulting Publisher
delayError if true, errors from the current Flowable or the other Publisher is delayed until both terminate
bufferSize the capacity hint for the buffer in the inner windows
Returns
  • a Flowable that pairs up values from the source Publisher and the other Publisher and emits the results of zipFunction applied to these pairs

Protected Methods

protected abstract void subscribeActual (Subscriber<? super T> s)

Operator implementations (both source and intermediate) should implement this method that performs the necessary business logic.

There is no need to call any of the plugin hooks on the current Flowable instance or the Subscriber.

Parameters
s the incoming Subscriber, never null