Class Flowable<T>

java.lang.Object
io.reactivex.rxjava3.core.Flowable<T>
Type Parameters:
T - the type of the items emitted by the Flowable
All Implemented Interfaces:
org.reactivestreams.Publisher<T>
Direct Known Subclasses:
AbstractFlowableWithUpstream, CompletableAndThenPublisher, CompletableToFlowable, ConnectableFlowable, FlowableAmb, FlowableAutoConnect, FlowableCollectWithCollector, FlowableCombineLatest, FlowableConcatArray, FlowableConcatMapEagerPublisher, FlowableConcatMapMaybe, FlowableConcatMapMaybePublisher, FlowableConcatMapSingle, FlowableConcatMapSinglePublisher, FlowableCreate, FlowableDefer, FlowableDelaySubscriptionOther, FlowableEmpty, FlowableError, FlowableFlatMapMaybePublisher, FlowableFlatMapSinglePublisher, FlowableFlatMapStream, FlowableFromAction, FlowableFromArray, FlowableFromCallable, FlowableFromCompletable, FlowableFromCompletionStage, FlowableFromFuture, FlowableFromIterable, FlowableFromObservable, FlowableFromPublisher, FlowableFromRunnable, FlowableFromStream, FlowableFromSupplier, FlowableGenerate, FlowableInterval, FlowableIntervalRange, FlowableJust, FlowableMapOptional, FlowableMapPublisher, FlowableNever, FlowableProcessor, FlowablePublishMulticast.MulticastProcessor, FlowableRange, FlowableRangeLong, FlowableRefCount, FlowableReplay.MulticastFlowable, FlowableSamplePublisher, FlowableScalarXMap.ScalarXMapFlowable, FlowableSequenceEqual, FlowableSwitchMapMaybe, FlowableSwitchMapMaybePublisher, FlowableSwitchMapSingle, FlowableSwitchMapSinglePublisher, FlowableTakePublisher, FlowableTimer, FlowableUsing, FlowableWindowBoundarySelector.WindowBoundaryMainSubscriber.WindowEndSubscriberIntercept, FlowableWindowSubscribeIntercept, FlowableZip, GroupedFlowable, MaybeConcatArray, MaybeConcatArrayDelayError, MaybeConcatIterable, MaybeFlatMapIterableFlowable, MaybeFlatMapPublisher, MaybeFlattenStreamAsFlowable, MaybeMergeArray, MaybeToFlowable, ParallelCollector, ParallelJoin, ParallelReduceFull, ParallelSortedJoin, SingleFlatMapIterableFlowable, SingleFlatMapPublisher, SingleFlattenStreamAsFlowable, SingleToFlowable

public abstract class Flowable<@NonNull T> extends Object implements org.reactivestreams.Publisher<T>
The Flowable class that implements the Reactive Streams Publisher 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 rx3.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:

The Flowable follows the protocol


      onSubscribe onNext* (onError | onComplete)?
 
where the stream can be disposed through the Subscription instance provided to consumers through Subscriber.onSubscribe(Subscription). Unlike the Observable.subscribe() of version 1.x, subscribe(Subscriber) does not allow external cancellation of a subscription and the Subscriber instance is expected to expose such capability if needed.

Flowables support backpressure and require Subscribers to signal demand via Subscription.request(long).

Example:


 Disposable d = Flowable.just("Hello world!")
     .delay(1, TimeUnit.SECONDS)
     .subscribeWith(new DisposableSubscriber<String>() {
         @Override public void onStart() {
             System.out.println("Start!");
             request(1);
         }
         @Override public void onNext(String t) {
             System.out.println(t);
             request(1);
         }
         @Override public void onError(Throwable t) {
             t.printStackTrace();
         }
         @Override public void onComplete() {
             System.out.println("Done!");
         }
     });

 Thread.sleep(500);
 // the sequence can now be cancelled via dispose()
 d.dispose();
 

The Reactive Streams specification is relatively strict when defining interactions between Publishers and Subscribers, so much so that there is a significant performance penalty due certain timing requirements and the need to prepare for invalid request amounts via Subscription.request(long). Therefore, RxJava has introduced the FlowableSubscriber interface that indicates the consumer can be driven with relaxed rules. All RxJava operators are implemented with these relaxed rules in mind. If the subscribing Subscriber does not implement this interface, for example, due to it being from another Reactive Streams compliant library, the Flowable will automatically apply a compliance wrapper around it.

Flowable is an abstract class, but it is not advised to implement sources and custom operators by extending the class directly due to the large amounts of Reactive Streams rules to be followed to the letter. See the wiki for some guidance if such custom implementations are necessary.

The recommended way of creating custom Flowables is by using the create(FlowableOnSubscribe, BackpressureStrategy) factory method:


 Flowable<String> source = Flowable.create(new FlowableOnSubscribe<String>() {
     @Override
     public void subscribe(FlowableEmitter<String> emitter) throws Exception {

         // signal an item
         emitter.onNext("Hello");

         // could be some blocking operation
         Thread.sleep(1000);

         // the consumer might have cancelled the flow
         if (emitter.isCancelled()) {
             return;
         }

         emitter.onNext("World");

         Thread.sleep(1000);

         // the end-of-sequence has to be signaled, otherwise the
         // consumers may never finish
         emitter.onComplete();
     }
 }, BackpressureStrategy.BUFFER);

 System.out.println("Subscribe!");

 source.subscribe(System.out::println);

 System.out.println("Done!");
 

RxJava reactive sources, such as Flowable, are generally synchronous and sequential in nature. In the ReactiveX design, the location (thread) where operators run is orthogonal to when the operators can work with data. This means that asynchrony and parallelism has to be explicitly expressed via operators such as subscribeOn(Scheduler), observeOn(Scheduler) and parallel(). In general, operators featuring a Scheduler parameter are introducing this type of asynchrony into the flow.

For more information see the ReactiveX documentation.

See Also:
  • Field Details

    • BUFFER_SIZE

      static final int BUFFER_SIZE
      The default buffer size.
  • Constructor Details

    • Flowable

      public Flowable()
  • Method Details

    • amb

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> amb(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> sources)
      Mirrors the one Publisher in an Iterable of several Publishers that first either emits an item or sends a termination notification.

      When one of the Publishers signal an item or terminates first, all subscriptions to the other Publishers are canceled.

      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.
      Error handling:
      If any of the losing Publishers signals an error, the error is routed to the global error handler via RxJavaPlugins.onError(Throwable).
      Type Parameters:
      T - the common element type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      See Also:
    • ambArray

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") @SafeVarargs public static <@NonNull T> @NonNull Flowable<T> ambArray(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T>... sources)
      Mirrors the one Publisher in an array of several Publishers that first either emits an item or sends a termination notification.

      When one of the Publishers signal an item or terminates first, all subscriptions to the other Publishers are canceled.

      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.
      Error handling:
      If any of the losing Publishers signals an error, the error is routed to the global error handler via RxJavaPlugins.onError(Throwable).
      Type Parameters:
      T - the common element type
      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 array.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      See Also:
    • bufferSize

      @CheckReturnValue public static int bufferSize()
      Returns the default internal buffer size used by most async operators.

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

      Returns:
      the default internal buffer size.
    • combineLatestArray

      @SchedulerSupport("none") @CheckReturnValue @BackpressureSupport(FULL) @NonNull public static <@NonNull T, @NonNull R> @NonNull Flowable<R> combineLatestArray(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T>[] sources, @NonNull @NonNull Function<? super Object[],? extends @NonNull 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 until 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:
      combineLatestArray does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the common base type of source values
      R - the result type
      Parameters:
      sources - the collection of source Publishers
      combiner - the aggregation function used to combine the items emitted by the source Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources or combiner is null
      See Also:
    • combineLatestArray

      @SchedulerSupport("none") @CheckReturnValue @NonNull @BackpressureSupport(FULL) public static <@NonNull T, @NonNull R> @NonNull Flowable<R> combineLatestArray(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T>[] sources, @NonNull @NonNull Function<? super Object[],? extends @NonNull 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 until 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:
      combineLatestArray does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the common base type of source values
      R - the result type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if sources or combiner is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • combineLatest

      @SchedulerSupport("none") @CheckReturnValue @BackpressureSupport(FULL) @NonNull public static <@NonNull T, @NonNull R> @NonNull Flowable<R> combineLatest(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> sources, @NonNull @NonNull Function<? super Object[],? extends @NonNull 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 until 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.
      Type Parameters:
      T - the common base type of source values
      R - the result type
      Parameters:
      sources - the collection of source Publishers
      combiner - the aggregation function used to combine the items emitted by the source Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources or combiner is null
      See Also:
    • combineLatest

      @SchedulerSupport("none") @CheckReturnValue @NonNull @BackpressureSupport(FULL) public static <@NonNull T, @NonNull R> @NonNull Flowable<R> combineLatest(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> sources, @NonNull @NonNull Function<? super Object[],? extends @NonNull 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 until 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.
      Type Parameters:
      T - the common base type of source values
      R - the result type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if sources or combiner is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • combineLatestArrayDelayError

      @SchedulerSupport("none") @CheckReturnValue @BackpressureSupport(FULL) @NonNull public static <@NonNull T, @NonNull R> @NonNull Flowable<R> combineLatestArrayDelayError(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T>[] sources, @NonNull @NonNull Function<? super Object[],? extends @NonNull 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 until 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:
      combineLatestArrayDelayError does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the common base type of source values
      R - the result type
      Parameters:
      sources - the collection of source Publishers
      combiner - the aggregation function used to combine the items emitted by the source Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources or combiner is null
      See Also:
    • combineLatestArrayDelayError

      @SchedulerSupport("none") @CheckReturnValue @NonNull @BackpressureSupport(FULL) public static <@NonNull T, @NonNull R> @NonNull Flowable<R> combineLatestArrayDelayError(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T>[] sources, @NonNull @NonNull Function<? super Object[],? extends @NonNull 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 until 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:
      combineLatestArrayDelayError does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the common base type of source values
      R - the result type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if sources or combiner is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • combineLatestDelayError

      @SchedulerSupport("none") @CheckReturnValue @BackpressureSupport(FULL) @NonNull public static <@NonNull T, @NonNull R> @NonNull Flowable<R> combineLatestDelayError(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> sources, @NonNull @NonNull Function<? super Object[],? extends @NonNull 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 until 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.
      Type Parameters:
      T - the common base type of source values
      R - the result type
      Parameters:
      sources - the collection of source Publishers
      combiner - the aggregation function used to combine the items emitted by the source Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources or combiner is null
      See Also:
    • combineLatestDelayError

      @SchedulerSupport("none") @CheckReturnValue @BackpressureSupport(FULL) @NonNull public static <@NonNull T, @NonNull R> @NonNull Flowable<R> combineLatestDelayError(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> sources, @NonNull @NonNull Function<? super Object[],? extends @NonNull 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 until 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.
      Type Parameters:
      T - the common base type of source values
      R - the result type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if sources or combiner is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • combineLatest

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T1, @NonNull T2, @NonNull R> @NonNull Flowable<R> combineLatest(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull BiFunction<? super @NonNull T1,? super @NonNull T2,? extends @NonNull 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 until 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.
      Type Parameters:
      T1 - the element type of the first source
      T2 - the element type of the second source
      R - the combined output type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2 or combiner is null
      See Also:
    • combineLatest

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull R> @NonNull Flowable<R> combineLatest(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T3> source3, @NonNull @NonNull Function3<? super @NonNull T1,? super @NonNull T2,? super @NonNull T3,? extends @NonNull 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 until 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.
      Type Parameters:
      T1 - the element type of the first source
      T2 - the element type of the second source
      T3 - the element type of the third source
      R - the combined output type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3 or combiner is null
      See Also:
    • combineLatest

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull R> @NonNull Flowable<R> combineLatest(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T3> source3, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T4> source4, @NonNull @NonNull Function4<? super @NonNull T1,? super @NonNull T2,? super @NonNull T3,? super @NonNull T4,? extends @NonNull 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 until 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.
      Type Parameters:
      T1 - the element type of the first source
      T2 - the element type of the second source
      T3 - the element type of the third source
      T4 - the element type of the fourth source
      R - the combined output type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3, source4 or combiner is null
      See Also:
    • combineLatest

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull R> @NonNull Flowable<R> combineLatest(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T3> source3, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T4> source4, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T5> source5, @NonNull @NonNull Function5<? super @NonNull T1,? super @NonNull T2,? super @NonNull T3,? super @NonNull T4,? super @NonNull T5,? extends @NonNull 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 until 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.
      Type Parameters:
      T1 - the element type of the first source
      T2 - the element type of the second source
      T3 - the element type of the third source
      T4 - the element type of the fourth source
      T5 - the element type of the fifth source
      R - the combined output type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3, source4, source5 or combiner is null
      See Also:
    • combineLatest

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull R> @NonNull Flowable<R> combineLatest(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T3> source3, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T4> source4, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T5> source5, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T6> source6, @NonNull @NonNull Function6<? super @NonNull T1,? super @NonNull T2,? super @NonNull T3,? super @NonNull T4,? super @NonNull T5,? super @NonNull T6,? extends @NonNull 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 until 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.
      Type Parameters:
      T1 - the element type of the first source
      T2 - the element type of the second source
      T3 - the element type of the third source
      T4 - the element type of the fourth source
      T5 - the element type of the fifth source
      T6 - the element type of the sixth source
      R - the combined output type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3, source4, source5, source6 or combiner is null
      See Also:
    • combineLatest

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull R> @NonNull Flowable<R> combineLatest(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T3> source3, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T4> source4, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T5> source5, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T6> source6, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T7> source7, @NonNull @NonNull Function7<? super @NonNull T1,? super @NonNull T2,? super @NonNull T3,? super @NonNull T4,? super @NonNull T5,? super @NonNull T6,? super @NonNull T7,? extends @NonNull 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 until 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.
      Type Parameters:
      T1 - the element type of the first source
      T2 - the element type of the second source
      T3 - the element type of the third source
      T4 - the element type of the fourth source
      T5 - the element type of the fifth source
      T6 - the element type of the sixth source
      T7 - the element type of the seventh source
      R - the combined output type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3, source4, source5, source6, source7 or combiner is null
      See Also:
    • combineLatest

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull R> @NonNull Flowable<R> combineLatest(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T3> source3, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T4> source4, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T5> source5, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T6> source6, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T7> source7, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T8> source8, @NonNull @NonNull Function8<? super @NonNull T1,? super @NonNull T2,? super @NonNull T3,? super @NonNull T4,? super @NonNull T5,? super @NonNull T6,? super @NonNull T7,? super @NonNull T8,? extends @NonNull 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 until 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.
      Type Parameters:
      T1 - the element type of the first source
      T2 - the element type of the second source
      T3 - the element type of the third source
      T4 - the element type of the fourth source
      T5 - the element type of the fifth source
      T6 - the element type of the sixth source
      T7 - the element type of the seventh source
      T8 - the element type of the eighth source
      R - the combined output type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3, source4, source5, source6, source7, source8 or combiner is null
      See Also:
    • combineLatest

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull T9, @NonNull R> @NonNull Flowable<R> combineLatest(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T3> source3, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T4> source4, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T5> source5, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T6> source6, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T7> source7, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T8> source8, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T9> source9, @NonNull @NonNull Function9<? super @NonNull T1,? super @NonNull T2,? super @NonNull T3,? super @NonNull T4,? super @NonNull T5,? super @NonNull T6,? super @NonNull T7,? super @NonNull T8,? super @NonNull T9,? extends @NonNull 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 until 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.
      Type Parameters:
      T1 - the element type of the first source
      T2 - the element type of the second source
      T3 - the element type of the third source
      T4 - the element type of the fourth source
      T5 - the element type of the fifth source
      T6 - the element type of the sixth source
      T7 - the element type of the seventh source
      T8 - the element type of the eighth source
      T9 - the element type of the ninth source
      R - the combined output type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3, source4, source5, source6, source7, source8, source9 or combiner is null
      See Also:
    • concat

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> concat(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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 that Publisher completes.
      Scheduler:
      concat does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the common value type of the sources
      Parameters:
      sources - the Iterable sequence of Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
    • concat

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> concat(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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 signaled. 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.
      Type Parameters:
      T - the common element base type
      Parameters:
      sources - a Publisher that emits Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      See Also:
    • concat

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> concat(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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 signaled. 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.
      Type Parameters:
      T - the common element base type
      Parameters:
      sources - a Publisher that emits Publishers
      prefetch - the number of Publishers to prefetch from the sources sequence.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if prefetch is non-positive
      See Also:
    • concat

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> concat(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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 that source Publisher completes.
      Scheduler:
      concat does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the common element base type
      Parameters:
      source1 - a Publisher to be concatenated
      source2 - a Publisher to be concatenated
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source1 or source2 is null
      See Also:
    • concat

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> concat(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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 that source Publisher completes.
      Scheduler:
      concat does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the common element base type
      Parameters:
      source1 - a Publisher to be concatenated
      source2 - a Publisher to be concatenated
      source3 - a Publisher to be concatenated
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2 or source3 is null
      See Also:
    • concat

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> concat(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source3, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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 that source Publisher completes.
      Scheduler:
      concat does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the common element base type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3 or source4 is null
      See Also:
    • concatArray

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @SafeVarargs @NonNull public static <@NonNull T> @NonNull Flowable<T> concatArray(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T>... sources)
      Concatenates a variable number of Publisher sources.

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

      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 that source Publisher completes.
      Scheduler:
      concatArray does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the common base value type
      Parameters:
      sources - the array of source Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
    • concatArrayDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @SafeVarargs @NonNull public static <@NonNull T> @NonNull Flowable<T> concatArrayDelayError(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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 that source Publisher completes.
      Scheduler:
      concatArrayDelayError does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the common base value type
      Parameters:
      sources - the array of source Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
    • concatArrayEager

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @SafeVarargs @NonNull public static <@NonNull T> @NonNull Flowable<T> concatArrayEager(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T>... sources)
      Concatenates an array 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.
      Type Parameters:
      T - the value type
      Parameters:
      sources - an array of Publishers that need to be eagerly concatenated
      Returns:
      the new Flowable instance with the specified concatenation behavior
      Throws:
      NullPointerException - if sources is null
      Since:
      2.0
    • concatArrayEager

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") @SafeVarargs public static <@NonNull T> @NonNull Flowable<T> concatArrayEager(int maxConcurrency, int prefetch, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T>... sources)
      Concatenates an array 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.
      Type Parameters:
      T - the value type
      Parameters:
      maxConcurrency - the maximum number of concurrent subscriptions at a time, Integer.MAX_VALUE is interpreted as an indication to subscribe to all sources at once
      prefetch - the number of elements to prefetch from each Publisher source
      sources - an array of Publishers that need to be eagerly concatenated
      Returns:
      the new Flowable instance with the specified concatenation behavior
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if maxConcurrency or prefetch is non-positive
      Since:
      2.0
    • concatArrayEagerDelayError

      @CheckReturnValue @SchedulerSupport("none") @BackpressureSupport(FULL) @SafeVarargs @NonNull public static <@NonNull T> @NonNull Flowable<T> concatArrayEagerDelayError(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T>... sources)
      Concatenates an array of Publishers eagerly into a single stream of values and delaying any errors until all sources terminate.

      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.
      Type Parameters:
      T - the value type
      Parameters:
      sources - an array of Publishers that need to be eagerly concatenated
      Returns:
      the new Flowable instance with the specified concatenation behavior
      Throws:
      NullPointerException - if sources is null
      Since:
      2.2.1 - experimental
    • concatArrayEagerDelayError

      @CheckReturnValue @SchedulerSupport("none") @BackpressureSupport(FULL) @SafeVarargs @NonNull public static <@NonNull T> @NonNull Flowable<T> concatArrayEagerDelayError(int maxConcurrency, int prefetch, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T>... sources)
      Concatenates an array of Publishers eagerly into a single stream of values and delaying any errors until all sources terminate.

      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.
      Type Parameters:
      T - the value type
      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 - an array of Publishers that need to be eagerly concatenated
      Returns:
      the new Flowable instance with the specified concatenation behavior
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if maxConcurrency or prefetch is non-positive
      Since:
      2.2.1 - experimental
    • concatDelayError

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> concatDelayError(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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 signaled. 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.
      Type Parameters:
      T - the common element base type
      Parameters:
      sources - the Iterable sequence of Publishers
      Returns:
      the new Flowable with the concatenating behavior
      Throws:
      NullPointerException - if sources is null
    • concatDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> concatDelayError(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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.
      Type Parameters:
      T - the common element base type
      Parameters:
      sources - the Publisher sequence of Publishers
      Returns:
      the new Flowable with the concatenating behavior
      Throws:
      NullPointerException - if sources is null
    • concatDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> concatDelayError(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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.
      Type Parameters:
      T - the common element base type
      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 inner Publisher terminates
      Returns:
      the new Flowable with the concatenating behavior
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if prefetch is null
    • concatEager

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> concatEager(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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.
      Type Parameters:
      T - the value type
      Parameters:
      sources - a sequence of Publishers that need to be eagerly concatenated
      Returns:
      the new Flowable instance with the specified concatenation behavior
      Throws:
      NullPointerException - if sources is null
      Since:
      2.0
    • concatEager

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> concatEager(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> sources, int maxConcurrency, int prefetch)
      Concatenates a sequence of Publishers eagerly into a single stream of values and runs a limited number of inner sequences at once.

      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.
      Type Parameters:
      T - the value type
      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 Flowable instance with the specified concatenation behavior
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if maxConcurrency or prefetch is non-positive
      Since:
      2.0
    • concatEager

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> concatEager(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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.
      Type Parameters:
      T - the value type
      Parameters:
      sources - a sequence of Publishers that need to be eagerly concatenated
      Returns:
      the new Flowable instance with the specified concatenation behavior
      Throws:
      NullPointerException - if sources is null
      Since:
      2.0
    • concatEager

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> concatEager(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> sources, int maxConcurrency, int prefetch)
      Concatenates a Publisher sequence of Publishers eagerly into a single stream of values and runs a limited number of inner sequences at once.

      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.
      Type Parameters:
      T - the value type
      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 Flowable instance with the specified concatenation behavior
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if maxConcurrency or prefetch is non-positive
      Since:
      2.0
    • concatEagerDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> concatEagerDelayError(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> sources)
      Concatenates a sequence of Publishers eagerly into a single stream of values, delaying errors until all the inner sequences terminate.

      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.
      Type Parameters:
      T - the value type
      Parameters:
      sources - a sequence of Publishers that need to be eagerly concatenated
      Returns:
      the new Flowable instance with the specified concatenation behavior
      Throws:
      NullPointerException - if sources is null
      Since:
      3.0.0
    • concatEagerDelayError

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> concatEagerDelayError(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> sources, int maxConcurrency, int prefetch)
      Concatenates a sequence of Publishers eagerly into a single stream of values, delaying errors until all the inner sequences terminate and runs a limited number of inner sequences at once.

      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.
      Type Parameters:
      T - the value type
      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 Flowable instance with the specified concatenation behavior
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if maxConcurrency or prefetch is non-positive
      Since:
      3.0.0
    • concatEagerDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> concatEagerDelayError(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> sources)
      Concatenates a Publisher sequence of Publishers eagerly into a single stream of values, delaying errors until all the inner and the outer sequences terminate.

      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.
      Type Parameters:
      T - the value type
      Parameters:
      sources - a sequence of Publishers that need to be eagerly concatenated
      Returns:
      the new Flowable instance with the specified concatenation behavior
      Throws:
      NullPointerException - if sources is null
      Since:
      3.0.0
    • concatEagerDelayError

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> concatEagerDelayError(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> sources, int maxConcurrency, int prefetch)
      Concatenates a Publisher sequence of Publishers eagerly into a single stream of values, delaying errors until all the inner and outer sequences terminate and runs a limited number of inner sequences at once.

      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.
      Type Parameters:
      T - the value type
      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 Flowable instance with the specified concatenation behavior
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if maxConcurrency or prefetch is non-positive
      Since:
      3.0.0
    • create

      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);
       

      Whenever a Subscriber subscribes to the returned Flowable, the provided FlowableOnSubscribe callback is invoked with a fresh instance of a FlowableEmitter that will interact only with that specific Subscriber. If this Subscriber cancels the flow (making FlowableEmitter.isCancelled() return true), other observers subscribed to the same returned Flowable are not affected.

      You should call the Emitter.onNext(Object), Emitter.onError(Throwable) and Emitter.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.
      Type Parameters:
      T - the element type
      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
      Throws:
      NullPointerException - if source or mode is null
      See Also:
    • defer

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> defer(@NonNull @NonNull Supplier<? extends @NonNull org.reactivestreams.Publisher<? extends @NonNull 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 a 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.
      Type Parameters:
      T - the type of the items emitted by the Publisher
      Parameters:
      supplier - the Publisher factory function to invoke for each Subscriber that subscribes to the resulting Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if supplier is null
      See Also:
    • 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.
      Type Parameters:
      T - the type of the items (ostensibly) emitted by the Publisher
      Returns:
      the shared Flowable instance
      See Also:
    • error

      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.
      Type Parameters:
      T - the type of the items (ostensibly) emitted by the resulting Flowable
      Parameters:
      supplier - a Supplier factory to return a Throwable for each individual Subscriber
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if supplier is null
      See Also:
    • error

      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.
      Type Parameters:
      T - the type of the items (ostensibly) emitted by the resulting Flowable
      Parameters:
      throwable - the particular Throwable to pass to onError
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if throwable is null
      See Also:
    • fromAction

      Returns a Flowable instance that runs the given Action for each Subscriber and emits either its exception or simply completes.

      Backpressure:
      This source doesn't produce any elements and effectively ignores downstream backpressure.
      Scheduler:
      fromAction does not operate by default on a particular Scheduler.
      Error handling:
      If the Action throws an exception, the respective Throwable is delivered to the downstream via Subscriber.onError(Throwable), except when the downstream has canceled the resulting Flowable source. In this latter case, the Throwable is delivered to the global error handler via RxJavaPlugins.onError(Throwable) as an UndeliverableException.
      Type Parameters:
      T - the target type
      Parameters:
      action - the Action to run for each Subscriber
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if action is null
      Since:
      3.0.0
    • fromArray

      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.
      Type Parameters:
      T - the type of items in the array and the type of items to be emitted by the resulting Flowable
      Parameters:
      items - the array of elements
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if items is null
      See Also:
    • fromCallable

      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.
      Error handling:
      If the Callable throws an exception, the respective Throwable is delivered to the downstream via Subscriber.onError(Throwable), except when the downstream has canceled this Flowable source. In this latter case, the Throwable is delivered to the global error handler via RxJavaPlugins.onError(Throwable) as an UndeliverableException.
      Type Parameters:
      T - the type of the item emitted by the Publisher
      Parameters:
      callable - 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:
      the new Flowable instance
      Throws:
      NullPointerException - if callable is null
      Since:
      2.0
      See Also:
    • fromCompletable

      Wraps a CompletableSource into a Flowable.

      Backpressure:
      This source doesn't produce any elements and effectively ignores downstream backpressure.
      Scheduler:
      fromCompletable does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the target type
      Parameters:
      completableSource - the CompletableSource to convert from
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if completableSource is null
    • fromFuture

      Converts a Future into a Publisher.

      The operator calls Future.get(), which is a blocking method, on the subscription thread. It is recommended applying subscribeOn(Scheduler) to move this blocking wait to a background thread, and if the Scheduler supports it, interrupt the wait when the flow is disposed.

      Also note that this operator will consume a CompletionStage-based Future subclass (such as CompletableFuture) in a blocking manner as well. Use the fromCompletionStage(CompletionStage) operator to convert and consume such sources in a non-blocking fashion instead.

      Unlike 1.x, canceling 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.
      Type Parameters:
      T - the type of object that the Future returns, and also the type of item to be emitted by the resulting Flowable
      Parameters:
      future - the source Future
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if future is null
      See Also:
    • fromFuture

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> fromFuture(@NonNull @NonNull Future<? extends @NonNull T> future, long timeout, @NonNull @NonNull TimeUnit unit)
      Converts a Future into a Publisher, with a timeout on the Future.

      The operator calls Future.get(long, TimeUnit), which is a blocking method, on the subscription thread. It is recommended applying subscribeOn(Scheduler) to move this blocking wait to a background thread, and if the Scheduler supports it, interrupt the wait when the flow is disposed.

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

      Also note that this operator will consume a CompletionStage-based Future subclass (such as CompletableFuture) in a blocking manner as well. Use the fromCompletionStage(CompletionStage) operator to convert and consume such sources in a non-blocking fashion instead.

      Backpressure:
      The operator honors backpressure from downstream.
      Scheduler:
      fromFuture does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the type of object that the Future returns, and also the type of item to be emitted by the resulting Flowable
      Parameters:
      future - the source Future
      timeout - the maximum time to wait before calling get
      unit - the TimeUnit of the timeout argument
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if future or unit is null
      See Also:
    • fromIterable

      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.
      Type Parameters:
      T - the type of items in the Iterable sequence and the type of items to be emitted by the resulting Flowable
      Parameters:
      source - the source Iterable sequence
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source is null
      See Also:
    • fromMaybe

      Returns a Flowable instance that when subscribed to, subscribes to the MaybeSource instance and emits onSuccess as a single item or forwards any onComplete or onError signal.

      Backpressure:
      The operator honors backpressure from downstream.
      Scheduler:
      fromMaybe does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the value type of the MaybeSource element
      Parameters:
      maybe - the MaybeSource instance to subscribe to, not null
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if maybe is null
      Since:
      3.0.0
    • fromObservable

      Converts the given ObservableSource into a Flowable by applying the specified backpressure strategy.

      Marble diagrams for the various backpressure strategies are as follows:

      Backpressure:
      The operator applies the chosen backpressure strategy of BackpressureStrategy enum.
      Scheduler:
      fromObservable does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the element type of the source and resulting sequence
      Parameters:
      source - the ObservableSource to convert
      strategy - the backpressure strategy to apply
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source or strategy is null
    • fromPublisher

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> fromPublisher(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> publisher)
      Converts an arbitrary Reactive Streams Publisher into a Flowable if not already a Flowable.

      The Publisher must follow the Reactive-Streams specification. Violating the specification may result in undefined behavior.

      If possible, use create(FlowableOnSubscribe, BackpressureStrategy) to create a source-like Flowable instead.

      Note that even though Publisher appears to be a functional interface, it is not recommended to implement it through a lambda as the specification requires state management that is not achievable with a stateless lambda.

      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.
      Type Parameters:
      T - the value type of the flow
      Parameters:
      publisher - the Publisher to convert
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if publisher is null
      See Also:
    • fromRunnable

      Returns a Flowable instance that runs the given Runnable for each Subscriber and emits either its unchecked exception or simply completes.

      If the code to be wrapped needs to throw a checked or more broader Throwable exception, that exception has to be converted to an unchecked exception by the wrapped code itself. Alternatively, use the fromAction(Action) method which allows the wrapped code to throw any Throwable exception and will signal it to observers as-is.

      Backpressure:
      This source doesn't produce any elements and effectively ignores downstream backpressure.
      Scheduler:
      fromRunnable does not operate by default on a particular Scheduler.
      Error handling:
      If the Runnable throws an exception, the respective Throwable is delivered to the downstream via Subscriber.onError(Throwable), except when the downstream has canceled the resulting Flowable source. In this latter case, the Throwable is delivered to the global error handler via RxJavaPlugins.onError(Throwable) as an UndeliverableException.
      Type Parameters:
      T - the target type
      Parameters:
      run - the Runnable to run for each Subscriber
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if run is null
      Since:
      3.0.0
      See Also:
    • fromSingle

      Returns a Flowable instance that when subscribed to, subscribes to the SingleSource instance and emits onSuccess as a single item or forwards the onError signal.

      Backpressure:
      The operator honors backpressure from downstream.
      Scheduler:
      fromSingle does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the value type of the SingleSource element
      Parameters:
      source - the SingleSource instance to subscribe to, not null
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source is null
      Since:
      3.0.0
    • fromSupplier

      Returns a Flowable that, when a Subscriber subscribes to it, invokes a supplier 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:
      fromSupplier does not operate by default on a particular Scheduler.
      Error handling:
      If the Supplier throws an exception, the respective Throwable is delivered to the downstream via Subscriber.onError(Throwable), except when the downstream has canceled this Flowable source. In this latter case, the Throwable is delivered to the global error handler via RxJavaPlugins.onError(Throwable) as an UndeliverableException.
      Type Parameters:
      T - the type of the item emitted by the Publisher
      Parameters:
      supplier - a function, the execution of which should be deferred; fromSupplier will invoke this function only when a Subscriber subscribes to the Publisher that fromSupplier returns
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if supplier is null
      Since:
      3.0.0
      See Also:
    • generate

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

      Note that the Emitter.onNext(T), Emitter.onError(java.lang.Throwable) and Emitter.onComplete() methods provided to the function via the Emitter instance should be called synchronously, never concurrently and only while the function body is executing. Calling them from multiple threads or outside the function call is not supported and leads to an undefined behavior.

      Backpressure:
      The operator honors downstream backpressure.
      Scheduler:
      generate does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the generated value type
      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. Signaling multiple onNext in a call will make the operator signal IllegalStateException.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if generator is null
    • generate

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

      Note that the Emitter.onNext(T), Emitter.onError(java.lang.Throwable) and Emitter.onComplete() methods provided to the function via the Emitter instance should be called synchronously, never concurrently and only while the function body is executing. Calling them from multiple threads or outside the function call is not supported and leads to an undefined behavior.

      Backpressure:
      The operator honors downstream backpressure.
      Scheduler:
      generate does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the generated value type
      S - the type of the per-Subscriber state
      Parameters:
      initialState - the Supplier 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. Signaling multiple onNext in a call will make the operator signal IllegalStateException.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if initialState or generator is null
    • generate

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

      Note that the Emitter.onNext(T), Emitter.onError(java.lang.Throwable) and Emitter.onComplete() methods provided to the function via the Emitter instance should be called synchronously, never concurrently and only while the function body is executing. Calling them from multiple threads or outside the function call is not supported and leads to an undefined behavior.

      Backpressure:
      The operator honors downstream backpressure.
      Scheduler:
      generate does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the generated value type
      S - the type of the per-Subscriber state
      Parameters:
      initialState - the Supplier 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. Signaling 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 canceled
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if initialState, generator or disposeState is null
    • generate

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

      Note that the Emitter.onNext(T), Emitter.onError(java.lang.Throwable) and Emitter.onComplete() methods provided to the function via the Emitter instance should be called synchronously, never concurrently and only while the function body is executing. Calling them from multiple threads or outside the function call is not supported and leads to an undefined behavior.

      Backpressure:
      The operator honors downstream backpressure.
      Scheduler:
      generate does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the generated value type
      S - the type of the per-Subscriber state
      Parameters:
      initialState - the Supplier 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. Signaling multiple onNext in a call will make the operator signal IllegalStateException.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if initialState or generator is null
    • generate

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

      Note that the Emitter.onNext(T), Emitter.onError(java.lang.Throwable) and Emitter.onComplete() methods provided to the function via the Emitter instance should be called synchronously, never concurrently and only while the function body is executing. Calling them from multiple threads or outside the function call is not supported and leads to an undefined behavior.

      Backpressure:
      The operator honors downstream backpressure.
      Scheduler:
      generate does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the generated value type
      S - the type of the per-Subscriber state
      Parameters:
      initialState - the Supplier 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. Signaling 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 canceled
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if initialState, generator or disposeState is null
    • interval

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public static @NonNull Flowable<Long> interval(long initialDelay, long period, @NonNull @NonNull 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. Downstream 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      Since:
      1.0.12
      See Also:
    • interval

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("custom") public static @NonNull Flowable<Long> interval(long initialDelay, long period, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull 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. Downstream 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      Since:
      1.0.12
      See Also:
    • interval

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public static @NonNull Flowable<Long> interval(long period, @NonNull @NonNull 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • interval

      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. Downstream 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • intervalRange

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") public static @NonNull Flowable<Long> intervalRange(long start, long count, long initialDelay, long period, @NonNull @NonNull 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 signaling 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
      Throws:
      NullPointerException - if unit is null
      IllegalArgumentException - if count is less than zero, or if start + count − 1 exceeds Long.MAX_VALUE
      See Also:
    • intervalRange

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("custom") public static @NonNull Flowable<Long> intervalRange(long start, long count, long initialDelay, long period, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull 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 signaling 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
      Throws:
      NullPointerException - if unit or scheduler is null
      IllegalArgumentException - if count is less than zero, or if start + count − 1 exceeds Long.MAX_VALUE
    • just

      Returns a Flowable that signals the given (constant reference) item and then completes.

      Note that the item is taken and re-emitted as is and not computed by any means by just. Use fromCallable(Callable) to generate a single item on demand (when Subscribers subscribe to it).

      See the multi-parameter overloads of just to emit more than one (constant reference) items one after the other. Use fromArray(Object...) to emit an arbitrary number of items that are known upfront.

      To emit the items of an Iterable sequence (such as a List), use fromIterable(Iterable).

      Backpressure:
      The operator honors backpressure from downstream.
      Scheduler:
      just does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the type of that item
      Parameters:
      item - the item to emit
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if item is null
      See Also:
    • just

      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.
      Type Parameters:
      T - the type of these items
      Parameters:
      item1 - first item
      item2 - second item
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if item1 or item2 is null
      See Also:
    • just

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> just(@NonNull T item1, @NonNull T item2, @NonNull 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.
      Type Parameters:
      T - the type of these items
      Parameters:
      item1 - first item
      item2 - second item
      item3 - third item
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if item1, item2 or item3 is null
      See Also:
    • just

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull 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.
      Type Parameters:
      T - the type of these items
      Parameters:
      item1 - first item
      item2 - second item
      item3 - third item
      item4 - fourth item
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if item1, item2, item3, or item4 is null
      See Also:
    • just

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull 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.
      Type Parameters:
      T - the type of these items
      Parameters:
      item1 - first item
      item2 - second item
      item3 - third item
      item4 - fourth item
      item5 - fifth item
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if item1, item2, item3, item4 or item5 is null
      See Also:
    • just

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5, @NonNull 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.
      Type Parameters:
      T - the type of these items
      Parameters:
      item1 - first item
      item2 - second item
      item3 - third item
      item4 - fourth item
      item5 - fifth item
      item6 - sixth item
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if item1, item2, item3, item4, item5 or item6 is null
      See Also:
    • just

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5, @NonNull T item6, @NonNull 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.
      Type Parameters:
      T - the type of these items
      Parameters:
      item1 - first item
      item2 - second item
      item3 - third item
      item4 - fourth item
      item5 - fifth item
      item6 - sixth item
      item7 - seventh item
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if item1, item2, item3, item4, item5, item6 or item7 is null
      See Also:
    • just

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5, @NonNull T item6, @NonNull T item7, @NonNull 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.
      Type Parameters:
      T - the type of these items
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if item1, item2, item3, item4, item5, item6, item7 or item8 is null
      See Also:
    • just

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5, @NonNull T item6, @NonNull T item7, @NonNull T item8, @NonNull 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.
      Type Parameters:
      T - the type of these items
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if item1, item2, item3, item4, item5, item6, item7, item8 or item9 is null
      See Also:
    • just

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> just(@NonNull T item1, @NonNull T item2, @NonNull T item3, @NonNull T item4, @NonNull T item5, @NonNull T item6, @NonNull T item7, @NonNull T item8, @NonNull T item9, @NonNull 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.
      Type Parameters:
      T - the type of these items
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if item1, item2, item3, item4, item5, item6, item7, item8, item9, or item10 is null
      See Also:
    • merge

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> merge(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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.
      Error handling:
      If any of the source Publishers signal a Throwable via onError, the resulting Flowable terminates with that Throwable and all other source Publishers are canceled. If more than one Publisher signals an error, the resulting Flowable may terminate with the first one's error or, depending on the concurrency of the sources, may terminate with a CompositeException containing two or more of the various error signals. Throwables that didn't make into the composite will be sent (individually) to the global error handler via RxJavaPlugins.onError(Throwable) method as UndeliverableException errors. Similarly, Throwables signaled by source(s) after the returned Flowable has been canceled or terminated with a (composite) error will be sent to the same global error handler. Use mergeDelayError(Iterable, int, int) to merge sources and terminate only when all source Publishers have completed or failed with an error.
      Type Parameters:
      T - the common element base type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if maxConcurrency or bufferSize is non-positive
      See Also:
    • mergeArray

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @SafeVarargs @NonNull public static <@NonNull T> @NonNull Flowable<T> mergeArray(int maxConcurrency, int bufferSize, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T>... sources)
      Flattens an array 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.
      Error handling:
      If any of the source Publishers signal a Throwable via onError, the resulting Flowable terminates with that Throwable and all other source Publishers are canceled. If more than one Publisher signals an error, the resulting Flowable may terminate with the first one's error or, depending on the concurrency of the sources, may terminate with a CompositeException containing two or more of the various error signals. Throwables that didn't make into the composite will be sent (individually) to the global error handler via RxJavaPlugins.onError(Throwable) method as UndeliverableException errors. Similarly, Throwables signaled by source(s) after the returned Flowable has been canceled or terminated with a (composite) error will be sent to the same global error handler. Use mergeArrayDelayError(int, int, Publisher[]) to merge sources and terminate only when all source Publishers have completed or failed with an error.
      Type Parameters:
      T - the common element base type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if maxConcurrency or bufferSize is non-positive
      See Also:
    • merge

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> merge(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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.
      Error handling:
      If any of the source Publishers signal a Throwable via onError, the resulting Flowable terminates with that Throwable and all other source Publishers are canceled. If more than one Publisher signals an error, the resulting Flowable may terminate with the first one's error or, depending on the concurrency of the sources, may terminate with a CompositeException containing two or more of the various error signals. Throwables that didn't make into the composite will be sent (individually) to the global error handler via RxJavaPlugins.onError(Throwable) method as UndeliverableException errors. Similarly, Throwables signaled by source(s) after the returned Flowable has been canceled or terminated with a (composite) error will be sent to the same global error handler. Use mergeDelayError(Iterable) to merge sources and terminate only when all source Publishers have completed or failed with an error.
      Type Parameters:
      T - the common element base type
      Parameters:
      sources - the Iterable of Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      See Also:
    • merge

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> merge(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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.
      Error handling:
      If any of the source Publishers signal a Throwable via onError, the resulting Flowable terminates with that Throwable and all other source Publishers are canceled. If more than one Publisher signals an error, the resulting Flowable may terminate with the first one's error or, depending on the concurrency of the sources, may terminate with a CompositeException containing two or more of the various error signals. Throwables that didn't make into the composite will be sent (individually) to the global error handler via RxJavaPlugins.onError(Throwable) method as UndeliverableException errors. Similarly, Throwables signaled by source(s) after the returned Flowable has been canceled or terminated with a (composite) error will be sent to the same global error handler. Use mergeDelayError(Iterable, int) to merge sources and terminate only when all source Publishers have completed or failed with an error.
      Type Parameters:
      T - the common element base type
      Parameters:
      sources - the Iterable of Publishers
      maxConcurrency - the maximum number of Publishers that may be subscribed to concurrently
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if maxConcurrency is less than or equal to 0
      See Also:
    • merge

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> merge(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> sources)
      Flattens a Publisher that emits Publishers into a single Publisher that emits the items emitted by thos 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.
      Error handling:
      If any of the source Publishers signal a Throwable via onError, the resulting Flowable terminates with that Throwable and all other source Publishers are canceled. If more than one Publisher signals an error, the resulting Flowable may terminate with the first one's error or, depending on the concurrency of the sources, may terminate with a CompositeException containing two or more of the various error signals. Throwables that didn't make into the composite will be sent (individually) to the global error handler via RxJavaPlugins.onError(Throwable) method as UndeliverableException errors. Similarly, Throwables signaled by source(s) after the returned Flowable has been canceled or terminated with a (composite) error will be sent to the same global error handler. Use mergeDelayError(Publisher) to merge sources and terminate only when all source Publishers have completed or failed with an error.
      Type Parameters:
      T - the common element base type
      Parameters:
      sources - a Publisher that emits Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      See Also:
    • merge

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> merge(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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.
      Error handling:
      If any of the source Publishers signal a Throwable via onError, the resulting Flowable terminates with that Throwable and all other source Publishers are canceled. If more than one Publisher signals an error, the resulting Flowable may terminate with the first one's error or, depending on the concurrency of the sources, may terminate with a CompositeException containing two or more of the various error signals. Throwables that didn't make into the composite will be sent (individually) to the global error handler via RxJavaPlugins.onError(Throwable) method as UndeliverableException errors. Similarly, Throwables signaled by source(s) after the returned Flowable has been canceled or terminated with a (composite) error will be sent to the same global error handler. Use mergeDelayError(Publisher, int) to merge sources and terminate only when all source Publishers have completed or failed with an error.
      Type Parameters:
      T - the common element base type
      Parameters:
      sources - a Publisher that emits Publishers
      maxConcurrency - the maximum number of Publishers that may be subscribed to concurrently
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if maxConcurrency is less than or equal to 0
      Since:
      1.1.0
      See Also:
    • mergeArray

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @SafeVarargs @NonNull public static <@NonNull T> @NonNull Flowable<T> mergeArray(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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.
      Error handling:
      If any of the source Publishers signal a Throwable via onError, the resulting Flowable terminates with that Throwable and all other source Publishers are canceled. If more than one Publisher signals an error, the resulting Flowable may terminate with the first one's error or, depending on the concurrency of the sources, may terminate with a CompositeException containing two or more of the various error signals. Throwables that didn't make into the composite will be sent (individually) to the global error handler via RxJavaPlugins.onError(Throwable) method as UndeliverableException errors. Similarly, Throwables signaled by source(s) after the returned Flowable has been canceled or terminated with a (composite) error will be sent to the same global error handler. Use mergeArrayDelayError(Publisher...) to merge sources and terminate only when all source Publishers have completed or failed with an error.
      Type Parameters:
      T - the common element base type
      Parameters:
      sources - the array of Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      See Also:
    • merge

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> merge(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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.
      Error handling:
      If any of the source Publishers signal a Throwable via onError, the resulting Flowable terminates with that Throwable and all other source Publishers are canceled. If more than one Publisher signals an error, the resulting Flowable may terminate with the first one's error or, depending on the concurrency of the sources, may terminate with a CompositeException containing two or more of the various error signals. Throwables that didn't make into the composite will be sent (individually) to the global error handler via RxJavaPlugins.onError(Throwable) method as UndeliverableException errors. Similarly, Throwables signaled by source(s) after the returned Flowable has been canceled or terminated with a (composite) error will be sent to the same global error handler. Use mergeDelayError(Publisher, Publisher) to merge sources and terminate only when all source Publishers have completed or failed with an error.
      Type Parameters:
      T - the common element base type
      Parameters:
      source1 - a Publisher to be merged
      source2 - a Publisher to be merged
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source1 or source2 is null
      See Also:
    • merge

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> merge(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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.
      Error handling:
      If any of the source Publishers signal a Throwable via onError, the resulting Flowable terminates with that Throwable and all other source Publishers are canceled. If more than one Publisher signals an error, the resulting Flowable may terminate with the first one's error or, depending on the concurrency of the sources, may terminate with a CompositeException containing two or more of the various error signals. Throwables that didn't make into the composite will be sent (individually) to the global error handler via RxJavaPlugins.onError(Throwable) method as UndeliverableException errors. Similarly, Throwables signaled by source(s) after the returned Flowable has been canceled or terminated with a (composite) error will be sent to the same global error handler. Use mergeDelayError(Publisher, Publisher, Publisher) to merge sources and terminate only when all source Publishers have completed or failed with an error.
      Type Parameters:
      T - the common element base type
      Parameters:
      source1 - a Publisher to be merged
      source2 - a Publisher to be merged
      source3 - a Publisher to be merged
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2 or source3 is null
      See Also:
    • merge

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> merge(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source3, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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.
      Error handling:
      If any of the source Publishers signal a Throwable via onError, the resulting Flowable terminates with that Throwable and all other source Publishers are canceled. If more than one Publisher signals an error, the resulting Flowable may terminate with the first one's error or, depending on the concurrency of the sources, may terminate with a CompositeException containing two or more of the various error signals. Throwables that didn't make into the composite will be sent (individually) to the global error handler via RxJavaPlugins.onError(Throwable) method as UndeliverableException errors. Similarly, Throwables signaled by source(s) after the returned Flowable has been canceled or terminated with a (composite) error will be sent to the same global error handler. Use mergeDelayError(Publisher, Publisher, Publisher, Publisher) to merge sources and terminate only when all source Publishers have completed or failed with an error.
      Type Parameters:
      T - the common element base type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3 or source4 is null
      See Also:
    • mergeDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> mergeDelayError(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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.
      Type Parameters:
      T - the common element base type
      Parameters:
      sources - the Iterable of Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      See Also:
    • mergeDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> mergeDelayError(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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.
      Type Parameters:
      T - the common element base type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if maxConcurrency or bufferSize is non-positive
      See Also:
    • mergeArrayDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @SafeVarargs @NonNull public static <@NonNull T> @NonNull Flowable<T> mergeArrayDelayError(int maxConcurrency, int bufferSize, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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.
      Type Parameters:
      T - the common element base type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if maxConcurrency or bufferSize is non-positive
      See Also:
    • mergeDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> mergeDelayError(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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.
      Type Parameters:
      T - the common element base type
      Parameters:
      sources - the Iterable of Publishers
      maxConcurrency - the maximum number of Publishers that may be subscribed to concurrently
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if maxConcurrency is non-positive
      See Also:
    • mergeDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> mergeDelayError(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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.
      Type Parameters:
      T - the common element base type
      Parameters:
      sources - a Publisher that emits Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      See Also:
    • mergeDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> mergeDelayError(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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.
      Type Parameters:
      T - the common element base type
      Parameters:
      sources - a Publisher that emits Publishers
      maxConcurrency - the maximum number of Publishers that may be subscribed to concurrently
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if maxConcurrency is non-positive
      Since:
      2.0
      See Also:
    • mergeArrayDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @SafeVarargs @NonNull public static <@NonNull T> @NonNull Flowable<T> mergeArrayDelayError(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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.
      Type Parameters:
      T - the common element base type
      Parameters:
      sources - the array of Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      See Also:
    • mergeDelayError

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> mergeDelayError(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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.
      Type Parameters:
      T - the common element base type
      Parameters:
      source1 - a Publisher to be merged
      source2 - a Publisher to be merged
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source1 or source2 is null
      See Also:
    • mergeDelayError

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> mergeDelayError(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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.
      Type Parameters:
      T - the common element base type
      Parameters:
      source1 - a Publisher to be merged
      source2 - a Publisher to be merged
      source3 - a Publisher to be merged
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2 or source3 is null
      See Also:
    • mergeDelayError

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> mergeDelayError(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source3, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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.
      Type Parameters:
      T - the common element base type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3 or source4 is null
      See Also:
    • 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.
      Type Parameters:
      T - the type of items (not) emitted by the Publisher
      Returns:
      the shared Flowable instance
      See Also:
    • range

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static @NonNull 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:
      the new Flowable instance
      Throws:
      IllegalArgumentException - if count is less than zero, or if start + count − 1 exceeds Integer.MAX_VALUE
      See Also:
    • rangeLong

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static @NonNull 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:
      the new Flowable instance
      Throws:
      IllegalArgumentException - if count is less than zero, or if start + count − 1 exceeds Long.MAX_VALUE
      See Also:
    • sequenceEqual

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Single<Boolean> sequenceEqual(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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.
      Type Parameters:
      T - the type of items emitted by each Publisher
      Parameters:
      source1 - the first Publisher to compare
      source2 - the second Publisher to compare
      Returns:
      the new Single instance
      Throws:
      NullPointerException - if source1 or source2 is null
      See Also:
    • sequenceEqual

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Single<Boolean> sequenceEqual(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source2, @NonNull @NonNull BiPredicate<? super @NonNull T,? super @NonNull 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.
      Type Parameters:
      T - the type of items emitted by each Publisher
      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:
      the new Single instance
      Throws:
      NullPointerException - if source1, source2 or isEqual is null
      See Also:
    • sequenceEqual

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T> @NonNull Single<Boolean> sequenceEqual(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source2, @NonNull @NonNull BiPredicate<? super @NonNull T,? super @NonNull 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.
      Type Parameters:
      T - the type of items emitted by each Publisher
      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:
      the new Single instance
      Throws:
      NullPointerException - if source1, source2 or isEqual is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • sequenceEqual

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Single<Boolean> sequenceEqual(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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.
      Type Parameters:
      T - the type of items emitted by each Publisher
      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:
      the new Single instance
      Throws:
      NullPointerException - if source1 or source2 is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • switchOnNext

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> switchOnNext(@NonNull @NonNull org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends @NonNull 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 Flowable 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 canceled 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.
      Type Parameters:
      T - the item type
      Parameters:
      sources - the source Publisher that emits Publishers
      bufferSize - the number of items to prefetch from the inner Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • switchOnNext

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> switchOnNext(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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 Flowable 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 canceled 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.
      Type Parameters:
      T - the item type
      Parameters:
      sources - the source Publisher that emits Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      See Also:
    • switchOnNextDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> switchOnNextDelayError(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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 Flowable 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 signaled.

      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.
      Type Parameters:
      T - the item type
      Parameters:
      sources - the source Publisher that emits Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      Since:
      2.0
      See Also:
    • switchOnNextDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public static <@NonNull T> @NonNull Flowable<T> switchOnNextDelayError(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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 Flowable 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 signaled.

      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.
      Type Parameters:
      T - the item type
      Parameters:
      sources - the source Publisher that emits Publishers
      prefetch - the number of items to prefetch from the inner Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources is null
      IllegalArgumentException - if prefetch is non-positive
      Since:
      2.0
      See Also:
    • timer

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public static @NonNull Flowable<Long> timer(long delay, @NonNull @NonNull 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • timer

      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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • unsafeCreate

      @CheckReturnValue @NonNull @BackpressureSupport(NONE) @SchedulerSupport("none") public static <@NonNull T> @NonNull Flowable<T> unsafeCreate(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull 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.
      Type Parameters:
      T - the value type emitted
      Parameters:
      onSubscribe - the Publisher instance to wrap
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onSubscribe is null
      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.
    • using

      @CheckReturnValue @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") @NonNull public static <@NonNull T, @NonNull D> @NonNull Flowable<T> using(@NonNull @NonNull Supplier<? extends @NonNull D> resourceSupplier, @NonNull @NonNull Function<? super @NonNull D,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> sourceSupplier, @NonNull @NonNull Consumer<? super @NonNull D> resourceCleanup)
      Constructs a Flowable that creates a dependent resource object, a Publisher with that resource and calls the provided resourceDisposer function if this inner source terminates or the downstream cancels the flow.

      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.
      Type Parameters:
      T - the element type of the generated Publisher
      D - the type of the resource associated with the output sequence
      Parameters:
      resourceSupplier - the factory function to create a resource object that depends on the Publisher
      sourceSupplier - the factory function to create a Publisher
      resourceCleanup - the function that will dispose of the resource
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if resourceSupplier, sourceSupplier or resourceCleanup is null
      See Also:
    • using

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") public static <@NonNull T, @NonNull D> @NonNull Flowable<T> using(@NonNull @NonNull Supplier<? extends @NonNull D> resourceSupplier, @NonNull @NonNull Function<? super @NonNull D,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> sourceSupplier, @NonNull @NonNull Consumer<? super @NonNull D> resourceCleanup, boolean eager)
      Constructs a Flowable that creates a dependent resource object, a Publisher with that resource and calls the provided resourceDisposer function if this inner source terminates or the downstream disposes the flow; doing it before these end-states have been reached if eager == true, after otherwise.

      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.
      Type Parameters:
      T - the element type of the generated Publisher
      D - the type of the resource associated with the output sequence
      Parameters:
      resourceSupplier - the factory function to create a resource object that depends on the Publisher
      sourceSupplier - the factory function to create a Publisher
      resourceCleanup - the function that will dispose of the resource
      eager - If true, the resource disposal will happen either on a cancel() call before the upstream is disposed or just before the emission of a terminal event (onComplete or onError). If false the resource disposal will happen either on a cancel() call after the upstream is disposed or just after the emission of a terminal event (onComplete or onError).
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if resourceSupplier, sourceSupplier or resourceCleanup is null
      Since:
      2.0
      See Also:
    • zip

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T, @NonNull R> @NonNull Flowable<R> zip(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> sources, @NonNull @NonNull Function<? super Object[],? extends @NonNull 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 Flowable 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 the order they are specified and completes eagerly if one of the sources is shorter than the rest while canceling 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.
      Type Parameters:
      T - the common value type
      R - the zipped result type
      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 Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources or zipper is null
      See Also:
    • zip

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T, @NonNull R> @NonNull Flowable<R> zip(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> sources, @NonNull @NonNull Function<? super Object[],? extends @NonNull 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 Floawble 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 the order they are specified and completes eagerly if one of the sources is shorter than the rest while canceling 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.
      Type Parameters:
      T - the common source value type
      R - the zipped result type
      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 Flowable
      delayError - delay errors signaled by any of the source Publisher until all Publishers terminate
      bufferSize - the number of elements to prefetch from each source Publisher
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sources or zipper is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • zip

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull R> @NonNull Flowable<R> zip(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull BiFunction<? super @NonNull T1,? super @NonNull T2,? extends @NonNull 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 Flowable 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 the order they are specified and completes eagerly if one of the sources is shorter than the rest while canceling 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.
      Type Parameters:
      T1 - the value type of the first source
      T2 - the value type of the second source
      R - the zipped result type
      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 Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2 or zipper is null
      See Also:
    • zip

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull R> @NonNull Flowable<R> zip(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull BiFunction<? super @NonNull T1,? super @NonNull T2,? extends @NonNull 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 Flowable 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 the order they are specified and completes eagerly if one of the sources is shorter than the rest while canceling 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.
      Type Parameters:
      T1 - the value type of the first source
      T2 - the value type of the second source
      R - the zipped result type
      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 Flowable
      delayError - delay errors from any of the source Publishers till the other terminates
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2 or zipper is null
      See Also:
    • zip

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull R> @NonNull Flowable<R> zip(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull BiFunction<? super @NonNull T1,? super @NonNull T2,? extends @NonNull 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 Flowable 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 the order they are specified and completes eagerly if one of the sources is shorter than the rest while canceling 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.
      Type Parameters:
      T1 - the value type of the first source
      T2 - the value type of the second source
      R - the zipped result type
      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 Flowable
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2 or zipper is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • zip

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull R> @NonNull Flowable<R> zip(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T3> source3, @NonNull @NonNull Function3<? super @NonNull T1,? super @NonNull T2,? super @NonNull T3,? extends @NonNull 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 Flowable 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 the order they are specified and completes eagerly if one of the sources is shorter than the rest while canceling 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.
      Type Parameters:
      T1 - the value type of the first source
      T2 - the value type of the second source
      T3 - the value type of the third source
      R - the zipped result type
      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 Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3 or zipper is null
      See Also:
    • zip

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull R> @NonNull Flowable<R> zip(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T3> source3, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T4> source4, @NonNull @NonNull Function4<? super @NonNull T1,? super @NonNull T2,? super @NonNull T3,? super @NonNull T4,? extends @NonNull 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 Flowable 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 the order they are specified and completes eagerly if one of the sources is shorter than the rest while canceling 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.
      Type Parameters:
      T1 - the value type of the first source
      T2 - the value type of the second source
      T3 - the value type of the third source
      T4 - the value type of the fourth source
      R - the zipped result type
      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 Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3, source4 or zipper is null
      See Also:
    • zip

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull R> @NonNull Flowable<R> zip(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T3> source3, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T4> source4, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T5> source5, @NonNull @NonNull Function5<? super @NonNull T1,? super @NonNull T2,? super @NonNull T3,? super @NonNull T4,? super @NonNull T5,? extends @NonNull 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 Flowable 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 the order they are specified and completes eagerly if one of the sources is shorter than the rest while canceling 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.
      Type Parameters:
      T1 - the value type of the first source
      T2 - the value type of the second source
      T3 - the value type of the third source
      T4 - the value type of the fourth source
      T5 - the value type of the fifth source
      R - the zipped result type
      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 Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3, source4, source5 or zipper is null
      See Also:
    • zip

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull R> @NonNull Flowable<R> zip(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T3> source3, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T4> source4, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T5> source5, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T6> source6, @NonNull @NonNull Function6<? super @NonNull T1,? super @NonNull T2,? super @NonNull T3,? super @NonNull T4,? super @NonNull T5,? super @NonNull T6,? extends @NonNull 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 Flowable 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 the order they are specified and completes eagerly if one of the sources is shorter than the rest while canceling 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.
      Type Parameters:
      T1 - the value type of the first source
      T2 - the value type of the second source
      T3 - the value type of the third source
      T4 - the value type of the fourth source
      T5 - the value type of the fifth source
      T6 - the value type of the sixth source
      R - the zipped result type
      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 Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3, source4, source5, source6 or zipper is null
      See Also:
    • zip

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull R> @NonNull Flowable<R> zip(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T3> source3, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T4> source4, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T5> source5, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T6> source6, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T7> source7, @NonNull @NonNull Function7<? super @NonNull T1,? super @NonNull T2,? super @NonNull T3,? super @NonNull T4,? super @NonNull T5,? super @NonNull T6,? super @NonNull T7,? extends @NonNull 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 Flowable 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 the order they are specified and completes eagerly if one of the sources is shorter than the rest while canceling 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.
      Type Parameters:
      T1 - the value type of the first source
      T2 - the value type of the second source
      T3 - the value type of the third source
      T4 - the value type of the fourth source
      T5 - the value type of the fifth source
      T6 - the value type of the sixth source
      T7 - the value type of the seventh source
      R - the zipped result type
      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 Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3, source4, source5, source6, source7 or zipper is null
      See Also:
    • zip

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull R> @NonNull Flowable<R> zip(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T3> source3, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T4> source4, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T5> source5, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T6> source6, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T7> source7, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T8> source8, @NonNull @NonNull Function8<? super @NonNull T1,? super @NonNull T2,? super @NonNull T3,? super @NonNull T4,? super @NonNull T5,? super @NonNull T6,? super @NonNull T7,? super @NonNull T8,? extends @NonNull 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 Flowable 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 the order they are specified and completes eagerly if one of the sources is shorter than the rest while canceling 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.
      Type Parameters:
      T1 - the value type of the first source
      T2 - the value type of the second source
      T3 - the value type of the third source
      T4 - the value type of the fourth source
      T5 - the value type of the fifth source
      T6 - the value type of the sixth source
      T7 - the value type of the seventh source
      T8 - the value type of the eighth source
      R - the zipped result type
      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 Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3, source4, source5, source6, source7, source8 or zipper is null
      See Also:
    • zip

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public static <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull T5, @NonNull T6, @NonNull T7, @NonNull T8, @NonNull T9, @NonNull R> @NonNull Flowable<R> zip(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T2> source2, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T3> source3, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T4> source4, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T5> source5, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T6> source6, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T7> source7, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T8> source8, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T9> source9, @NonNull @NonNull Function9<? super @NonNull T1,? super @NonNull T2,? super @NonNull T3,? super @NonNull T4,? super @NonNull T5,? super @NonNull T6,? super @NonNull T7,? super @NonNull T8,? super @NonNull T9,? extends @NonNull 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 Flowable 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 the order they are specified and completes eagerly if one of the sources is shorter than the rest while canceling 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.
      Type Parameters:
      T1 - the value type of the first source
      T2 - the value type of the second source
      T3 - the value type of the third source
      T4 - the value type of the fourth source
      T5 - the value type of the fifth source
      T6 - the value type of the sixth source
      T7 - the value type of the seventh source
      T8 - the value type of the eighth source
      T9 - the value type of the ninth source
      R - the zipped result type
      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 Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3, source4, source5, source6, source7, source8, source9 or zipper is null
      See Also:
    • zipArray

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") @SafeVarargs public static <@NonNull T, @NonNull R> @NonNull Flowable<R> zipArray(@NonNull @NonNull Function<? super Object[],? extends @NonNull R> zipper, boolean delayError, int bufferSize, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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 Flowable 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 the order they are specified and completes eagerly if one of the sources is shorter than the rest while canceling 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.
      Type Parameters:
      T - the common element type
      R - the result type
      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 Flowable
      delayError - delay errors signaled 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:
      the new Flowable instance
      Throws:
      NullPointerException - if sources or zipper is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • all

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

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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:
      the new Single instance
      Throws:
      NullPointerException - if predicate is null
      See Also:
    • ambWith

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final @NonNull Flowable<T> ambWith(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> other)
      Mirrors the Publisher (current or provided) that first either emits an item or sends a termination notification.

      When the current Flowable signals an item or terminates first, the subscription to the other Publisher is canceled. If the other Publisher signals an item or terminates first, the subscription to the current Flowable is canceled.

      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.
      Error handling:
      If the losing Publisher signals an error, the error is routed to the global error handler via RxJavaPlugins.onError(Throwable).
      Parameters:
      other - a Publisher competing to react first. A subscription to this provided Publisher will occur after subscribing to the current Flowable.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other is null
      See Also:
    • any

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

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

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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 current Flowable
      Returns:
      the new Single instance
      Throws:
      NullPointerException - if predicate is null
      See Also:
    • blockingFirst

      Returns the first item emitted by this Flowable, or throws NoSuchElementException if it emits no items.
      Backpressure:
      The operator consumes the current Flowable in an unbounded manner (i.e., no backpressure applied to it).
      Scheduler:
      blockingFirst does not operate by default on a particular Scheduler.
      Error handling:
      If the source signals an error, the operator wraps a checked Exception into RuntimeException and throws that. Otherwise, RuntimeExceptions and Errors are rethrown as they are.
      Returns:
      the new Flowable instance
      Throws:
      NoSuchElementException - if this Flowable emits no items
      See Also:
    • blockingFirst

      Returns the first item emitted by this Flowable, or a default value if it emits no items.
      Backpressure:
      The operator consumes the current Flowable in an unbounded manner (i.e., no backpressure applied to it).
      Scheduler:
      blockingFirst does not operate by default on a particular Scheduler.
      Error handling:
      If the source signals an error, the operator wraps a checked Exception into RuntimeException and throws that. Otherwise, RuntimeExceptions and Errors are rethrown as they are.
      Parameters:
      defaultItem - a default value to return if this Flowable emits no items
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if defaultItem is null
      See Also:
    • blockingForEach

      @BackpressureSupport(FULL) @SchedulerSupport("none") public final void blockingForEach(@NonNull @NonNull Consumer<? super @NonNull T> onNext)
      Consumes the current Flowable in a blocking fashion and invokes the given Consumer with each upstream item on the current thread until the upstream terminates.

      Note: the method will only return if the upstream terminates or the current thread is interrupted.

      This method executes the Consumer on the current thread while subscribe(Consumer) executes the consumer on the original caller thread of the sequence.

      Backpressure:
      The operator requests bufferSize() upfront, then 75% of this amount when 75% is received.
      Scheduler:
      blockingForEach does not operate by default on a particular Scheduler.
      Error handling:
      If the source signals an error, the operator wraps a checked Exception into RuntimeException and throws that. Otherwise, RuntimeExceptions and Errors are rethrown as they are.
      Parameters:
      onNext - the Consumer to invoke for each item emitted by the Flowable
      Throws:
      NullPointerException - if onNext is null
      RuntimeException - if an error occurs; Errors and RuntimeExceptions are rethrown as they are, checked Exceptions are wrapped into RuntimeExceptions
      See Also:
    • blockingForEach

      @BackpressureSupport(FULL) @SchedulerSupport("none") public final void blockingForEach(@NonNull @NonNull Consumer<? super @NonNull T> onNext, int bufferSize)
      Consumes the current Flowable in a blocking fashion and invokes the given Consumer with each upstream item on the current thread until the upstream terminates.

      Note: the method will only return if the upstream terminates or the current thread is interrupted.

      This method executes the Consumer on the current thread while subscribe(Consumer) executes the consumer on the original caller thread of the sequence.

      Backpressure:
      The operator requests the given prefetch amount upfront, then 75% of this amount when 75% is received.
      Scheduler:
      blockingForEach does not operate by default on a particular Scheduler.
      Error handling:
      If the source signals an error, the operator wraps a checked Exception into RuntimeException and throws that. Otherwise, RuntimeExceptions and Errors are rethrown as they are.
      Parameters:
      onNext - the Consumer to invoke for each item emitted by the Flowable
      bufferSize - the number of items to prefetch upfront, then 75% of it after 75% received
      Throws:
      NullPointerException - if onNext is null
      IllegalArgumentException - if bufferSize is non-positive
      RuntimeException - if an error occurs; Errors and RuntimeExceptions are rethrown as they are, checked Exceptions are wrapped into RuntimeExceptions
      See Also:
    • 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:
      the new Iterable instance
      See Also:
    • blockingIterable

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final @NonNull 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:
      the new Iterable instance
      Throws:
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • blockingLast

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

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner (i.e., no backpressure applied to it).
      Scheduler:
      blockingLast does not operate by default on a particular Scheduler.
      Error handling:
      If the source signals an error, the operator wraps a checked Exception into RuntimeException and throws that. Otherwise, RuntimeExceptions and Errors are rethrown as they are.
      Returns:
      the new Flowable instance
      Throws:
      NoSuchElementException - if this Flowable emits no items
      See Also:
    • blockingLast

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

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner (i.e., no backpressure applied to it).
      Scheduler:
      blockingLast does not operate by default on a particular Scheduler.
      Error handling:
      If the source signals an error, the operator wraps a checked Exception into RuntimeException and throws that. Otherwise, RuntimeExceptions and Errors are rethrown as they are.
      Parameters:
      defaultItem - a default value to return if this Flowable emits no items
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if defaultItem is null
      See Also:
    • 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 current Flowable in an unbounded manner (i.e., no backpressure applied to it).
      Scheduler:
      blockingLatest does not operate by default on a particular Scheduler.
      Returns:
      the new Iterable instance
      See Also:
    • blockingMostRecent

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

      Backpressure:
      The operator consumes the current 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:
      the new Iterable instance
      Throws:
      NullPointerException - if initialItem is null
      See Also:
    • blockingNext

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

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner (i.e., no backpressure applied to it).
      Scheduler:
      blockingNext does not operate by default on a particular Scheduler.
      Returns:
      the new Iterable instance
      See Also:
    • blockingSingle

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

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner (i.e., no backpressure applied to it).
      Scheduler:
      blockingSingle does not operate by default on a particular Scheduler.
      Error handling:
      If the source signals an error, the operator wraps a checked Exception into RuntimeException and throws that. Otherwise, RuntimeExceptions and Errors are rethrown as they are.
      Returns:
      the new Flowable instance
      See Also:
    • blockingSingle

      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 current Flowable in an unbounded manner (i.e., no backpressure applied to it).
      Scheduler:
      blockingSingle does not operate by default on a particular Scheduler.
      Error handling:
      If the source signals an error, the operator wraps a checked Exception into RuntimeException and throws that. Otherwise, RuntimeExceptions and Errors are rethrown as they are.
      Parameters:
      defaultItem - a default value to return if this Flowable emits no items
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if defaultItem is null
      See Also:
    • toFuture

      Returns a Future representing the only value emitted by this Flowable.

      If the Flowable emits more than one item, Future will receive an IndexOutOfBoundsException. If the Flowable is empty, Future will receive a NoSuchElementException. The Flowable source has to terminate in order for the returned Future to terminate as well.

      If the Flowable may emit more than one item, use Flowable.toList().toFuture().

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner (i.e., no backpressure applied to it).
      Scheduler:
      toFuture does not operate by default on a particular Scheduler.
      Returns:
      the new Future instance
      See Also:
    • blockingSubscribe

      @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final void blockingSubscribe()
      Runs the current Flowable to a terminal event, ignoring any values and rethrowing any exception.

      Note that calling this method will block the caller thread until the upstream terminates normally or with an error. Therefore, calling this method from special threads such as the Android Main Thread or the Swing Event Dispatch Thread is not recommended.

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

      @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final void blockingSubscribe(@NonNull @NonNull Consumer<? super @NonNull 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(Throwable) handler. Using the overloads blockingSubscribe(Consumer, Consumer) or blockingSubscribe(Consumer, Consumer, Action) instead is recommended.

      Note that calling this method will block the caller thread until the upstream terminates normally or with an error. Therefore, calling this method from special threads such as the Android Main Thread or the Swing Event Dispatch Thread is not recommended.

      Backpressure:
      The operator consumes the current 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
      Throws:
      NullPointerException - if onNext is null
      Since:
      2.0
      See Also:
    • blockingSubscribe

      @BackpressureSupport(FULL) @SchedulerSupport("none") public final void blockingSubscribe(@NonNull @NonNull Consumer<? super @NonNull T> onNext, int bufferSize)
      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(Throwable) handler. Using the overloads blockingSubscribe(Consumer, Consumer) or blockingSubscribe(Consumer, Consumer, Action) instead is recommended.

      Note that calling this method will block the caller thread until the upstream terminates normally or with an error. Therefore, calling this method from special threads such as the Android Main Thread or the Swing Event Dispatch Thread is not recommended.

      Backpressure:
      The operator consumes the current Flowable in an bounded manner (up to bufferSize outstanding request amount for items).
      Scheduler:
      blockingSubscribe does not operate by default on a particular Scheduler.

      History: 2.1.15 - experimental

      Parameters:
      onNext - the callback action for each source value
      bufferSize - the size of the buffer
      Throws:
      NullPointerException - if onNext is null
      IllegalArgumentException - if bufferSize is non-positive
      Since:
      2.2
      See Also:
    • blockingSubscribe

      @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final void blockingSubscribe(@NonNull @NonNull Consumer<? super @NonNull T> onNext, @NonNull @NonNull Consumer<? super Throwable> onError)
      Subscribes to the source and calls the given callbacks on the current thread.

      Note that calling this method will block the caller thread until the upstream terminates normally or with an error. Therefore, calling this method from special threads such as the Android Main Thread or the Swing Event Dispatch Thread is not recommended.

      Backpressure:
      The operator consumes the current 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
      Throws:
      NullPointerException - if onNext or onError is null
      Since:
      2.0
      See Also:
    • blockingSubscribe

      @BackpressureSupport(FULL) @SchedulerSupport("none") public final void blockingSubscribe(@NonNull @NonNull Consumer<? super @NonNull T> onNext, @NonNull @NonNull Consumer<? super Throwable> onError, int bufferSize)
      Subscribes to the source and calls the given callbacks on the current thread.

      Note that calling this method will block the caller thread until the upstream terminates normally or with an error. Therefore, calling this method from special threads such as the Android Main Thread or the Swing Event Dispatch Thread is not recommended.

      Backpressure:
      The operator consumes the current Flowable in an bounded manner (up to bufferSize outstanding request amount for items).
      Scheduler:
      blockingSubscribe does not operate by default on a particular Scheduler.

      History: 2.1.15 - experimental

      Parameters:
      onNext - the callback action for each source value
      onError - the callback action for an error event
      bufferSize - the size of the buffer
      Throws:
      NullPointerException - if onNext or onError is null
      IllegalArgumentException - if bufferSize is non-positive
      Since:
      2.2
      See Also:
    • blockingSubscribe

      @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final void blockingSubscribe(@NonNull @NonNull Consumer<? super @NonNull T> onNext, @NonNull @NonNull Consumer<? super Throwable> onError, @NonNull @NonNull Action onComplete)
      Subscribes to the source and calls the given callbacks on the current thread.

      Note that calling this method will block the caller thread until the upstream terminates normally or with an error. Therefore, calling this method from special threads such as the Android Main Thread or the Swing Event Dispatch Thread is not recommended.

      Backpressure:
      The operator consumes the current 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.
      Throws:
      NullPointerException - if onNext, onError or onComplete is null
      Since:
      2.0
    • blockingSubscribe

      @BackpressureSupport(FULL) @SchedulerSupport("none") public final void blockingSubscribe(@NonNull @NonNull Consumer<? super @NonNull T> onNext, @NonNull @NonNull Consumer<? super Throwable> onError, @NonNull @NonNull Action onComplete, int bufferSize)
      Subscribes to the source and calls the given callbacks on the current thread.

      Note that calling this method will block the caller thread until the upstream terminates normally or with an error. Therefore, calling this method from special threads such as the Android Main Thread or the Swing Event Dispatch Thread is not recommended.

      Backpressure:
      The operator consumes the current Flowable in an bounded manner (up to bufferSize outstanding request amount for items).
      Scheduler:
      blockingSubscribe does not operate by default on a particular Scheduler.

      History: 2.1.15 - experimental

      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.
      bufferSize - the size of the buffer
      Throws:
      NullPointerException - if onNext, onError or onComplete is null
      IllegalArgumentException - if bufferSize is non-positive
      Since:
      2.2
    • blockingSubscribe

      @BackpressureSupport(SPECIAL) @SchedulerSupport("none") public final void blockingSubscribe(@NonNull @NonNull org.reactivestreams.Subscriber<? super @NonNull T> subscriber)
      Subscribes to the source and calls the Subscriber methods on the current thread.

      Note that calling this method will block the caller thread until the upstream terminates normally, with an error or the Subscriber cancels the Subscription it receives via Subscriber.onSubscribe(Subscription). Therefore, calling this method from special threads such as the Android Main Thread or the Swing Event Dispatch Thread is not recommended.

      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
      Throws:
      NullPointerException - if subscriber is null
      Since:
      2.0
    • buffer

      Returns a Flowable that emits buffers of items it collects from the current Flowable. The resulting Flowable emits connected, non-overlapping buffers, each containing count items. When the current Flowable completes, the resulting Flowable emits the current buffer and propagates the notification from the current Flowable. Note that if the current Flowable issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      Backpressure:
      The operator honors backpressure from downstream and expects the current Flowable 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:
      the new Flowable instance
      Throws:
      IllegalArgumentException - if count is non-positive
      See Also:
    • buffer

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final @NonNull Flowable<List<T>> buffer(int count, int skip)
      Returns a Flowable that emits buffers of items it collects from the current Flowable. The resulting Flowable emits buffers every skip items, each containing count items. When the current Flowable completes, the resulting Flowable emits the current buffer and propagates the notification from the current Flowable. Note that if the current Flowable issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      Backpressure:
      The operator honors backpressure from downstream and expects the current Flowable 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 current Flowable 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:
      the new Flowable instance
      Throws:
      IllegalArgumentException - if count or skip is non-positive
      See Also:
    • buffer

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull U extends Collection<? super @NonNull T>> @NonNull Flowable<U> buffer(int count, int skip, @NonNull @NonNull Supplier<@NonNull U> bufferSupplier)
      Returns a Flowable that emits buffers of items it collects from the current Flowable. The resulting Flowable emits buffers every skip items, each containing count items. When the current Flowable completes, the resulting Flowable emits the current buffer and propagates the notification from the current Flowable. Note that if the current Flowable issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      Backpressure:
      The operator honors backpressure from downstream and expects the current Flowable 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.
      Type Parameters:
      U - the collection subclass type to buffer into
      Parameters:
      count - the maximum size of each buffer before it should be emitted
      skip - how many items emitted by the current Flowable 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:
      the new Flowable instance
      Throws:
      NullPointerException - if bufferSupplier is null
      IllegalArgumentException - if count or skip is non-positive
      See Also:
    • buffer

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull U extends Collection<? super @NonNull T>> @NonNull Flowable<U> buffer(int count, @NonNull @NonNull Supplier<@NonNull U> bufferSupplier)
      Returns a Flowable that emits buffers of items it collects from the current Flowable. The resulting Flowable emits connected, non-overlapping buffers, each containing count items. When the current Flowable completes, the resulting Flowable emits the current buffer and propagates the notification from the current Flowable. Note that if the current Flowable issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      Backpressure:
      The operator honors backpressure from downstream and expects the current Flowable 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.
      Type Parameters:
      U - the collection subclass type to buffer into
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if bufferSupplier is null
      IllegalArgumentException - if count is non-positive
      See Also:
    • buffer

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<List<T>> buffer(long timespan, long timeskip, @NonNull @NonNull TimeUnit unit)
      Returns a Flowable that emits buffers of items it collects from the current Flowable. The resulting Flowable 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 current Flowable completes, the resulting Flowable emits the current buffer and propagates the notification from the current Flowable. Note that if the current Flowable issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • buffer

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("custom") @NonNull public final @NonNull Flowable<List<T>> buffer(long timespan, long timeskip, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler)
      Returns a Flowable that emits buffers of items it collects from the current Flowable. The resulting Flowable 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 current Flowable completes, the resulting Flowable emits the current buffer and propagates the notification from the current Flowable. Note that if the current Flowable issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • buffer

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("custom") public final <@NonNull U extends Collection<? super @NonNull T>> @NonNull Flowable<U> buffer(long timespan, long timeskip, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, @NonNull @NonNull Supplier<@NonNull U> bufferSupplier)
      Returns a Flowable that emits buffers of items it collects from the current Flowable. The resulting Flowable 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 current Flowable completes, the resulting Flowable emits the current buffer and propagates the notification from the current Flowable. Note that if the current Flowable issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      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.
      Type Parameters:
      U - the collection subclass type to buffer into
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit, scheduler or bufferSupplier is null
      See Also:
    • buffer

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<List<T>> buffer(long timespan, @NonNull @NonNull TimeUnit unit)
      Returns a Flowable that emits buffers of items it collects from the current Flowable. The resulting Flowable emits connected, non-overlapping buffers, each of a fixed duration specified by the timespan argument. When the current Flowable completes, the resulting Flowable emits the current buffer and propagates the notification from the current Flowable. Note that if the current Flowable issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • buffer

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<List<T>> buffer(long timespan, @NonNull @NonNull TimeUnit unit, int count)
      Returns a Flowable that emits buffers of items it collects from the current Flowable. The resulting Flowable 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 current Flowable completes, the resulting Flowable emits the current buffer and propagates the notification from the current Flowable. Note that if the current Flowable issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      IllegalArgumentException - if count is non-positive
      See Also:
    • buffer

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("custom") @NonNull public final @NonNull Flowable<List<T>> buffer(long timespan, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, int count)
      Returns a Flowable that emits buffers of items it collects from the current Flowable. The resulting Flowable 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 current Flowable completes, the resulting Flowable emits the current buffer and propagates the notification from the current Flowable. Note that if the current Flowable issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      IllegalArgumentException - if count is non-positive
      See Also:
    • buffer

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("custom") @NonNull public final <@NonNull U extends Collection<? super @NonNull T>> @NonNull Flowable<U> buffer(long timespan, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, int count, @NonNull @NonNull Supplier<@NonNull U> bufferSupplier, boolean restartTimerOnMaxSize)
      Returns a Flowable that emits buffers of items it collects from the current Flowable. The resulting Flowable 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 current Flowable completes, the resulting Flowable emits the current buffer and propagates the notification from the current Flowable. Note that if the current Flowable issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      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.
      Type Parameters:
      U - the collection subclass type to buffer into
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit, scheduler or bufferSupplier is null
      IllegalArgumentException - if count is non-positive
      See Also:
    • buffer

      Returns a Flowable that emits buffers of items it collects from the current Flowable. The resulting Flowable emits connected, non-overlapping buffers, each of a fixed duration specified by the timespan argument and on the specified scheduler. When the current Flowable completes, the resulting Flowable emits the current buffer and propagates the notification from the current Flowable. Note that if the current Flowable issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • buffer

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("none") @NonNull public final <@NonNull TOpening, @NonNull TClosing> @NonNull Flowable<List<T>> buffer(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull TOpening> openingIndicator, @NonNull @NonNull Function<? super @NonNull TOpening,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull TClosing>> closingIndicator)
      Returns a Flowable that emits buffers of items it collects from the current Flowable. The resulting Flowable emits buffers that it creates when the specified openingIndicator Publisher emits an item, and closes when the Publisher returned from closingIndicator emits an item. If any of the current PFlowable, openingIndicator or closingIndicator issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      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.
      Type Parameters:
      TOpening - the element type of the buffer-opening Publisher
      TClosing - the element type of the individual buffer-closing Publishers
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if openingIndicator or closingIndicator is null
      See Also:
    • buffer

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("none") @NonNull public final <@NonNull TOpening, @NonNull TClosing, @NonNull U extends Collection<? super @NonNull T>> @NonNull Flowable<U> buffer(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull TOpening> openingIndicator, @NonNull @NonNull Function<? super @NonNull TOpening,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull TClosing>> closingIndicator, @NonNull @NonNull Supplier<@NonNull U> bufferSupplier)
      Returns a Flowable that emits buffers of items it collects from the current Flowable. The resulting Flowable emits buffers that it creates when the specified openingIndicator Publisher emits an item, and closes when the Publisher returned from closingIndicator emits an item. If any of the current Flowable, openingIndicator or closingIndicator issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      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.
      Type Parameters:
      TOpening - the element type of the buffer-opening Publisher
      TClosing - the element type of the individual buffer-closing Publishers
      U - the collection subclass type to buffer into
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if openingIndicator, closingIndicator or bufferSupplier is null
      See Also:
    • buffer

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("none") @NonNull public final <@NonNull B> @NonNull Flowable<List<T>> buffer(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull B> boundaryIndicator)
      Returns a Flowable that emits non-overlapping buffered items from the current Flowable 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. If either the current Flowable or the boundary Publisher issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      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.
      Type Parameters:
      B - the boundary value type (ignored)
      Parameters:
      boundaryIndicator - the boundary Publisher
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if boundaryIndicator is null
      See Also:
    • buffer

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("none") @NonNull public final <@NonNull B> @NonNull Flowable<List<T>> buffer(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull B> boundaryIndicator, int initialCapacity)
      Returns a Flowable that emits non-overlapping buffered items from the current Flowable 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. If either the current Flowable or the boundary Publisher issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      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.
      Type Parameters:
      B - the boundary value type (ignored)
      Parameters:
      boundaryIndicator - the boundary Publisher
      initialCapacity - the initial capacity of each buffer chunk
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if boundaryIndicator is null
      IllegalArgumentException - if initialCapacity is non-positive
      See Also:
    • buffer

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("none") @NonNull public final <@NonNull B, @NonNull U extends Collection<? super @NonNull T>> @NonNull Flowable<U> buffer(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull B> boundaryIndicator, @NonNull @NonNull Supplier<@NonNull U> bufferSupplier)
      Returns a Flowable that emits non-overlapping buffered items from the current Flowable 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. If either the current Flowable or the boundary Publisher issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling.

      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.
      Type Parameters:
      B - the boundary value type (ignored)
      U - the collection subclass type to buffer into
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if boundaryIndicator or bufferSupplier is null
      See Also:
    • 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 ConnectableFlowable.connect().

      Note: You sacrifice the ability to cancel the origin when you use the cache operator so be careful not to use this operator on Publishers that emit an infinite or very large number of items that will use up memory. A possible workaround is to apply takeUntil(Publisher) 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:
      the new Flowable instance
      See Also:
    • cacheWithInitialCapacity

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final @NonNull 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 ConnectableFlowable.connect().

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

      
       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 ConnectableFlowable.autoConnect() or similar.

      Parameters:
      initialCapacity - hint for number of items to cache (for optimizing underlying data structure)
      Returns:
      the new Flowable instance
      Throws:
      IllegalArgumentException - if initialCapacity is non-positive
      See Also:
    • cast

      Returns a Flowable that emits the upstream items while they can be cast via Class.cast(Object) until the upstream terminates, or until the upstream signals an item which can't be cast, resulting in a ClassCastException to be signaled to the downstream.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      cast does not operate by default on a particular Scheduler.
      Type Parameters:
      U - the output value type cast to
      Parameters:
      clazz - the target class to use to try and cast the upstream items into
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if clazz is null
      See Also:
    • collect

      @CheckReturnValue @NonNull @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final <@NonNull U> @NonNull Single<U> collect(@NonNull @NonNull Supplier<? extends @NonNull U> initialItemSupplier, @NonNull @NonNull BiConsumer<? super @NonNull U,? super @NonNull T> collector)
      Collects items emitted by the finite 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.

      Note that this operator requires the upstream to signal onComplete for the accumulator object 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:
      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.
      Type Parameters:
      U - the accumulator and output type
      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:
      the new Single instance
      Throws:
      NullPointerException - if initialItemSupplier or collector is null
      See Also:
    • collectInto

      @CheckReturnValue @NonNull @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final <@NonNull U> @NonNull Single<U> collectInto(@NonNull U initialItem, @NonNull @NonNull BiConsumer<? super @NonNull U,? super @NonNull T> collector)
      Collects items emitted by the finite 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.

      Note that this operator requires the upstream to signal onComplete for the accumulator object 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:
      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.
      Type Parameters:
      U - the accumulator and output type
      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:
      the new Single instance
      Throws:
      NullPointerException - if initialItem or collector is null
      See Also:
    • compose

      Transform the current Flowable by applying a particular FlowableTransformer function to it.

      This method operates on the Flowable itself whereas lift(io.reactivex.rxjava3.core.FlowableOperator<? extends R, ? super T>) operates on the Flowable's Subscribers.

      If the operator you are creating is designed to act on the individual items emitted by a current Flowable, use lift(io.reactivex.rxjava3.core.FlowableOperator<? extends R, ? super T>). If your operator is designed to transform the current Flowable 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 FlowableTransformer returns.
      Scheduler:
      compose does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the value type of the output Publisher
      Parameters:
      composer - implements the function that transforms the current Flowable
      Returns:
      the new composed Flowable instance
      Throws:
      NullPointerException - if composer is null
      See Also:
    • concatMap

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> concatMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull R>> mapper)
      Returns a new Flowable that emits items resulting from applying a function that you supply to each item emitted by the current Flowable, where that function returns a Publisher, and then emitting the items that result from concatenating those returned Publishers.

      Note that there is no guarantee where the given mapper function will be executed; it could be on the subscribing thread, on the upstream thread signaling the new item to be mapped or on the thread where the inner source terminates. To ensure the mapper function is confined to a known thread, use the concatMap(Function, int, Scheduler) overload.

      Backpressure:
      The operator honors backpressure from downstream. Both this and the inner Publishers are expected to honor backpressure as well. If the current Flowable 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.
      Type Parameters:
      R - the type of the inner Publisher sources and thus the output type
      Parameters:
      mapper - a function that, when applied to an item emitted by the current Flowable, returns a Publisher
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      See Also:
    • concatMap

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> concatMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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 current Flowable, where that function returns a Publisher, and then emitting the items that result from concatenating those returned Publishers.

      Note that there is no guarantee where the given mapper function will be executed; it could be on the subscribing thread, on the upstream thread signaling the new item to be mapped or on the thread where the inner source terminates. To ensure the mapper function is confined to a known thread, use the concatMap(Function, int, Scheduler) overload.

      Backpressure:
      The operator honors backpressure from downstream. Both this and the inner Publishers are expected to honor backpressure as well. If the current Flowable 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.
      Type Parameters:
      R - the type of the inner Publisher sources and thus the output type
      Parameters:
      mapper - a function that, when applied to an item emitted by the current Flowable, returns a Publisher
      prefetch - the number of elements to prefetch from the current Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if prefetch is non-positive
      See Also:
    • concatMap

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("custom") public final <@NonNull R> @NonNull Flowable<R> concatMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull R>> mapper, int prefetch, @NonNull @NonNull Scheduler scheduler)
      Returns a new Flowable that emits items resulting from applying a function (on a designated scheduler) that you supply to each item emitted by the current Flowable, where that function returns a Publisher, and then emitting the items that result from concatenating those returned Publishers.

      The difference between concatMap(Function, int) and this operator is that this operator guarantees the mapper function is executed on the specified scheduler.

      Backpressure:
      The operator honors backpressure from downstream. Both this and the inner Publishers are expected to honor backpressure as well. If the current Flowable 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 executes the given mapper function on the provided Scheduler.
      Type Parameters:
      R - the type of the inner Publisher sources and thus the output type
      Parameters:
      mapper - a function that, when applied to an item emitted by the current Flowable, returns a Publisher
      prefetch - the number of elements to prefetch from the current Flowable
      scheduler - the scheduler where the mapper function will be executed
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper or scheduler is null
      IllegalArgumentException - if prefetch is non-positive
      Since:
      3.0.0
      See Also:
    • concatMapCompletable

      Maps the upstream items into CompletableSources and subscribes to them one after the other completes.

      Backpressure:
      The operator expects the upstream to support backpressure. If this Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapCompletable does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Parameters:
      mapper - the function called with the upstream item and should return a CompletableSource to become the next source to be subscribed to
      Returns:
      the new Completable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.2
      See Also:
    • concatMapCompletable

      @CheckReturnValue @NonNull @SchedulerSupport("none") @BackpressureSupport(FULL) public final @NonNull Completable concatMapCompletable(@NonNull @NonNull Function<? super @NonNull T,? extends CompletableSource> mapper, int prefetch)
      Maps the upstream items into CompletableSources and subscribes to them one after the other completes.

      Backpressure:
      The operator expects the upstream to support backpressure. If this Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapCompletable does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Parameters:
      mapper - the function called with the upstream item and should return a CompletableSource to become the next source to be subscribed to
      prefetch - The number of upstream items to prefetch so that fresh items are ready to be mapped when a previous CompletableSource terminates. The operator replenishes after half of the prefetch amount has been consumed and turned into CompletableSources.
      Returns:
      the new Completable instance
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if prefetch is non-positive
      Since:
      2.2
      See Also:
    • concatMapCompletableDelayError

      @CheckReturnValue @SchedulerSupport("none") @BackpressureSupport(FULL) @NonNull public final @NonNull Completable concatMapCompletableDelayError(@NonNull @NonNull Function<? super @NonNull T,? extends CompletableSource> mapper)
      Maps the upstream items into CompletableSources and subscribes to them one after the other terminates, delaying all errors till both this Flowable and all inner CompletableSources terminate.

      Backpressure:
      The operator expects the upstream to support backpressure. If this Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapCompletableDelayError does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Parameters:
      mapper - the function called with the upstream item and should return a CompletableSource to become the next source to be subscribed to
      Returns:
      the new Completable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.2
      See Also:
    • concatMapCompletableDelayError

      @CheckReturnValue @SchedulerSupport("none") @BackpressureSupport(FULL) @NonNull public final @NonNull Completable concatMapCompletableDelayError(@NonNull @NonNull Function<? super @NonNull T,? extends CompletableSource> mapper, boolean tillTheEnd)
      Maps the upstream items into CompletableSources and subscribes to them one after the other terminates, optionally delaying all errors till both this Flowable and all inner CompletableSources terminate.

      Backpressure:
      The operator expects the upstream to support backpressure. If this Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapCompletableDelayError does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Parameters:
      mapper - the function called with the upstream item and should return a CompletableSource to become the next source to be subscribed to
      tillTheEnd - If true, errors from this Flowable or any of the inner CompletableSources are delayed until all of them terminate. If false, an error from this Flowable is delayed until the current inner CompletableSource terminates and only then is it emitted to the downstream.
      Returns:
      the new Completable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.2
      See Also:
    • concatMapCompletableDelayError

      @CheckReturnValue @NonNull @SchedulerSupport("none") @BackpressureSupport(FULL) public final @NonNull Completable concatMapCompletableDelayError(@NonNull @NonNull Function<? super @NonNull T,? extends CompletableSource> mapper, boolean tillTheEnd, int prefetch)
      Maps the upstream items into CompletableSources and subscribes to them one after the other terminates, optionally delaying all errors till both this Flowable and all inner CompletableSources terminate.

      Backpressure:
      The operator expects the upstream to support backpressure. If this Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapCompletableDelayError does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Parameters:
      mapper - the function called with the upstream item and should return a CompletableSource to become the next source to be subscribed to
      tillTheEnd - If true, errors from this Flowable or any of the inner CompletableSources are delayed until all of them terminate. If false, an error from this Flowable is delayed until the current inner CompletableSource terminates and only then is it emitted to the downstream.
      prefetch - The number of upstream items to prefetch so that fresh items are ready to be mapped when a previous CompletableSource terminates. The operator replenishes after half of the prefetch amount has been consumed and turned into CompletableSources.
      Returns:
      the new Completable instance
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if prefetch is non-positive
      Since:
      2.2
      See Also:
    • concatMapDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> concatMapDelayError(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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.

      Note that there is no guarantee where the given mapper function will be executed; it could be on the subscribing thread, on the upstream thread signaling the new item to be mapped or on the thread where the inner source terminates. To ensure the mapper function is confined to a known thread, use the concatMapDelayError(Function, boolean, int, Scheduler) overload.

      Backpressure:
      The operator honors backpressure from downstream. Both this and the inner Publishers are expected to honor backpressure as well. If the current Flowable 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.
      Type Parameters:
      R - the result value type
      Parameters:
      mapper - the function that maps the items of this Publisher into the inner Publishers.
      Returns:
      the new Flowable instance with the concatenation behavior
      Throws:
      NullPointerException - if mapper is null
      See Also:
    • concatMapDelayError

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> concatMapDelayError(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull R>> mapper, boolean tillTheEnd, int prefetch)
      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.

      Note that there is no guarantee where the given mapper function will be executed; it could be on the subscribing thread, on the upstream thread signaling the new item to be mapped or on the thread where the inner source terminates. To ensure the mapper function is confined to a known thread, use the concatMapDelayError(Function, boolean, int, Scheduler) overload.

      Backpressure:
      The operator honors backpressure from downstream. Both this and the inner Publishers are expected to honor backpressure as well. If the current Flowable 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.
      Type Parameters:
      R - the result value type
      Parameters:
      mapper - the function that maps the items of this Publisher into the inner Publishers.
      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 signaled when the current inner Publisher source terminates
      prefetch - the number of elements to prefetch from the current Flowable
      Returns:
      the new Flowable instance with the concatenation behavior
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if prefetch is non-positive
      See Also:
    • concatMapDelayError

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("custom") public final <@NonNull R> @NonNull Flowable<R> concatMapDelayError(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull R>> mapper, boolean tillTheEnd, int prefetch, @NonNull @NonNull Scheduler scheduler)
      Maps each of the upstream items into a Publisher, subscribes to them one after the other, one at a time and emits their values in order while executing the mapper function on the designated scheduler, delaying any error from either this or any of the inner Publishers till all of them terminate.

      The difference between concatMapDelayError(Function, boolean, int) and this operator is that this operator guarantees the mapper function is executed on the specified scheduler.

      Backpressure:
      The operator honors backpressure from downstream. Both this and the inner Publishers are expected to honor backpressure as well. If the current Flowable 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 executes the given mapper function on the provided Scheduler.
      Type Parameters:
      R - the result value type
      Parameters:
      mapper - the function that maps the items of this Publisher into the inner Publishers.
      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 signaled when the current inner Publisher source terminates
      prefetch - the number of elements to prefetch from the current Flowable
      scheduler - the scheduler where the mapper function will be executed
      Returns:
      the new Flowable instance with the concatenation behavior
      Throws:
      NullPointerException - if mapper or scheduler is null
      IllegalArgumentException - if prefetch is non-positive
      Since:
      3.0.0
      See Also:
    • concatMapEager

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> concatMapEager(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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 inner 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.
      Type Parameters:
      R - the value type
      Parameters:
      mapper - the function that maps a sequence of values into a sequence of Publishers that will be eagerly concatenated
      Returns:
      the new Flowable instance with the specified concatenation behavior
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.0
    • concatMapEager

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> concatMapEager(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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 inner 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.
      Type Parameters:
      R - the value type
      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 Flowable instance with the specified concatenation behavior
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if maxConcurrency or prefetch is non-positive
      Since:
      2.0
    • concatMapEagerDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> concatMapEagerDelayError(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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 inner 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.
      Type Parameters:
      R - the value type
      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 signaled when the current inner Publisher source terminates
      Returns:
      the new Flowable instance with the specified concatenation behavior
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.0
    • concatMapEagerDelayError

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> concatMapEagerDelayError(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull R>> mapper, boolean tillTheEnd, int maxConcurrency, int prefetch)
      Maps a sequence of values into Publishers and concatenates these Publishers eagerly into a single Flowable sequence.

      Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the inner 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.
      Type Parameters:
      R - the value type
      Parameters:
      mapper - the function that maps a sequence of values into a sequence of Publishers that will be eagerly concatenated
      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
      maxConcurrency - the maximum number of concurrent subscribed Publishers
      prefetch - the number of elements to prefetch from each source Publisher
      Returns:
      the new Flowable instance with the specified concatenation behavior
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if maxConcurrency or prefetch is non-positive
      Since:
      2.0
    • concatMapIterable

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull U> @NonNull Flowable<U> concatMapIterable(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends Iterable<? extends @NonNull U>> mapper)
      Returns a Flowable that concatenate each item emitted by the current Flowable with the values in an Iterable corresponding to that item that is generated by a selector.
      Backpressure:
      The operator honors backpressure from downstream. The current Flowables is expected to honor backpressure as well. If the current Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapIterable does not operate by default on a particular Scheduler.
      Type Parameters:
      U - the type of item emitted by the resulting Flowable
      Parameters:
      mapper - a function that returns an Iterable sequence of values for when given an item emitted by the current Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      See Also:
    • concatMapIterable

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull U> @NonNull Flowable<U> concatMapIterable(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends Iterable<? extends @NonNull U>> mapper, int prefetch)
      Returns a Flowable that concatenate each item emitted by the current Flowable with the values in an Iterable corresponding to that item that is generated by a selector.
      Backpressure:
      The operator honors backpressure from downstream. The current Flowable is expected to honor backpressure as well. If the current Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapIterable does not operate by default on a particular Scheduler.
      Type Parameters:
      U - the type of item emitted by the resulting Flowable
      Parameters:
      mapper - a function that returns an Iterable sequence of values for when given an item emitted by the current Flowable
      prefetch - the number of elements to prefetch from the current Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if prefetch is non-positive
      See Also:
    • concatMapMaybe

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> concatMapMaybe(@NonNull @NonNull Function<? super @NonNull T,? extends MaybeSource<? extends @NonNull R>> mapper)
      Maps the upstream items into MaybeSources and subscribes to them one after the other succeeds or completes, emits their success value if available or terminates immediately if either this Flowable or the current inner MaybeSource fail.

      Backpressure:
      The operator expects the upstream to support backpressure and honors the backpressure from downstream. If this Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapMaybe does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Type Parameters:
      R - the result type of the inner MaybeSources
      Parameters:
      mapper - the function called with the upstream item and should return a MaybeSource to become the next source to be subscribed to
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.2
      See Also:
    • concatMapMaybe

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> concatMapMaybe(@NonNull @NonNull Function<? super @NonNull T,? extends MaybeSource<? extends @NonNull R>> mapper, int prefetch)
      Maps the upstream items into MaybeSources and subscribes to them one after the other succeeds or completes, emits their success value if available or terminates immediately if either this Flowable or the current inner MaybeSource fail.

      Backpressure:
      The operator expects the upstream to support backpressure and honors the backpressure from downstream. If this Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapMaybe does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Type Parameters:
      R - the result type of the inner MaybeSources
      Parameters:
      mapper - the function called with the upstream item and should return a MaybeSource to become the next source to be subscribed to
      prefetch - The number of upstream items to prefetch so that fresh items are ready to be mapped when a previous MaybeSource terminates. The operator replenishes after half of the prefetch amount has been consumed and turned into MaybeSources.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if prefetch is non-positive
      Since:
      2.2
      See Also:
    • concatMapMaybeDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> concatMapMaybeDelayError(@NonNull @NonNull Function<? super @NonNull T,? extends MaybeSource<? extends @NonNull R>> mapper)
      Maps the upstream items into MaybeSources and subscribes to them one after the other terminates, emits their success value if available and delaying all errors till both this Flowable and all inner MaybeSources terminate.

      Backpressure:
      The operator expects the upstream to support backpressure and honors the backpressure from downstream. If this Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapMaybeDelayError does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Type Parameters:
      R - the result type of the inner MaybeSources
      Parameters:
      mapper - the function called with the upstream item and should return a MaybeSource to become the next source to be subscribed to
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.2
      See Also:
    • concatMapMaybeDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> concatMapMaybeDelayError(@NonNull @NonNull Function<? super @NonNull T,? extends MaybeSource<? extends @NonNull R>> mapper, boolean tillTheEnd)
      Maps the upstream items into MaybeSources and subscribes to them one after the other terminates, emits their success value if available and optionally delaying all errors till both this Flowable and all inner MaybeSources terminate.

      Backpressure:
      The operator expects the upstream to support backpressure and honors the backpressure from downstream. If this Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapMaybeDelayError does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Type Parameters:
      R - the result type of the inner MaybeSources
      Parameters:
      mapper - the function called with the upstream item and should return a MaybeSource to become the next source to be subscribed to
      tillTheEnd - If true, errors from this Flowable or any of the inner MaybeSources are delayed until all of them terminate. If false, an error from this Flowable is delayed until the current inner MaybeSource terminates and only then is it emitted to the downstream.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.2
      See Also:
    • concatMapMaybeDelayError

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> concatMapMaybeDelayError(@NonNull @NonNull Function<? super @NonNull T,? extends MaybeSource<? extends @NonNull R>> mapper, boolean tillTheEnd, int prefetch)
      Maps the upstream items into MaybeSources and subscribes to them one after the other terminates, emits their success value if available and optionally delaying all errors till both this Flowable and all inner MaybeSources terminate.

      Backpressure:
      The operator expects the upstream to support backpressure and honors the backpressure from downstream. If this Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapMaybeDelayError does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Type Parameters:
      R - the result type of the inner MaybeSources
      Parameters:
      mapper - the function called with the upstream item and should return a MaybeSource to become the next source to be subscribed to
      tillTheEnd - If true, errors from this Flowable or any of the inner MaybeSources are delayed until all of them terminate. If false, an error from this Flowable is delayed until the current inner MaybeSource terminates and only then is it emitted to the downstream.
      prefetch - The number of upstream items to prefetch so that fresh items are ready to be mapped when a previous MaybeSource terminates. The operator replenishes after half of the prefetch amount has been consumed and turned into MaybeSources.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if prefetch is non-positive
      Since:
      2.2
      See Also:
    • concatMapSingle

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> concatMapSingle(@NonNull @NonNull Function<? super @NonNull T,? extends SingleSource<? extends @NonNull R>> mapper)
      Maps the upstream items into SingleSources and subscribes to them one after the other succeeds, emits their success values or terminates immediately if either this Flowable or the current inner SingleSource fail.

      Backpressure:
      The operator expects the upstream to support backpressure and honors the backpressure from downstream. If this Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapSingle does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Type Parameters:
      R - the result type of the inner SingleSources
      Parameters:
      mapper - the function called with the upstream item and should return a SingleSource to become the next source to be subscribed to
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.2
      See Also:
    • concatMapSingle

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> concatMapSingle(@NonNull @NonNull Function<? super @NonNull T,? extends SingleSource<? extends @NonNull R>> mapper, int prefetch)
      Maps the upstream items into SingleSources and subscribes to them one after the other succeeds, emits their success values or terminates immediately if either this Flowable or the current inner SingleSource fail.

      Backpressure:
      The operator expects the upstream to support backpressure and honors the backpressure from downstream. If this Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapSingle does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Type Parameters:
      R - the result type of the inner SingleSources
      Parameters:
      mapper - the function called with the upstream item and should return a SingleSource to become the next source to be subscribed to
      prefetch - The number of upstream items to prefetch so that fresh items are ready to be mapped when a previous SingleSource terminates. The operator replenishes after half of the prefetch amount has been consumed and turned into SingleSources.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if prefetch is non-positive
      Since:
      2.2
      See Also:
    • concatMapSingleDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> concatMapSingleDelayError(@NonNull @NonNull Function<? super @NonNull T,? extends SingleSource<? extends @NonNull R>> mapper)
      Maps the upstream items into SingleSources and subscribes to them one after the other succeeds or fails, emits their success values and delays all errors till both this Flowable and all inner SingleSources terminate.

      Backpressure:
      The operator expects the upstream to support backpressure and honors the backpressure from downstream. If this Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapSingleDelayError does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Type Parameters:
      R - the result type of the inner SingleSources
      Parameters:
      mapper - the function called with the upstream item and should return a SingleSource to become the next source to be subscribed to
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.2
      See Also:
    • concatMapSingleDelayError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> concatMapSingleDelayError(@NonNull @NonNull Function<? super @NonNull T,? extends SingleSource<? extends @NonNull R>> mapper, boolean tillTheEnd)
      Maps the upstream items into SingleSources and subscribes to them one after the other succeeds or fails, emits their success values and optionally delays all errors till both this Flowable and all inner SingleSources terminate.

      Backpressure:
      The operator expects the upstream to support backpressure and honors the backpressure from downstream. If this Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapSingleDelayError does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Type Parameters:
      R - the result type of the inner SingleSources
      Parameters:
      mapper - the function called with the upstream item and should return a SingleSource to become the next source to be subscribed to
      tillTheEnd - If true, errors from this Flowable or any of the inner SingleSources are delayed until all of them terminate. If false, an error from this Flowable is delayed until the current inner SingleSource terminates and only then is it emitted to the downstream.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.2
      See Also:
    • concatMapSingleDelayError

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> concatMapSingleDelayError(@NonNull @NonNull Function<? super @NonNull T,? extends SingleSource<? extends @NonNull R>> mapper, boolean tillTheEnd, int prefetch)
      Maps the upstream items into SingleSources and subscribes to them one after the other succeeds or fails, emits their success values and optionally delays errors till both this Flowable and all inner SingleSources terminate.

      Backpressure:
      The operator expects the upstream to support backpressure and honors the backpressure from downstream. If this Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      concatMapSingleDelayError does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Type Parameters:
      R - the result type of the inner SingleSources
      Parameters:
      mapper - the function called with the upstream item and should return a SingleSource to become the next source to be subscribed to
      tillTheEnd - If true, errors from this Flowable or any of the inner SingleSources are delayed until all of them terminate. If false, an error from this Flowable is delayed until the current inner SingleSource terminates and only then is it emitted to the downstream.
      prefetch - The number of upstream items to prefetch so that fresh items are ready to be mapped when a previous SingleSource terminates. The operator replenishes after half of the prefetch amount has been consumed and turned into SingleSources.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if prefetch is non-positive
      Since:
      2.2
      See Also:
    • concatWith

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final @NonNull Flowable<T> concatWith(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> other)
      Returns a Flowable that emits the items emitted from the current Flowable, 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 current Flowable completes.
      Scheduler:
      concatWith does not operate by default on a particular Scheduler.
      Parameters:
      other - a Publisher to be concatenated after the current
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other is null
      See Also:
    • concatWith

      Returns a Flowable that emits the items from this Flowable followed by the success item or error event of the other SingleSource.

      Backpressure:
      The operator supports backpressure and makes sure the success item of the other SingleSource is only emitted when there is a demand for it.
      Scheduler:
      concatWith does not operate by default on a particular Scheduler.

      History: 2.1.10 - experimental

      Parameters:
      other - the SingleSource whose signal should be emitted after this Flowable completes normally.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other is null
      Since:
      2.2
    • concatWith

      Returns a Flowable that emits the items from this Flowable followed by the success item or terminal events of the other MaybeSource.

      Backpressure:
      The operator supports backpressure and makes sure the success item of the other MaybeSource is only emitted when there is a demand for it.
      Scheduler:
      concatWith does not operate by default on a particular Scheduler.

      History: 2.1.10 - experimental

      Parameters:
      other - the MaybeSource whose signal should be emitted after this Flowable completes normally.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other is null
      Since:
      2.2
    • concatWith

      Returns a Flowable that emits items from this Flowable and when it completes normally, the other CompletableSource is subscribed to and the returned Flowable emits its terminal events.

      Backpressure:
      The operator does not interfere with backpressure between the current Flowable and the downstream consumer (i.e., acts as pass-through). When the operator switches to the Completable, backpressure is no longer present because Completable doesn't have items to apply backpressure to.
      Scheduler:
      concatWith does not operate by default on a particular Scheduler.

      History: 2.1.10 - experimental

      Parameters:
      other - the CompletableSource to subscribe to once the current Flowable completes normally
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other is null
      Since:
      2.2
    • contains

      Returns a Single that emits a Boolean that indicates whether the current Flowable emitted a specified item.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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 current Flowable
      Returns:
      the new Single instance
      Throws:
      NullPointerException - if item is null
      See Also:
    • count

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

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable in an unbounded manner (i.e., without applying backpressure).
      Scheduler:
      count does not operate by default on a particular Scheduler.
      Returns:
      the new Single instance
      See Also:
    • debounce

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("none") public final <@NonNull U> @NonNull Flowable<T> debounce(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<@NonNull U>> debounceIndicator)
      Returns a Flowable that mirrors the current Flowable, except that it drops items emitted by the current Flowable that are followed by another item within a computed debounce duration.

      The delivery of the item happens on the thread of the first onNext or onComplete signal of the generated Publisher sequence, which if takes too long, a newer item may arrive from the upstream, causing the generated sequence to get cancelled, which may also interrupt any downstream blocking operation (yielding an InterruptedException). It is recommended processing items that may take long time to be moved to another thread via observeOn(io.reactivex.rxjava3.core.Scheduler) applied after debounce itself.

      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.
      Type Parameters:
      U - the debounce value type (ignored)
      Parameters:
      debounceIndicator - function to retrieve a sequence that indicates the throttle duration for each item
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if debounceIndicator is null
      See Also:
    • debounce

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<T> debounce(long timeout, @NonNull @NonNull TimeUnit unit)
      Returns a Flowable that mirrors the current Flowable, except that it drops items emitted by the current Flowable 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 current Flowable faster than the timeout then no items will be emitted by the resulting Flowable.

      Delivery of the item after the grace period happens on the computation Scheduler's Worker which if takes too long, a newer item may arrive from the upstream, causing the Worker's task to get disposed, which may also interrupt any downstream blocking operation (yielding an InterruptedException). It is recommended processing items that may take long time to be moved to another thread via observeOn(io.reactivex.rxjava3.core.Scheduler) applied after debounce itself.

      Backpressure:
      This operator does not support backpressure as it uses time to control data flow.
      Scheduler:
      debounce 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 current Flowable in which it emits no items in order for the item to be emitted by the resulting Flowable
      unit - the unit of time for the specified timeout
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • debounce

      Returns a Flowable that mirrors the current Flowable, except that it drops items emitted by the current Flowable 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 current Flowable faster than the timeout then no items will be emitted by the resulting Flowable.

      Delivery of the item after the grace period happens on the given Scheduler's Worker which if takes too long, a newer item may arrive from the upstream, causing the Worker's task to get disposed, which may also interrupt any downstream blocking operation (yielding an InterruptedException). It is recommended processing items that may take long time to be moved to another thread via observeOn(io.reactivex.rxjava3.core.Scheduler) applied after debounce itself.

      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 current Flowable 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • debounce

      Returns a Flowable that mirrors the current Flowable, except that it drops items emitted by the current Flowable 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 current Flowable faster than the timeout then no items will be emitted by the resulting Flowable.

      Delivery of the item after the grace period happens on the given Scheduler's Worker which if takes too long, a newer item may arrive from the upstream, causing the Worker's task to get disposed, which may also interrupt any downstream blocking operation (yielding an InterruptedException). It is recommended processing items that may take long time to be moved to another thread via observeOn(io.reactivex.rxjava3.core.Scheduler) applied after debounce itself.

      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 current Flowable 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
      onDropped - called with the current entry when it has been replaced by a new one
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null or onDropped is null
      Since:
      3.1.6 - Experimental
      See Also:
    • defaultIfEmpty

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

      Backpressure:
      If the current Flowable is empty, this operator is guaranteed to honor backpressure from downstream. If the current Flowable is non-empty, it is expected to honor backpressure as well; if the rule is violated, a MissingBackpressureException may get signaled somewhere downstream.
      Scheduler:
      defaultIfEmpty does not operate by default on a particular Scheduler.
      Parameters:
      defaultItem - the item to emit if the current Flowable emits no items
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if defaultItem is null
      See Also:
    • delay

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull U> @NonNull Flowable<T> delay(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<@NonNull U>> itemDelayIndicator)
      Returns a Flowable that delays the emissions of the current Flowable via another Publisher on a per-item basis.

      Note: the resulting Flowable will immediately propagate any onError notification from the current Flowable.

      Backpressure:
      The operator doesn't interfere with the backpressure behavior which is determined by the current Flowable. 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.
      Type Parameters:
      U - the item delay value type (ignored)
      Parameters:
      itemDelayIndicator - a function that returns a Publisher for each item emitted by the current Flowable, which is then used to delay the emission of that item by the resulting Flowable until the Publisher returned from itemDelay emits an item
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if itemDelayIndicator is null
      See Also:
    • delay

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<T> delay(long time, @NonNull @NonNull TimeUnit unit)
      Returns a Flowable that emits the items emitted by the current Flowable shifted forward in time by a specified delay. The onError notification from the current Flowable is not delayed.

      Backpressure:
      The operator doesn't interfere with the backpressure behavior which is determined by the current Flowable.
      Scheduler:
      This version of delay operates by default on the computation Scheduler.
      Parameters:
      time - the delay to shift the source by
      unit - the TimeUnit in which period is defined
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • delay

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<T> delay(long time, @NonNull @NonNull TimeUnit unit, boolean delayError)
      Returns a Flowable that emits the items emitted by the current Flowable shifted forward in time by a specified delay. If delayError is true, error notifications will also be delayed.

      Backpressure:
      The operator doesn't interfere with the backpressure behavior which is determined by the current Flowable.
      Scheduler:
      This version of delay operates by default on the computation Scheduler.
      Parameters:
      time - the delay to shift the source by
      unit - the TimeUnit in which period is defined
      delayError - if true, the upstream exception is signaled with the given delay, after all preceding normal elements, if false, the upstream exception is signaled immediately
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • delay

      Returns a Flowable that emits the items emitted by the current Flowable shifted forward in time by a specified delay. The onError notification from the current Flowable is not delayed.

      Backpressure:
      The operator doesn't interfere with the backpressure behavior which is determined by the current Flowable.
      Scheduler:
      You specify which Scheduler this operator will use.
      Parameters:
      time - the delay to shift the source by
      unit - the time unit of delay
      scheduler - the Scheduler to use for delaying
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • delay

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("custom") public final @NonNull Flowable<T> delay(long time, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, boolean delayError)
      Returns a Flowable that emits the items emitted by the current Flowable shifted forward in time by a specified delay. If delayError is true, error notifications will also be delayed.

      Backpressure:
      The operator doesn't interfere with the backpressure behavior which is determined by the current Flowable.
      Scheduler:
      You specify which Scheduler this operator will use.
      Parameters:
      time - 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 signaled with the given delay, after all preceding normal elements, if false, the upstream exception is signaled immediately
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • delay

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull U, @NonNull V> @NonNull Flowable<T> delay(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull U> subscriptionIndicator, @NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<@NonNull V>> itemDelayIndicator)
      Returns a Flowable that delays the subscription to and emissions from the current Flowable via another Publisher on a per-item basis.

      Note: the resulting Flowable will immediately propagate any onError notification from the current Flowable.

      Backpressure:
      The operator doesn't interfere with the backpressure behavior which is determined by the current Flowable. 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.
      Type Parameters:
      U - the subscription delay value type (ignored)
      V - the item delay value type (ignored)
      Parameters:
      subscriptionIndicator - a function that returns a Publisher that triggers the subscription to the current Flowable once it emits any item
      itemDelayIndicator - a function that returns a Publisher for each item emitted by the current Flowable, which is then used to delay the emission of that item by the resulting Flowable until the Publisher returned from itemDelay emits an item
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if subscriptionIndicator and itemDelayIndicator is null
      See Also:
    • delaySubscription

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull U> @NonNull Flowable<T> delaySubscription(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull 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.
      Type Parameters:
      U - the value type of the other Publisher, irrelevant
      Parameters:
      subscriptionIndicator - the other Publisher that should trigger the subscription to this Publisher.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if subscriptionIndicator is null
      Since:
      2.0
    • delaySubscription

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<T> delaySubscription(long time, @NonNull @NonNull TimeUnit unit)
      Returns a Flowable that delays the subscription to the current Flowable by a given amount of time.

      Backpressure:
      The operator doesn't interfere with the backpressure behavior which is determined by the current Flowable.
      Scheduler:
      This version of delaySubscription operates by default on the computation Scheduler.
      Parameters:
      time - the time to delay the subscription
      unit - the time unit of delay
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • delaySubscription

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("custom") @NonNull public final @NonNull Flowable<T> delaySubscription(long time, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler)
      Returns a Flowable that delays the subscription to the current Flowable 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 current Flowable.
      Scheduler:
      You specify which Scheduler this operator will use.
      Parameters:
      time - the time to delay the subscription
      unit - the time unit of delay
      scheduler - the Scheduler on which the waiting and subscription will happen
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • dematerialize

      Returns a Flowable that reverses the effect of materialize by transforming the Notification objects extracted from the source items via a selector function into their respective Subscriber signal types.

      The intended use of the selector function is to perform a type-safe identity mapping (see example) on a source that is already of type Notification<T>. The Java language doesn't allow limiting instance methods to a certain generic argument shape, therefore, a function is used to ensure the conversion remains type safe.

      When the upstream signals an onError or onComplete item, the returned Flowable cancels of the flow and terminates with that type of terminal event:

      
       Flowable.just(createOnNext(1), createOnComplete(), createOnNext(2))
       .doOnCancel(() -> System.out.println("Canceled!"));
       .dematerialize(notification -> notification)
       .test()
       .assertResult(1);
       
      If the upstream signals onError or onComplete directly, the flow is terminated with the same event.
      
       Flowable.just(createOnNext(1), createOnNext(2))
       .dematerialize(notification -> notification)
       .test()
       .assertResult(1, 2);
       
      If this behavior is not desired, the completion can be suppressed by applying concatWith(Publisher) with a never() source.
      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      dematerialize does not operate by default on a particular Scheduler.

      History: 2.2.4 - experimental

      Type Parameters:
      R - the output value type
      Parameters:
      selector - function that returns the upstream item and should return a Notification to signal the corresponding Subscriber event to the downstream.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if selector is null
      Since:
      3.0.0
      See Also:
    • distinct

      Returns a Flowable that emits all items emitted by the current Flowable that are distinct based on Object.equals(Object) comparison.

      It is recommended the elements' class T in the flow overrides the default Object.equals() and Object.hashCode() to provide a meaningful comparison between items as the default Java implementation only considers reference equivalence.

      By default, distinct() uses an internal HashSet per Subscriber to remember previously seen items and uses Set.add(Object) returning false as the indicator for duplicates.

      Note that this internal HashSet may grow unbounded as items won't be removed from it by the operator. Therefore, using very long or infinite upstream (with very distinct elements) may lead to OutOfMemoryError.

      Customizing the retention policy can happen only by providing a custom Collection implementation to the distinct(Function, Supplier) overload.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      distinct does not operate by default on a particular Scheduler.
      Returns:
      the new Flowable instance
      See Also:
    • distinct

      Returns a Flowable that emits all items emitted by the current Flowable that are distinct according to a key selector function and based on Object.equals(Object) comparison of the objects returned by the key selector function.

      It is recommended the keys' class K overrides the default Object.equals() and Object.hashCode() to provide a meaningful comparison between the key objects as the default Java implementation only considers reference equivalence.

      By default, distinct() uses an internal HashSet per Subscriber to remember previously seen keys and uses Set.add(Object) returning false as the indicator for duplicates.

      Note that this internal HashSet may grow unbounded as keys won't be removed from it by the operator. Therefore, using very long or infinite upstream (with very distinct keys) may lead to OutOfMemoryError.

      Customizing the retention policy can happen only by providing a custom Collection implementation to the distinct(Function, Supplier) overload.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      distinct does not operate by default on a particular Scheduler.
      Type Parameters:
      K - the key type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if keySelector is null
      See Also:
    • distinct

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull K> @NonNull Flowable<T> distinct(@NonNull @NonNull Function<? super @NonNull T,@NonNull K> keySelector, @NonNull @NonNull Supplier<? extends Collection<? super @NonNull K>> collectionSupplier)
      Returns a Flowable that emits all items emitted by the current Flowable that are distinct according to a key selector function and based on Object.equals(Object) comparison of the objects returned by the key selector function.

      It is recommended the keys' class K overrides the default Object.equals() and Object.hashCode() to provide a meaningful comparison between the key objects as the default Java implementation only considers reference equivalence.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      distinct does not operate by default on a particular Scheduler.
      Type Parameters:
      K - the key type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if keySelector or collectionSupplier is null
      See Also:
    • distinctUntilChanged

      Returns a Flowable that emits all items emitted by the current Flowable that are distinct from their immediate predecessors based on Object.equals(Object) comparison.

      It is recommended the elements' class T in the flow overrides the default Object.equals() to provide a meaningful comparison between items as the default Java implementation only considers reference equivalence. Alternatively, use the distinctUntilChanged(BiPredicate) overload and provide a comparison function in case the class T can't be overridden with custom equals() or the comparison itself should happen on different terms or properties of the class T.

      Note that the operator always retains the latest item from upstream regardless of the comparison result and uses it in the next comparison with the next upstream item.

      Note that if element type T in the flow is mutable, the comparison of the previous and current item may yield unexpected results if the items are mutated externally. Common cases are mutable CharSequences or Lists where the objects will actually have the same references when they are modified and distinctUntilChanged will evaluate subsequent items as same. To avoid such situation, it is recommended that mutable data is converted to an immutable one, for example using map(CharSequence::toString) or map(list -> Collections.unmodifiableList(new ArrayList<>(list))).

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      distinctUntilChanged does not operate by default on a particular Scheduler.
      Returns:
      the new Flowable instance
      See Also:
    • distinctUntilChanged

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull K> @NonNull Flowable<T> distinctUntilChanged(@NonNull @NonNull Function<? super @NonNull T,@NonNull K> keySelector)
      Returns a Flowable that emits all items emitted by the current Flowable that are distinct from their immediate predecessors, according to a key selector function and based on Object.equals(Object) comparison of those objects returned by the key selector function.

      It is recommended the keys' class K overrides the default Object.equals() to provide a meaningful comparison between the key objects as the default Java implementation only considers reference equivalence. Alternatively, use the distinctUntilChanged(BiPredicate) overload and provide a comparison function in case the class K can't be overridden with custom equals() or the comparison itself should happen on different terms or properties of the item class T (for which the keys can be derived via a similar selector).

      Note that the operator always retains the latest key from upstream regardless of the comparison result and uses it in the next comparison with the next key derived from the next upstream item.

      Note that if element type T in the flow is mutable, the comparison of the previous and current item may yield unexpected results if the items are mutated externally. Common cases are mutable CharSequences or Lists where the objects will actually have the same references when they are modified and distinctUntilChanged will evaluate subsequent items as same. To avoid such situation, it is recommended that mutable data is converted to an immutable one, for example using map(CharSequence::toString) or map(list -> Collections.unmodifiableList(new ArrayList<>(list))).

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      distinctUntilChanged does not operate by default on a particular Scheduler.
      Type Parameters:
      K - the key type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if keySelector is null
      See Also:
    • distinctUntilChanged

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final @NonNull Flowable<T> distinctUntilChanged(@NonNull @NonNull BiPredicate<? super @NonNull T,? super @NonNull T> comparer)
      Returns a Flowable that emits all items emitted by the current Flowable that are distinct from their immediate predecessors when compared with each other via the provided comparator function.

      Note that the operator always retains the latest item from upstream regardless of the comparison result and uses it in the next comparison with the next upstream item.

      Note that if element type T in the flow is mutable, the comparison of the previous and current item may yield unexpected results if the items are mutated externally. Common cases are mutable CharSequences or Lists where the objects will actually have the same references when they are modified and distinctUntilChanged will evaluate subsequent items as same. To avoid such situation, it is recommended that mutable data is converted to an immutable one, for example using map(CharSequence::toString) or map(list -> Collections.unmodifiableList(new ArrayList<>(list))).

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable'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:
      the new Flowable instance
      Throws:
      NullPointerException - if comparer is null
      Since:
      2.0
      See Also:
    • doFinally

      Calls the specified action after this Flowable signals onError or onComplete or gets canceled 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 current Flowable'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 canceled
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onFinally is null
      Since:
      2.1
    • doAfterNext

      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 current Flowable'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
      Throws:
      NullPointerException - if onAfterNext is null
      Since:
      2.1
    • doAfterTerminate

      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 current Flowable's backpressure behavior.
      Scheduler:
      doAfterTerminate does not operate by default on a particular Scheduler.
      Parameters:
      onAfterTerminate - an Action to be invoked when the current Flowable finishes
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onAfterTerminate is null
      See Also:
    • doOnCancel

      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.

      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 current Flowable's Subscription is canceled
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onCancel is null
      See Also:
    • doOnComplete

      Invokes an Action just before the current Flowable calls onComplete.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      doOnComplete does not operate by default on a particular Scheduler.
      Parameters:
      onComplete - the action to invoke when the current Flowable calls onComplete
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onComplete is null
      See Also:
    • doOnEach

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") private @NonNull Flowable<T> doOnEach(@NonNull @NonNull Consumer<? super @NonNull T> onNext, @NonNull @NonNull Consumer<? super Throwable> onError, Action onComplete, Action onAfterTerminate)
      Calls the appropriate onXXX consumer (shared between all subscribers) whenever a signal with the same type passes through, before forwarding them to downstream.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      doOnEach does not operate by default on a particular Scheduler.
      Parameters:
      onNext - the Consumer to invoke when the current Flowable calls onNext
      onError - the Consumer to invoke when the current Flowable calls onError
      onComplete - the Action to invoke when the current Flowable calls onComplete
      onAfterTerminate - the Action to invoke when the current Flowable calls onAfterTerminate
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onNext, onError, onComplete or onAfterTerminate is null
      See Also:
    • doOnEach

      Invokes a Consumer with a Notification instances matching the signals emitted by the current Flowable before they are forwarded to the downstream.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable'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 current Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onNotification is null
      See Also:
    • doOnEach

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") public final @NonNull Flowable<T> doOnEach(@NonNull @NonNull org.reactivestreams.Subscriber<? super @NonNull T> subscriber)
      Calls the appropriate methods of the given Subscriber when the current Flowable signals events before forwarding it to the downstream.

      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 current Flowable'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 new Flowable instance
      Throws:
      NullPointerException - if subscriber is null
      See Also:
    • doOnError

      Calls the given Consumer with the error Throwable if the current Flowable failed before forwarding it to the downstream.

      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 current Flowable's backpressure behavior.
      Scheduler:
      doOnError does not operate by default on a particular Scheduler.
      Parameters:
      onError - the action to invoke if the current Flowable calls onError
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onError is null
      See Also:
    • doOnLifecycle

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") public final @NonNull Flowable<T> doOnLifecycle(@NonNull @NonNull Consumer<? super org.reactivestreams.Subscription> onSubscribe, @NonNull @NonNull LongConsumer onRequest, @NonNull @NonNull 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 current Flowable'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(Subscription)
      onRequest - a LongConsumer called with the request amount sent via Subscription.request(long)
      onCancel - called when the downstream cancels the Subscription via Subscription.cancel()
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onSubscribe, onRequest or onCancel is null
      See Also:
    • doOnNext

      Calls the given Consumer with the value emitted by the current Flowable before forwarding it to the downstream.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      doOnNext does not operate by default on a particular Scheduler.
      Parameters:
      onNext - the action to invoke when the current Flowable calls onNext
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onNext is null
      See Also:
    • doOnRequest

      Calls the given LongConsumer with the request amount from the downstream before forwarding it to the current Flowable.

      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 current Flowable'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 the current Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onRequest is null
      Since:
      2.0
      See Also:
    • doOnSubscribe

      @CheckReturnValue @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") @NonNull public final @NonNull Flowable<T> doOnSubscribe(@NonNull @NonNull Consumer<? super org.reactivestreams.Subscription> onSubscribe)
      Calls the given Consumer with the Subscription provided by the current Flowable upon subscription from the downstream before forwarding it to the subscriber's onSubscribe method.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable'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 new Flowable instance
      Throws:
      NullPointerException - if onSubscribe is null
      See Also:
    • doOnTerminate

      Calls the given Action when the current Flowable completes normally or with an error before those signals are forwarded to the downstream.

      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 current Flowable's backpressure behavior.
      Scheduler:
      doOnTerminate does not operate by default on a particular Scheduler.
      Parameters:
      onTerminate - the action to invoke when the current Flowable calls onComplete or onError
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onTerminate is null
      See Also:
    • elementAt

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final @NonNull 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 current Flowable in a bounded manner.
      Scheduler:
      elementAt does not operate by default on a particular Scheduler.
      Parameters:
      index - the zero-based index of the item to retrieve
      Returns:
      the new Maybe instance
      Throws:
      IndexOutOfBoundsException - if index is negative
      See Also:
    • elementAt

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final @NonNull Single<T> elementAt(long index, @NonNull @NonNull T defaultItem)
      Returns a Single 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 current Flowable in a bounded manner.
      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:
      the new Single instance
      Throws:
      NullPointerException - if defaultItem is null
      IndexOutOfBoundsException - if index is negative
      See Also:
    • elementAtOrError

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final @NonNull Single<T> elementAtOrError(long index)
      Returns a Single 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 current Flowable in a bounded manner.
      Scheduler:
      elementAtOrError does not operate by default on a particular Scheduler.
      Parameters:
      index - the zero-based index of the item to retrieve
      Returns:
      the new Single instance
      Throws:
      IndexOutOfBoundsException - if index is less than 0
      See Also:
    • filter

      Filters items emitted by the current Flowable by only emitting those that satisfy a specified predicate.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable'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 current Flowable, returning true if it passes the filter
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if predicate is null
      See Also:
    • 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 current Flowable in a bounded manner.
      Scheduler:
      firstElement does not operate by default on a particular Scheduler.
      Returns:
      the new Maybe instance
      See Also:
    • first

      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 current Flowable in a bounded manner.
      Scheduler:
      first does not operate by default on a particular Scheduler.
      Parameters:
      defaultItem - the default item to emit if the current Flowable doesn't emit anything
      Returns:
      the new Single instance
      Throws:
      NullPointerException - if defaultItem is null
      See Also:
    • 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 current Flowable in a bounded manner.
      Scheduler:
      firstOrError does not operate by default on a particular Scheduler.
      Returns:
      the new Single instance
      See Also:
    • flatMap

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> flatMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull R>> mapper)
      Returns a Flowable that emits items based on applying a function that you supply to each item emitted by the current Flowable, 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.
      Type Parameters:
      R - the value type of the inner Publishers and the output type
      Parameters:
      mapper - a function that, when applied to an item emitted by the current Flowable, returns a Publisher
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      See Also:
    • flatMap

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> flatMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull R>> mapper, boolean delayErrors)
      Returns a Flowable that emits items based on applying a function that you supply to each item emitted by the current Flowable, 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.
      Type Parameters:
      R - the value type of the inner Publishers and the output type
      Parameters:
      mapper - a function that, when applied to an item emitted by the current Flowable, returns a 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 signaling an exception will terminate the whole sequence immediately
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      See Also:
    • flatMap

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> flatMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull R>> mapper, int maxConcurrency)
      Returns a Flowable that emits items based on applying a function that you supply to each item emitted by the current Flowable, 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.
      Type Parameters:
      R - the value type of the inner Publishers and the output type
      Parameters:
      mapper - a function that, when applied to an item emitted by the current Flowable, returns a Publisher
      maxConcurrency - the maximum number of Publishers that may be subscribed to concurrently
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if maxConcurrency is non-positive
      Since:
      2.0
      See Also:
    • flatMap

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> flatMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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 current Flowable, 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.
      Type Parameters:
      R - the value type of the inner Publishers and the output type
      Parameters:
      mapper - a function that, when applied to an item emitted by the current Flowable, returns a 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 signaling an exception will terminate the whole sequence immediately
      maxConcurrency - the maximum number of Publishers that may be subscribed to concurrently
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if maxConcurrency is non-positive
      Since:
      2.0
      See Also:
    • flatMap

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> flatMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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 current Flowable, 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.
      Type Parameters:
      R - the value type of the inner Publishers and the output type
      Parameters:
      mapper - a function that, when applied to an item emitted by the current Flowable, returns a 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 signaling 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:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if maxConcurrency or bufferSize is non-positive
      Since:
      2.0
      See Also:
    • flatMap

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> flatMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull R>> onNextMapper, @NonNull @NonNull Function<? super Throwable,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull R>> onErrorMapper, @NonNull @NonNull Supplier<? extends org.reactivestreams.Publisher<? extends @NonNull R>> onCompleteSupplier)
      Returns a Flowable that applies a function to each item emitted or notification raised by the current Flowable 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.
      Type Parameters:
      R - the result type
      Parameters:
      onNextMapper - a function that returns a Publisher to merge for each item emitted by the current Flowable
      onErrorMapper - a function that returns a Publisher to merge for an onError notification from the current Flowable
      onCompleteSupplier - a function that returns a Publisher to merge for an onComplete notification from the current Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onNextMapper, onErrorMapper or onCompleteSupplier is null
      See Also:
    • flatMap

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> flatMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull R>> onNextMapper, @NonNull @NonNull Function<Throwable,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull R>> onErrorMapper, @NonNull @NonNull Supplier<? extends org.reactivestreams.Publisher<? extends @NonNull R>> onCompleteSupplier, int maxConcurrency)
      Returns a Flowable that applies a function to each item emitted or notification raised by the current Flowable 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.
      Type Parameters:
      R - the result type
      Parameters:
      onNextMapper - a function that returns a Publisher to merge for each item emitted by the current Flowable
      onErrorMapper - a function that returns a Publisher to merge for an onError notification from the current Flowable
      onCompleteSupplier - a function that returns a Publisher to merge for an onComplete notification from the current Flowable
      maxConcurrency - the maximum number of Publishers that may be subscribed to concurrently
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onNextMapper, onErrorMapper or onCompleteSupplier is null
      IllegalArgumentException - if maxConcurrency is non-positive
      Since:
      2.0
      See Also:
    • flatMap

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull U, @NonNull R> @NonNull Flowable<R> flatMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull U>> mapper, @NonNull @NonNull BiFunction<? super @NonNull T,? super @NonNull U,? extends @NonNull R> combiner)
      Returns a Flowable that emits the results of a specified function to the pair of values emitted by the current Flowable 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.
      Type Parameters:
      U - the type of items emitted by the inner Publishers
      R - the type of items emitted by the combiner function
      Parameters:
      mapper - a function that returns a Publisher for each item emitted by the current Flowable
      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 Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper or combiner is null
      See Also:
    • flatMap

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull U, @NonNull R> @NonNull Flowable<R> flatMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull U>> mapper, @NonNull @NonNull BiFunction<? super @NonNull T,? super @NonNull U,? extends @NonNull R> combiner, boolean delayErrors)
      Returns a Flowable that emits the results of a specified function to the pair of values emitted by the current Flowable and a specified inner 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.
      Type Parameters:
      U - the type of items emitted by the inner Publishers
      R - the type of items emitted by the combiner functions
      Parameters:
      mapper - a function that returns a Publisher for each item emitted by the current Flowable
      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 Flowable
      delayErrors - if true, exceptions from the current Flowable and all inner Publishers are delayed until all of them terminate if false, the first one signaling an exception will terminate the whole sequence immediately
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper or combiner is null
      See Also:
    • flatMap

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull U, @NonNull R> @NonNull Flowable<R> flatMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull U>> mapper, @NonNull @NonNull BiFunction<? super @NonNull T,? super @NonNull U,? extends @NonNull 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 current Flowable 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.
      Type Parameters:
      U - the type of items emitted by the inner Publishers
      R - the type of items emitted by the combiner function
      Parameters:
      mapper - a function that returns a Publisher for each item emitted by the current Flowable
      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 Flowable
      delayErrors - if true, exceptions from the current Flowable and all inner Publishers are delayed until all of them terminate if false, the first one signaling an exception will terminate the whole sequence immediately
      maxConcurrency - the maximum number of Publishers that may be subscribed to concurrently
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper or combiner is null
      IllegalArgumentException - if maxConcurrency is non-positive
      Since:
      2.0
      See Also:
    • flatMap

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull U, @NonNull R> @NonNull Flowable<R> flatMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull U>> mapper, @NonNull @NonNull BiFunction<? super @NonNull T,? super @NonNull U,? extends @NonNull 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 current Flowable 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.
      Type Parameters:
      U - the type of items emitted by the inner Publishers
      R - the type of items emitted by the combiner function
      Parameters:
      mapper - a function that returns a Publisher for each item emitted by the current Flowable
      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 Flowable
      delayErrors - if true, exceptions from the current Flowable and all inner Publishers are delayed until all of them terminate if false, the first one signaling 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:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper or combiner is null
      IllegalArgumentException - if maxConcurrency or bufferSize is non-positive
      Since:
      2.0
      See Also:
    • flatMap

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull U, @NonNull R> @NonNull Flowable<R> flatMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull U>> mapper, @NonNull @NonNull BiFunction<? super @NonNull T,? super @NonNull U,? extends @NonNull R> combiner, int maxConcurrency)
      Returns a Flowable that emits the results of a specified function to the pair of values emitted by the current Flowable 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.
      Type Parameters:
      U - the type of items emitted by the inner Publishers
      R - the type of items emitted by the combiner function
      Parameters:
      mapper - a function that returns a Publisher for each item emitted by the current Flowable
      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 Flowable
      maxConcurrency - the maximum number of Publishers that may be subscribed to concurrently
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper or combiner is null
      IllegalArgumentException - if maxConcurrency is non-positive
      Since:
      2.0
      See Also:
    • flatMapCompletable

      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
      Throws:
      NullPointerException - if mapper is null
    • flatMapCompletable

      @CheckReturnValue @NonNull @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final @NonNull Completable flatMapCompletable(@NonNull @NonNull Function<? super @NonNull 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
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if maxConcurrency is non-positive
    • flatMapIterable

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull U> @NonNull Flowable<U> flatMapIterable(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends Iterable<? extends @NonNull U>> mapper)
      Merges Iterables generated by a mapper Function for each individual item emitted by the current Flowable into a single Flowable sequence.

      Backpressure:
      The operator honors backpressure from downstream. The current Flowables is expected to honor backpressure as well. If the current Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      flatMapIterable does not operate by default on a particular Scheduler.
      Type Parameters:
      U - the output type and the element type of the Iterables
      Parameters:
      mapper - a function that returns an Iterable sequence of values for when given an item emitted by the current Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      See Also:
    • flatMapIterable

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull U> @NonNull Flowable<U> flatMapIterable(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends Iterable<? extends @NonNull U>> mapper, int bufferSize)
      Merges Iterables generated by a mapper Function for each individual item emitted by the current Flowable into a single Flowable sequence.

      Backpressure:
      The operator honors backpressure from downstream. The current Flowables is expected to honor backpressure as well. If the current Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      flatMapIterable does not operate by default on a particular Scheduler.
      Type Parameters:
      U - the type of item emitted by the resulting Iterable
      Parameters:
      mapper - a function that returns an Iterable sequence of values for when given an item emitted by the current Flowable
      bufferSize - the number of elements to prefetch from the current Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • flatMapIterable

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull U, @NonNull V> @NonNull Flowable<V> flatMapIterable(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends Iterable<? extends @NonNull U>> mapper, @NonNull @NonNull BiFunction<? super @NonNull T,? super @NonNull U,? extends @NonNull V> combiner)
      Merges Iterables generated by a mapper Function for each individual item emitted by the current Flowable into a single Flowable sequence where the resulting items will be the combination of the original item and each inner item of the respective Iterable as returned by the resultSelector BiFunction.

      Backpressure:
      The operator honors backpressure from downstream and the current Flowables is consumed in a bounded manner (requesting bufferSize() items upfront, then 75% of it after 75% received).
      Scheduler:
      flatMapIterable does not operate by default on a particular Scheduler.
      Type Parameters:
      U - the element type of the Iterables
      V - the output type as determined by the resultSelector function
      Parameters:
      mapper - a function that returns an Iterable sequence of values for each item emitted by the current Flowable
      combiner - a function that returns an item based on the item emitted by the current Flowable and the Iterable returned for that item by the collectionSelector
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper or combiner is null
      See Also:
    • flatMapIterable

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull U, @NonNull V> @NonNull Flowable<V> flatMapIterable(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends Iterable<? extends @NonNull U>> mapper, @NonNull @NonNull BiFunction<? super @NonNull T,? super @NonNull U,? extends @NonNull V> combiner, int prefetch)
      Merges Iterables generated by a mapper Function for each individual item emitted by the current Flowable into a single Flowable sequence where the resulting items will be the combination of the original item and each inner item of the respective Iterable as returned by the resultSelector BiFunction.

      Backpressure:
      The operator honors backpressure from downstream. The current Flowables is expected to honor backpressure as well. If the current Flowable violates the rule, the operator will signal a MissingBackpressureException.
      Scheduler:
      flatMapIterable does not operate by default on a particular Scheduler.
      Type Parameters:
      U - the element type of the inner Iterable sequences
      V - the type of item emitted by the resulting Flowable
      Parameters:
      mapper - a function that returns an Iterable sequence of values for when given an item emitted by the current Flowable
      combiner - a function that returns an item based on the item emitted by the current Flowable and the Iterable returned for that item by the collectionSelector
      prefetch - the number of elements to prefetch from the current Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper or combiner is null
      IllegalArgumentException - if prefetch is non-positive
      Since:
      2.0
      See Also:
    • flatMapMaybe

      @CheckReturnValue @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> flatMapMaybe(@NonNull @NonNull Function<? super @NonNull T,? extends MaybeSource<? extends @NonNull R>> mapper)
      Maps each element of the upstream Flowable into MaybeSources, subscribes to all of them and merges their onSuccess values, in no particular order, into a single Flowable sequence.

      Backpressure:
      The operator consumes the upstream in an unbounded manner.
      Scheduler:
      flatMapMaybe does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the result value type
      Parameters:
      mapper - the function that received each source value and transforms them into MaybeSources.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
    • flatMapMaybe

      @CheckReturnValue @NonNull @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> flatMapMaybe(@NonNull @NonNull Function<? super @NonNull T,? extends MaybeSource<? extends @NonNull R>> mapper, boolean delayErrors, int maxConcurrency)
      Maps each element of the upstream Flowable into MaybeSources, subscribes to at most maxConcurrency MaybeSources at a time and merges their onSuccess values, in no particular order, into a single Flowable sequence, 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.
      Type Parameters:
      R - the result value type
      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
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if maxConcurrency is non-positive
    • flatMapSingle

      @CheckReturnValue @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> flatMapSingle(@NonNull @NonNull Function<? super @NonNull T,? extends SingleSource<? extends @NonNull R>> mapper)
      Maps each element of the upstream Flowable into SingleSources, subscribes to all of them and merges their onSuccess values, in no particular order, into a single Flowable sequence.
      Backpressure:
      The operator consumes the upstream in an unbounded manner.
      Scheduler:
      flatMapSingle does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the result value type
      Parameters:
      mapper - the function that received each source value and transforms them into SingleSources.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
    • flatMapSingle

      @CheckReturnValue @NonNull @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> flatMapSingle(@NonNull @NonNull Function<? super @NonNull T,? extends SingleSource<? extends @NonNull R>> mapper, boolean delayErrors, int maxConcurrency)
      Maps each element of the upstream Flowable into SingleSources, subscribes to at most maxConcurrency SingleSources at a time and merges their onSuccess values, in no particular order, into a single Flowable sequence, 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.
      Type Parameters:
      R - the result value type
      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
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if maxConcurrency is non-positive
    • forEach

      Subscribes to the current Flowable and receives notifications for each element.

      Alias to subscribe(Consumer)

      Backpressure:
      The operator consumes the current Flowable 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 canceling an asynchronous sequence
      Throws:
      NullPointerException - if onNext is null
      See Also:
    • forEachWhile

      Subscribes to the current Flowable 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(Throwable) handler.

      Backpressure:
      The operator consumes the current Flowable 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 canceling an asynchronous sequence
      Throws:
      NullPointerException - if onNext is null
      See Also:
    • forEachWhile

      Subscribes to the current Flowable and receives notifications for each element and error events until the onNext Predicate returns false.
      Backpressure:
      The operator consumes the current Flowable 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 canceling an asynchronous sequence
      Throws:
      NullPointerException - if onNext or onError is null
      See Also:
    • forEachWhile

      Subscribes to the current Flowable and receives notifications for each element and the terminal events until the onNext Predicate returns false.
      Backpressure:
      The operator consumes the current Flowable 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 signaled.
      Returns:
      a Disposable that allows canceling an asynchronous sequence
      Throws:
      NullPointerException - if onNext, onError or onComplete is null
      See Also:
    • groupBy

      Groups the items emitted by the current Flowable according to a specified criterion, and emits these grouped items as GroupedFlowables. The emitted GroupedFlowable 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 GroupedFlowable 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 GroupedFlowables 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.

      Note that the GroupedFlowables should be subscribed to as soon as possible, otherwise, the unconsumed groups may starve other groups due to the internal backpressure coordination of the groupBy operator. Such hangs can be usually avoided by using flatMap(Function, int) or concatMapEager(Function, int, int) and overriding the default maximum concurrency value to be greater or equal to the expected number of groups, possibly using Integer.MAX_VALUE if the number of expected groups is unknown.

      Note also that ignoring groups or subscribing later (i.e., on another thread) will result in so-called group abandonment where a group will only contain one element and the group will be re-created over and over as new upstream items trigger a new group. The behavior is a trade-off between no-dataloss, upstream cancellation and excessive group creation.

      Backpressure:
      The consumer of the returned Flowable has to be ready to receive new GroupedFlowables or else this operator will signal MissingBackpressureException. To avoid this exception, make sure a combining operator (such as flatMap) has adequate amount of buffering/prefetch configured. The inner GroupedFlowables honor backpressure but due to the single-source multiple consumer nature of this operator, each group must be consumed so the whole operator can make progress and not hang.
      Scheduler:
      groupBy does not operate by default on a particular Scheduler.
      Error handling:
      If the upstream signals or the callback(s) throw an exception, the returned Flowable and all active inner GroupedFlowables will signal the same exception.
      Type Parameters:
      K - the key type
      Parameters:
      keySelector - a function that extracts the key for each item
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if keySelector is null
      See Also:
    • groupBy

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("none") @NonNull public final <@NonNull K> @NonNull Flowable<GroupedFlowable<K,T>> groupBy(@NonNull @NonNull Function<? super @NonNull T,? extends @NonNull K> keySelector, boolean delayError)
      Groups the items emitted by the current Flowable according to a specified criterion, and emits these grouped items as GroupedFlowables. The emitted GroupedFlowable 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 GroupedFlowable 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 GroupedFlowables 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.

      Note that the GroupedFlowables should be subscribed to as soon as possible, otherwise, the unconsumed groups may starve other groups due to the internal backpressure coordination of the groupBy operator. Such hangs can be usually avoided by using flatMap(Function, int) or concatMapEager(Function, int, int) and overriding the default maximum concurrency value to be greater or equal to the expected number of groups, possibly using Integer.MAX_VALUE if the number of expected groups is unknown.

      Note also that ignoring groups or subscribing later (i.e., on another thread) will result in so-called group abandonment where a group will only contain one element and the group will be re-created over and over as new upstream items trigger a new group. The behavior is a trade-off between no-dataloss, upstream cancellation and excessive group creation.

      Backpressure:
      The consumer of the returned Flowable has to be ready to receive new GroupedFlowables or else this operator will signal MissingBackpressureException. To avoid this exception, make sure a combining operator (such as flatMap) has adequate amount of buffering/prefetch configured. The inner GroupedFlowables honor backpressure but due to the single-source multiple consumer nature of this operator, each group must be consumed so the whole operator can make progress and not hang.
      Scheduler:
      groupBy does not operate by default on a particular Scheduler.
      Error handling:
      If the upstream signals or the callback(s) throw an exception, the returned Flowable and all active inner GroupedFlowables will signal the same exception.
      Type Parameters:
      K - the key type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if keySelector is null
      See Also:
    • groupBy

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("none") @NonNull public final <@NonNull K, @NonNull V> @NonNull Flowable<GroupedFlowable<K,V>> groupBy(@NonNull @NonNull Function<? super @NonNull T,? extends @NonNull K> keySelector, @NonNull @NonNull Function<? super @NonNull T,? extends @NonNull V> valueSelector)
      Groups the items emitted by the current Flowable according to a specified criterion, and emits these grouped items as GroupedFlowables. The emitted GroupedFlowable 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 GroupedFlowable 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 GroupedFlowables 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.

      Note that the GroupedFlowables should be subscribed to as soon as possible, otherwise, the unconsumed groups may starve other groups due to the internal backpressure coordination of the groupBy operator. Such hangs can be usually avoided by using flatMap(Function, int) or concatMapEager(Function, int, int) and overriding the default maximum concurrency value to be greater or equal to the expected number of groups, possibly using Integer.MAX_VALUE if the number of expected groups is unknown.

      Note also that ignoring groups or subscribing later (i.e., on another thread) will result in so-called group abandonment where a group will only contain one element and the group will be re-created over and over as new upstream items trigger a new group. The behavior is a trade-off between no-dataloss, upstream cancellation and excessive group creation.

      Backpressure:
      The consumer of the returned Flowable has to be ready to receive new GroupedFlowables or else this operator will signal MissingBackpressureException. To avoid this exception, make sure a combining operator (such as flatMap) has adequate amount of buffering/prefetch configured. The inner GroupedFlowables honor backpressure but due to the single-source multiple consumer nature of this operator, each group must be consumed so the whole operator can make progress and not hang.
      Scheduler:
      groupBy does not operate by default on a particular Scheduler.
      Error handling:
      If the upstream signals or the callback(s) throw an exception, the returned Flowable and all active inner GroupedFlowables will signal the same exception.
      Type Parameters:
      K - the key type
      V - the element type
      Parameters:
      keySelector - a function that extracts the key for each item
      valueSelector - a function that extracts the return element for each item
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if keySelector or valueSelector is null
      See Also:
    • groupBy

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("none") @NonNull public final <@NonNull K, @NonNull V> @NonNull Flowable<GroupedFlowable<K,V>> groupBy(@NonNull @NonNull Function<? super @NonNull T,? extends @NonNull K> keySelector, @NonNull @NonNull Function<? super @NonNull T,? extends @NonNull V> valueSelector, boolean delayError)
      Groups the items emitted by the current Flowable according to a specified criterion, and emits these grouped items as GroupedFlowables. The emitted GroupedFlowable 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 GroupedFlowable 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 GroupedFlowables 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.

      Note that the GroupedFlowables should be subscribed to as soon as possible, otherwise, the unconsumed groups may starve other groups due to the internal backpressure coordination of the groupBy operator. Such hangs can be usually avoided by using flatMap(Function, int) or concatMapEager(Function, int, int) and overriding the default maximum concurrency value to be greater or equal to the expected number of groups, possibly using Integer.MAX_VALUE if the number of expected groups is unknown.

      Note also that ignoring groups or subscribing later (i.e., on another thread) will result in so-called group abandonment where a group will only contain one element and the group will be re-created over and over as new upstream items trigger a new group. The behavior is a trade-off between no-dataloss, upstream cancellation and excessive group creation.

      Backpressure:
      The consumer of the returned Flowable has to be ready to receive new GroupedFlowables or else this operator will signal MissingBackpressureException. To avoid this exception, make sure a combining operator (such as flatMap) has adequate amount of buffering/prefetch configured. The inner GroupedFlowables honor backpressure but due to the single-source multiple consumer nature of this operator, each group must be consumed so the whole operator can make progress and not hang.
      Scheduler:
      groupBy does not operate by default on a particular Scheduler.
      Error handling:
      If the upstream signals or the callback(s) throw an exception, the returned Flowable and all active inner GroupedFlowables will signal the same exception.
      Type Parameters:
      K - the key type
      V - the element type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if keySelector or valueSelector is null
      See Also:
    • groupBy

      @CheckReturnValue @NonNull @BackpressureSupport(SPECIAL) @SchedulerSupport("none") public final <@NonNull K, @NonNull V> @NonNull Flowable<GroupedFlowable<K,V>> groupBy(@NonNull @NonNull Function<? super @NonNull T,? extends @NonNull K> keySelector, @NonNull @NonNull Function<? super @NonNull T,? extends @NonNull V> valueSelector, boolean delayError, int bufferSize)
      Groups the items emitted by the current Flowable according to a specified criterion, and emits these grouped items as GroupedFlowables. The emitted GroupedFlowable 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 GroupedFlowable 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 GroupedFlowables 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.

      Note that the GroupedFlowables should be subscribed to as soon as possible, otherwise, the unconsumed groups may starve other groups due to the internal backpressure coordination of the groupBy operator. Such hangs can be usually avoided by using flatMap(Function, int) or concatMapEager(Function, int, int) and overriding the default maximum concurrency value to be greater or equal to the expected number of groups, possibly using Integer.MAX_VALUE if the number of expected groups is unknown.

      Note also that ignoring groups or subscribing later (i.e., on another thread) will result in so-called group abandonment where a group will only contain one element and the group will be re-created over and over as new upstream items trigger a new group. The behavior is a trade-off between no-dataloss, upstream cancellation and excessive group creation.

      Backpressure:
      The consumer of the returned Flowable has to be ready to receive new GroupedFlowables or else this operator will signal MissingBackpressureException. To avoid this exception, make sure a combining operator (such as flatMap) has adequate amount of buffering/prefetch configured. The inner GroupedFlowables honor backpressure but due to the single-source multiple consumer nature of this operator, each group must be consumed so the whole operator can make progress and not hang.
      Scheduler:
      groupBy does not operate by default on a particular Scheduler.
      Error handling:
      If the upstream signals or the callback(s) throw an exception, the returned Flowable and all active inner GroupedFlowables will signal the same exception.
      Type Parameters:
      K - the key type
      V - the element type
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if keySelector or valueSelector is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • groupBy

      @CheckReturnValue @NonNull @BackpressureSupport(SPECIAL) @SchedulerSupport("none") public final <@NonNull K, @NonNull V> @NonNull Flowable<GroupedFlowable<K,V>> groupBy(@NonNull @NonNull Function<? super @NonNull T,? extends @NonNull K> keySelector, @NonNull @NonNull Function<? super @NonNull T,? extends @NonNull V> valueSelector, boolean delayError, int bufferSize, @NonNull @NonNull Function<? super Consumer<Object>,? extends Map<@NonNull K,Object>> evictingMapFactory)
      Groups the items emitted by the current Flowable according to a specified criterion, and emits these grouped items as GroupedFlowables. The emitted GroupedFlowable 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 GroupedFlowable emission. The evictingMapFactory is used to create a map that will be used to hold the GroupedFlowables by key. The evicting map created by this factory must notify the provided Consumer<Object> with the entry value (not the key!) when an entry in this map has been evicted. The next source emission will bring about the completion of the evicted GroupedFlowables and the arrival of an item with the same key as a completed GroupedFlowable will prompt the creation and emission of a new GroupedFlowable with that key.

      A use case for specifying an evictingMapFactory is where the source is infinite and fast and over time the number of keys grows enough to be a concern in terms of the memory footprint of the internal hash map containing the GroupedFlowables.

      The map created by an evictingMapFactory must be thread-safe.

      An example of an evictingMapFactory using CacheBuilder from the Guava library is below:

      
       Function<Consumer<Object>, Map<Integer, Object>> evictingMapFactory =
         notify ->
             CacheBuilder
               .newBuilder()
               .maximumSize(3)
               .removalListener(entry -> {
                    try {
                        // emit the value not the key!
                        notify.accept(entry.getValue());
                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                  })
               .<Integer, Object> build()
               .asMap();
      
       // Emit 1000 items but ensure that the
       // internal map never has more than 3 items in it
         Flowable
         .range(1, 1000)
         // note that number of keys is 10
         .groupBy(x -> x % 10, x -> x, true, 16, evictingMapFactory)
         .flatMap(g -> g)
         .forEach(System.out::println);
       

      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 GroupedFlowables 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.

      Note that the GroupedFlowables should be subscribed to as soon as possible, otherwise, the unconsumed groups may starve other groups due to the internal backpressure coordination of the groupBy operator. Such hangs can be usually avoided by using flatMap(Function, int) or concatMapEager(Function, int, int) and overriding the default maximum concurrency value to be greater or equal to the expected number of groups, possibly using Integer.MAX_VALUE if the number of expected groups is unknown.

      Note also that ignoring groups or subscribing later (i.e., on another thread) will result in so-called group abandonment where a group will only contain one element and the group will be re-created over and over as new upstream items trigger a new group. The behavior is a trade-off between no-dataloss, upstream cancellation and excessive group creation.

      Backpressure:
      The consumer of the returned Flowable has to be ready to receive new GroupedFlowables or else this operator will signal MissingBackpressureException. To avoid this exception, make sure a combining operator (such as flatMap) has adequate amount of buffering/prefetch configured. The inner GroupedFlowables honor backpressure but due to the single-source multiple consumer nature of this operator, each group must be consumed so the whole operator can make progress and not hang.
      Scheduler:
      groupBy does not operate by default on a particular Scheduler.
      Error handling:
      If the upstream signals or the callback(s) throw an exception, the returned Flowable and all active inner GroupedFlowables will signal the same exception.

      History: 2.1.10 - beta

      Type Parameters:
      K - the key type
      V - the element type
      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
      evictingMapFactory - The factory used to create a map that will be used by the implementation to hold the GroupedFlowables. The evicting map created by this factory must notify the provided Consumer<Object> with the entry value (not the key!) when an entry in this map has been evicted. The next source emission will bring about the completion of the evicted GroupedFlowables. See example above.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if keySelector, valueSelector or evictingMapFactory is null
      IllegalArgumentException - if bufferSize is non-positive
      Since:
      2.2
      See Also:
    • groupJoin

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("none") public final <@NonNull TRight, @NonNull TLeftEnd, @NonNull TRightEnd, @NonNull R> @NonNull Flowable<R> groupJoin(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull TRight> other, @NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<@NonNull TLeftEnd>> leftEnd, @NonNull @NonNull Function<? super @NonNull TRight,@NonNull ? extends org.reactivestreams.Publisher<@NonNull TRightEnd>> rightEnd, @NonNull @NonNull BiFunction<? super @NonNull T,? super Flowable<@NonNull TRight>,? extends @NonNull 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.
      Type Parameters:
      TRight - the value type of the right Publisher source
      TLeftEnd - the element type of the left duration Publishers
      TRightEnd - the element type of the right duration Publishers
      R - the result type
      Parameters:
      other - the other Publisher to correlate items from the current Flowable with
      leftEnd - a function that returns a Publisher whose emissions indicate the duration of the values of the current Flowable
      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 Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other, leftEnd, rightEnd or resultSelector is null
      See Also:
    • 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
      Since:
      2.0
    • ignoreElements

      Ignores all items emitted by the current Flowable and only calls onComplete or onError.

      Backpressure:
      This operator ignores backpressure as it doesn't emit any elements and consumes the current Flowable in an unbounded manner (i.e., no backpressure is applied to it).
      Scheduler:
      ignoreElements does not operate by default on a particular Scheduler.
      Returns:
      the new Completable instance
      See Also:
    • isEmpty

      Returns a Single that emits true if the current Flowable 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 current Flowable in an unbounded manner (i.e., without applying backpressure).
      Scheduler:
      isEmpty does not operate by default on a particular Scheduler.
      Returns:
      the new Single instance
      See Also:
    • join

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("none") public final <@NonNull TRight, @NonNull TLeftEnd, @NonNull TRightEnd, @NonNull R> @NonNull Flowable<R> join(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull TRight> other, @NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<@NonNull TLeftEnd>> leftEnd, @NonNull @NonNull Function<? super @NonNull TRight,@NonNull ? extends org.reactivestreams.Publisher<@NonNull TRightEnd>> rightEnd, @NonNull @NonNull BiFunction<? super @NonNull T,? super @NonNull TRight,? extends @NonNull 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.
      Type Parameters:
      TRight - the value type of the right Publisher source
      TLeftEnd - the element type of the left duration Publishers
      TRightEnd - the element type of the right duration Publishers
      R - the result type
      Parameters:
      other - the second Publisher to join items from
      leftEnd - a function to select a duration for each item emitted by the current Flowable, 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 Flowable for any two overlapping items emitted by the two Publishers
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other, leftEnd, rightEnd or resultSelector is null
      See Also:
    • 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 current Flowable in an unbounded manner (i.e., without applying backpressure).
      Scheduler:
      lastElement does not operate by default on a particular Scheduler.
      Returns:
      the new Maybe instance
      See Also:
    • last

      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 current Flowable 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 current Flowable is empty
      Returns:
      the new Single instance
      Throws:
      NullPointerException - if defaultItem is null
      See Also:
    • 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 current Flowable 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
      See Also:
    • lift

      This method requires advanced knowledge about building operators, please consider other standard composition methods first; Returns a Flowable which, when subscribed to, invokes the apply(Subscriber) method of the provided FlowableOperator for each individual downstream Subscriber and allows the insertion of a custom operator by accessing the downstream's Subscriber during this subscription phase and providing a new Subscriber, containing the custom operator's intended business logic, that will be used in the subscription process going further upstream.

      Generally, such a new Subscriber will wrap the downstream's Subscriber and forwards the onNext, onError and onComplete events from the upstream directly or according to the emission pattern the custom operator's business logic requires. In addition, such operator can intercept the flow control calls of cancel and request that would have traveled upstream and perform additional actions depending on the same business logic requirements.

      Example:

      
       // Step 1: Create the consumer type that will be returned by the FlowableOperator.apply():
      
       public final class CustomSubscriber<T> implements FlowableSubscriber<T>, Subscription {
      
           // The downstream's Subscriber that will receive the onXXX events
           final Subscriber<? super String> downstream;
      
           // The connection to the upstream source that will call this class' onXXX methods
           Subscription upstream;
      
           // The constructor takes the downstream subscriber and usually any other parameters
           public CustomSubscriber(Subscriber<? super String> downstream) {
               this.downstream = downstream;
           }
      
           // In the subscription phase, the upstream sends a Subscription to this class
           // and subsequently this class has to send a Subscription to the downstream.
           // Note that relaying the upstream's Subscription instance directly is not allowed in RxJava
           @Override
           public void onSubscribe(Subscription s) {
               if (upstream != null) {
                   s.cancel();
               } else {
                   upstream = s;
                   downstream.onSubscribe(this);
               }
           }
      
           // The upstream calls this with the next item and the implementation's
           // responsibility is to emit an item to the downstream based on the intended
           // business logic, or if it can't do so for the particular item,
           // request more from the upstream
           @Override
           public void onNext(T item) {
               String str = item.toString();
               if (str.length() < 2) {
                   downstream.onNext(str);
               } else {
                   upstream.request(1);
               }
           }
      
           // Some operators may handle the upstream's error while others
           // could just forward it to the downstream.
           @Override
           public void onError(Throwable throwable) {
               downstream.onError(throwable);
           }
      
           // When the upstream completes, usually the downstream should complete as well.
           @Override
           public void onComplete() {
               downstream.onComplete();
           }
      
           // Some operators have to intercept the downstream's request calls to trigger
           // the emission of queued items while others can simply forward the request
           // amount as is.
           @Override
           public void request(long n) {
               upstream.request(n);
           }
      
           // Some operators may use their own resources which should be cleaned up if
           // the downstream cancels the flow before it completed. Operators without
           // resources can simply forward the cancellation to the upstream.
           // In some cases, a canceled flag may be set by this method so that other parts
           // of this class may detect the cancellation and stop sending events
           // to the downstream.
           @Override
           public void cancel() {
               upstream.cancel();
           }
       }
      
       // Step 2: Create a class that implements the FlowableOperator interface and
       //         returns the custom consumer type from above in its apply() method.
       //         Such class may define additional parameters to be submitted to
       //         the custom consumer type.
      
       final class CustomOperator<T> implements FlowableOperator<String> {
           @Override
           public Subscriber<? super String> apply(Subscriber<? super T> upstream) {
               return new CustomSubscriber<T>(upstream);
           }
       }
      
       // Step 3: Apply the custom operator via lift() in a flow by creating an instance of it
       //         or reusing an existing one.
      
       Flowable.range(5, 10)
       .lift(new CustomOperator<Integer>())
       .test()
       .assertResult("5", "6", "7", "8", "9");
       

      Creating custom operators can be complicated and it is recommended one consults the RxJava wiki: Writing operators page about the tools, requirements, rules, considerations and pitfalls of implementing them.

      Note that implementing custom operators via this lift() method adds slightly more overhead by requiring an additional allocation and indirection per assembled flows. Instead, extending the abstract Flowable class and creating a FlowableTransformer with it is recommended.

      Note also that it is not possible to stop the subscription phase in lift() as the apply() method requires a non-null Subscriber instance to be returned, which is then unconditionally subscribed to the upstream Flowable. For example, if the operator decided there is no reason to subscribe to the upstream source because of some optimization possibility or a failure to prepare the operator, it still has to return a Subscriber that should immediately cancel the upstream's Subscription in its onSubscribe method. Again, using a FlowableTransformer and extending the Flowable is a better option as subscribeActual(org.reactivestreams.Subscriber<? super T>) can decide to not subscribe to its upstream after all.

      Backpressure:
      The Subscriber instance returned by the FlowableOperator 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, however, the FlowableOperator may use a Scheduler to support its own asynchronous behavior.
      Type Parameters:
      R - the output value type
      Parameters:
      lifter - the FlowableOperator that receives the downstream's Subscriber and should return a Subscriber with custom behavior to be used as the consumer for the current Flowable.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if lifter is null
      See Also:
    • map

      Returns a Flowable that applies a specified function to each item emitted by the current Flowable and emits the results of these function applications.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      map does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the output type
      Parameters:
      mapper - a function to apply to each item emitted by the current Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      See Also:
    • materialize

      Returns a Flowable that represents all of the emissions and notifications from the current Flowable into emissions marked with their original types within Notification objects.

      Backpressure:
      The operator honors backpressure from downstream and expects it from the current Flowable. If this expectation is violated, the operator may throw an IllegalStateException.
      Scheduler:
      materialize does not operate by default on a particular Scheduler.
      Returns:
      the new Flowable instance
      See Also:
    • mergeWith

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final @NonNull Flowable<T> mergeWith(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull 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:
      the new Flowable instance
      Throws:
      NullPointerException - if other is null
      See Also:
    • mergeWith

      Merges the sequence of items of this Flowable with the success value of the other SingleSource.

      The success value of the other SingleSource can get interleaved at any point of this Flowable sequence.

      Backpressure:
      The operator honors backpressure from downstream and ensures the success item from the SingleSource is emitted only when there is a downstream demand.
      Scheduler:
      mergeWith does not operate by default on a particular Scheduler.

      History: 2.1.10 - experimental

      Parameters:
      other - the SingleSource whose success value to merge with
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other is null
      Since:
      2.2
    • mergeWith

      Merges the sequence of items of this Flowable with the success value of the other MaybeSource or waits for both to complete normally if the MaybeSource is empty.

      The success value of the other MaybeSource can get interleaved at any point of this Flowable sequence.

      Backpressure:
      The operator honors backpressure from downstream and ensures the success item from the MaybeSource is emitted only when there is a downstream demand.
      Scheduler:
      mergeWith does not operate by default on a particular Scheduler.

      History: 2.1.10 - experimental

      Parameters:
      other - the MaybeSource which provides a success value to merge with or completes
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other is null
      Since:
      2.2
    • mergeWith

      Relays the items of this Flowable and completes only when the other CompletableSource completes as well.

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

      History: 2.1.10 - experimental

      Parameters:
      other - the CompletableSource to await for completion
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other is null
      Since:
      2.2
    • observeOn

      Signals the items and terminal signals of the current Flowable on the 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.

      This operator keeps emitting as many signals as it can on the given Scheduler's Worker thread, which may result in a longer than expected occupation of this thread. In other terms, it does not allow per-signal fairness in case the worker runs on a shared underlying thread. If such fairness and signal/work interleaving is preferred, use the delay operator with zero time instead.

      Backpressure:
      This operator honors backpressure from downstream and expects it from the current Flowable. 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(long, TimeUnit), timer(long, TimeUnit), PublishProcessor or BehaviorProcessor and apply any of the onBackpressureXXX operators before applying observeOn itself. Note also that request amounts are not preserved between the immediate downstream and the immediate upstream. The operator always requests the default bufferSize() amount first, then after every 75% of that amount delivered, another 75% of this default value. If preserving the request amounts is to be preferred over potential excess scheduler infrastructure use, consider applying delay(long, TimeUnit, Scheduler) with zero time instead.
      Scheduler:
      You specify which Scheduler this operator will use.
      Parameters:
      scheduler - the Scheduler to notify Subscribers on
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if scheduler is null
      See Also:
    • observeOn

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("custom") @NonNull public final @NonNull Flowable<T> observeOn(@NonNull @NonNull Scheduler scheduler, boolean delayError)
      Signals the items and terminal signals of the current Flowable on the specified Scheduler, asynchronously with a bounded buffer and optionally delays onError notifications.

      This operator keeps emitting as many signals as it can on the given Scheduler's Worker thread, which may result in a longer than expected occupation of this thread. In other terms, it does not allow per-signal fairness in case the worker runs on a shared underlying thread. If such fairness and signal/work interleaving is preferred, use the delay operator with zero time instead.

      Backpressure:
      This operator honors backpressure from downstream and expects it from the current Flowable. 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(long, TimeUnit), timer(long, TimeUnit), PublishProcessor or BehaviorProcessor and apply any of the onBackpressureXXX operators before applying observeOn itself. Note also that request amounts are not preserved between the immediate downstream and the immediate upstream. The operator always requests the default bufferSize() amount first, then after every 75% of that amount delivered, another 75% of this default value. If preserving the request amounts is to be preferred over potential excess scheduler infrastructure use, consider applying delay(long, TimeUnit, Scheduler, boolean) with zero time instead.
      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 new Flowable instance
      Throws:
      NullPointerException - if scheduler is null
      See Also:
    • observeOn

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("custom") public final @NonNull Flowable<T> observeOn(@NonNull @NonNull Scheduler scheduler, boolean delayError, int bufferSize)
      Signals the items and terminal signals of the current Flowable on the specified Scheduler, asynchronously with a bounded buffer of configurable size and optionally delays onError notifications.

      This operator keeps emitting as many signals as it can on the given Scheduler's Worker thread, which may result in a longer than expected occupation of this thread. In other terms, it does not allow per-signal fairness in case the worker runs on a shared underlying thread. If such fairness and signal/work interleaving is preferred, use the delay operator with zero time instead.

      Backpressure:
      This operator honors backpressure from downstream and expects it from the current Flowable. 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(long, TimeUnit), timer(long, TimeUnit), PublishProcessor or BehaviorProcessor and apply any of the onBackpressureXXX operators before applying observeOn itself. Note also that request amounts are not preserved between the immediate downstream and the immediate upstream. The operator always requests the specified bufferSize amount first, then after every 75% of that amount delivered, another 75% of this specified value. If preserving the request amounts is to be preferred over potential excess scheduler infrastructure use, consider applying delay(long, TimeUnit, Scheduler, boolean) with zero time instead.
      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 new Flowable instance
      Throws:
      NullPointerException - if scheduler is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • ofType

      Filters the items emitted by the current Flowable, only emitting those of the specified type.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      ofType does not operate by default on a particular Scheduler.
      Type Parameters:
      U - the output type
      Parameters:
      clazz - the class type to filter the items emitted by the current Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if clazz is null
      See Also:
    • onBackpressureBuffer

      Buffers an unlimited number of items from the current Flowable and allows it to emit as fast it can while allowing the downstream to consume the items at its own place.

      An error from the current Flowable will cut ahead of any unconsumed item. Use onBackpressureBuffer(boolean) to have the operator keep the original signal order.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable in an unbounded manner (i.e., not applying backpressure to it).
      Scheduler:
      onBackpressureBuffer does not operate by default on a particular Scheduler.
      Returns:
      the new Flowable instance
      See Also:
    • onBackpressureBuffer

      @CheckReturnValue @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") @NonNull public final @NonNull Flowable<T> onBackpressureBuffer(boolean delayError)
      Buffers an unlimited number of items from the current Flowable and allows it to emit as fast it can while allowing the downstream to consume the items at its own place, optionally delaying an error until all buffered items have been consumed.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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 signaled to the downstream, skipping any buffered element
      Returns:
      the new Flowable instance
      See Also:
    • onBackpressureBuffer

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("none") @NonNull public final @NonNull Flowable<T> onBackpressureBuffer(int capacity)
      Buffers an limited number of items from the current Flowable and allows it to emit as fast it can while allowing the downstream to consume the items at its own place, however, the resulting Flowable will signal a MissingBackpressureException via onError as soon as the buffer's capacity is exceeded, dropping all undelivered items, and canceling the flow.

      An error from the current Flowable will cut ahead of any unconsumed item. Use onBackpressureBuffer(int, boolean) to have the operator keep the original signal order.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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 new Flowable instance
      Throws:
      IllegalArgumentException - if capacity is non-positive
      Since:
      1.1.0
      See Also:
    • onBackpressureBuffer

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("none") @NonNull public final @NonNull Flowable<T> onBackpressureBuffer(int capacity, boolean delayError)
      Buffers an limited number of items from the current Flowable and allows it to emit as fast it can while allowing the downstream to consume the items at its own place, however, the resulting Flowable will signal a MissingBackpressureException via onError as soon as the buffer's capacity is exceeded, dropping all undelivered items, and canceling the flow.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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 signaled to the downstream, skipping any buffered element
      Returns:
      the new Flowable instance
      Throws:
      IllegalArgumentException - if capacity is non-positive
      Since:
      1.1.0
      See Also:
    • onBackpressureBuffer

      @CheckReturnValue @BackpressureSupport(SPECIAL) @SchedulerSupport("none") @NonNull public final @NonNull Flowable<T> onBackpressureBuffer(int capacity, boolean delayError, boolean unbounded)
      Buffers an optionally unlimited number of items from the current Flowable and allows it to emit as fast it can while allowing the downstream to consume the items at its own place. If unbounded is true, the resulting Flowable will signal a MissingBackpressureException via onError as soon as the buffer's capacity is exceeded, dropping all undelivered items, and canceling the flow.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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 signaled 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 new Flowable instance
      Throws:
      IllegalArgumentException - if capacity is non-positive
      Since:
      1.1.0
      See Also:
    • onBackpressureBuffer

      @CheckReturnValue @NonNull @BackpressureSupport(SPECIAL) @SchedulerSupport("none") public final @NonNull Flowable<T> onBackpressureBuffer(int capacity, boolean delayError, boolean unbounded, @NonNull @NonNull Action onOverflow)
      Buffers an optionally unlimited number of items from the current Flowable and allows it to emit as fast it can while allowing the downstream to consume the items at its own place. If unbounded is true, the resulting Flowable will signal a MissingBackpressureException via onError as soon as the buffer's capacity is exceeded, dropping all undelivered items, canceling the flow and calling the onOverflow action.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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 signaled 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.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onOverflow is null
      IllegalArgumentException - if capacity is non-positive
      Since:
      1.1.0
      See Also:
    • onBackpressureBuffer

      @CheckReturnValue @NonNull @BackpressureSupport(SPECIAL) @SchedulerSupport("none") public final @NonNull Flowable<T> onBackpressureBuffer(int capacity, boolean delayError, boolean unbounded, @NonNull @NonNull Action onOverflow, @NonNull @NonNull Consumer<? super @NonNull T> onDropped)
      Buffers an optionally unlimited number of items from the current Flowable and allows it to emit as fast it can while allowing the downstream to consume the items at its own place. If unbounded is true, the resulting Flowable will signal a MissingBackpressureException via onError as soon as the buffer's capacity is exceeded, dropping all undelivered items, canceling the flow and calling the onOverflow action.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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 signaled 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.
      onDropped - the Consumer to be called with the item that could not be buffered due to capacity constraints.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onOverflow or onDropped is null
      IllegalArgumentException - if capacity is non-positive
      Since:
      3.1.7
      See Also:
    • onBackpressureBuffer

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("none") @NonNull public final @NonNull Flowable<T> onBackpressureBuffer(int capacity, @NonNull @NonNull Action onOverflow)
      Buffers an limited number of items from the current Flowable and allows it to emit as fast it can while allowing the downstream to consume the items at its own place, however, the resulting Flowable will signal a MissingBackpressureException via onError as soon as the buffer's capacity is exceeded, dropping all undelivered items, canceling the flow and calling the onOverflow action.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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 new Flowable instance
      Throws:
      NullPointerException - if onOverflow is null
      IllegalArgumentException - if capacity is non-positive
      Since:
      1.1.0
      See Also:
    • onBackpressureBuffer

      @CheckReturnValue @NonNull @BackpressureSupport(SPECIAL) @SchedulerSupport("none") public final @NonNull Flowable<T> onBackpressureBuffer(long capacity, @Nullable @Nullable Action onOverflow, @NonNull @NonNull BackpressureOverflowStrategy overflowStrategy)
      Buffers an optionally unlimited number of items from the current Flowable and allows it to emit as fast it can while allowing the downstream to consume the items at its own place. The resulting Flowable will behave as determined by overflowStrategy if the buffer capacity is exceeded:
      • BackpressureOverflowStrategy.ERROR (default) will call onError dropping all undelivered items, canceling the source, and notifying the producer with onOverflow.
      • BackpressureOverflowStrategy.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.
      • BackpressureOverflowStrategy.DROP_OLDEST will drop the oldest items in the buffer in order to make room for newly emitted ones. Overflow will not generate an onError, but each drop will invoke onOverflow to signal the overflow to the producer.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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 resulting Flowable react to buffer overflows, null is not allowed.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onOverflow or overflowStrategy is null
      IllegalArgumentException - if capacity is non-positive
      Since:
      2.0
      See Also:
    • onBackpressureBuffer

      @CheckReturnValue @NonNull @BackpressureSupport(SPECIAL) @SchedulerSupport("none") public final @NonNull Flowable<T> onBackpressureBuffer(long capacity, @Nullable @Nullable Action onOverflow, @NonNull @NonNull BackpressureOverflowStrategy overflowStrategy, @NonNull @NonNull Consumer<? super @NonNull T> onDropped)
      Buffers an optionally unlimited number of items from the current Flowable and allows it to emit as fast it can while allowing the downstream to consume the items at its own place. The resulting Flowable will behave as determined by overflowStrategy if the buffer capacity is exceeded:
      • BackpressureOverflowStrategy.ERROR (default) will call onError dropping all undelivered items, canceling the source, and notifying the producer with onOverflow.
      • BackpressureOverflowStrategy.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.
      • BackpressureOverflowStrategy.DROP_OLDEST will drop the oldest items in the buffer in order to make room for newly emitted ones. Overflow will not generate an onError, but each drop will invoke onOverflow to signal the overflow to the producer.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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 resulting Flowable react to buffer overflows, null is not allowed.
      onDropped - the Consumer to be called with the item that could not be buffered due to capacity constraints.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onOverflow, overflowStrategy or onDropped is null
      IllegalArgumentException - if capacity is non-positive
      Since:
      3.1.7
      See Also:
    • onBackpressureDrop

      Drops items from the current Flowable if the downstream is not ready to receive new items (indicated by a lack of Subscription.request(long) calls from it).

      If the downstream request count hits 0 then the resulting Flowable 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 current Flowable in an unbounded manner (i.e., not applying backpressure to it).
      Scheduler:
      onBackpressureDrop does not operate by default on a particular Scheduler.
      Returns:
      the new Flowable instance
      See Also:
    • onBackpressureDrop

      Drops items from the current Flowable if the downstream is not ready to receive new items (indicated by a lack of Subscription.request(long) calls from it) and calls the given Consumer with such dropped items.

      If the downstream request count hits 0 then the resulting Flowable 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 current Flowable 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, should be fast and should never block.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onDrop is null
      Since:
      1.1.0
      See Also:
    • onBackpressureLatest

      Drops all but the latest item emitted by the current Flowable if the downstream is not ready to receive new items (indicated by a lack of Subscription.request(long) calls from it) and emits this latest item when the downstream becomes ready.

      Its behavior is logically equivalent to blockingLatest() with the exception that the downstream is not blocking while requesting more values.

      Note that if the current Flowable 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 current Flowable in an unbounded manner (i.e., not applying backpressure to it).
      Scheduler:
      onBackpressureLatest does not operate by default on a particular Scheduler.
      Returns:
      the new Flowable instance
      Since:
      1.1.0
    • onBackpressureLatest

      Drops all but the latest item emitted by the current Flowable if the downstream is not ready to receive new items (indicated by a lack of Subscription.request(long) calls from it) and emits this latest item when the downstream becomes ready.

      Its behavior is logically equivalent to blockingLatest() with the exception that the downstream is not blocking while requesting more values.

      Note that if the current Flowable 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 current Flowable in an unbounded manner (i.e., not applying backpressure to it).
      Scheduler:
      onBackpressureLatest does not operate by default on a particular Scheduler.
      Parameters:
      onDropped - called with the current entry when it has been replaced by a new one
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if onDropped is null
      Since:
      3.1.7
    • onBackpressureReduce

      Reduces a sequence of two not emitted values via a function into a single value if the downstream is not ready to receive new items (indicated by a lack of Subscription.request(long) calls from it) and emits this latest item when the downstream becomes ready.

      Note that if the current Flowable 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 current Flowable in an unbounded manner (i.e., not applying backpressure to it).
      Scheduler:
      onBackpressureReduce does not operate by default on a particular Scheduler.

      History: 3.0.9 - experimental

      Parameters:
      reducer - the bi-function to call when there is more than one non-emitted value to downstream, the first argument of the bi-function is previous item and the second one is currently emitting from upstream
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if reducer is null
      Since:
      3.1.0
      See Also:
    • onBackpressureReduce

      Reduces upstream values into an aggregate value, provided by a supplier and combined via a reducer function, while the downstream is not ready to receive items, then emits this aggregate value when the downstream becomes ready.

      Note that even if the downstream is ready to receive an item, the upstream item will always be aggregated into the output type, calling both the supplier and the reducer to produce the output value.

      Note that if the current Flowable 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 current Flowable in an unbounded manner (i.e., not applying backpressure to it).
      Scheduler:
      onBackpressureReduce does not operate by default on a particular Scheduler.

      History: 3.0.9 - experimental

      Type Parameters:
      R - the aggregate type emitted when the downstream requests more items
      Parameters:
      supplier - the factory to call to create new item of type R to pass it as the first argument to reducer. It is called when previous returned value by reducer already sent to downstream or the very first update from upstream received.
      reducer - the bi-function to call to reduce excessive updates which downstream is not ready to receive. The first argument of type R is the object returned by supplier or result of previous reducer invocation. The second argument of type T is the current update from upstream.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if supplier or reducer is null
      Since:
      3.1.0
      See Also:
    • onErrorComplete

      Returns a Flowable instance that if the current Flowable emits an error, it will emit an onComplete and swallow the throwable.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      onErrorComplete does not operate by default on a particular Scheduler.
      Returns:
      the new Flowable instance
      Since:
      3.0.0
    • onErrorComplete

      Returns a Flowable instance that if the current Flowable emits an error and the predicate returns true, it will emit an onComplete and swallow the throwable.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      onErrorComplete does not operate by default on a particular Scheduler.
      Parameters:
      predicate - the predicate to call when an Throwable is emitted which should return true if the Throwable should be swallowed and replaced with an onComplete.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if predicate is null
      Since:
      3.0.0
    • onErrorResumeNext

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final @NonNull Flowable<T> onErrorResumeNext(@NonNull @NonNull Function<? super Throwable,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull T>> fallbackSupplier)
      Resumes the flow with a Publisher returned for the failure Throwable of the current Flowable by a function instead of signaling the error via onError.

      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 current Flowable completes or a MissingBackpressureException is signaled somewhere downstream.
      Scheduler:
      onErrorResumeNext does not operate by default on a particular Scheduler.
      Parameters:
      fallbackSupplier - a function that returns a Publisher that will take over if the current Flowable encounters an error
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if fallbackSupplier is null
      See Also:
    • onErrorResumeWith

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final @NonNull Flowable<T> onErrorResumeWith(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> fallback)
      Resumes the flow with the given Publisher when the current Flowable fails instead of signaling the error via onError.

      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 onErrorResumeWith method changes this behavior. If you pass another Publisher (resumeSequence) to a Publisher's onErrorResumeWith 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 current Flowable completes or MissingBackpressureException is signaled somewhere downstream.
      Scheduler:
      onErrorResumeWith does not operate by default on a particular Scheduler.
      Parameters:
      fallback - the next Publisher source that will take over if the current Flowable encounters an error
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if fallback is null
      See Also:
    • onErrorReturn

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final @NonNull Flowable<T> onErrorReturn(@NonNull @NonNull Function<? super Throwable,? extends @NonNull T> itemSupplier)
      Ends the flow with a last item returned by a function for the Throwable error signaled by the current Flowable instead of signaling the error via onError.

      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 current Flowable is expected to honor backpressure as well. If it this expectation is violated, the operator may throw IllegalStateException when the current Flowable completes or MissingBackpressureException is signaled somewhere downstream.
      Scheduler:
      onErrorReturn does not operate by default on a particular Scheduler.
      Parameters:
      itemSupplier - 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 new Flowable instance
      Throws:
      NullPointerException - if itemSupplier is null
      See Also:
    • onErrorReturnItem

      Ends the flow with the given last item when the current Flowable fails instead of signaling the error via onError.

      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 current Flowable is expected to honor backpressure as well. If it this expectation is violated, the operator may throw IllegalStateException when the current Flowable completes or MissingBackpressureException is signaled 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 new Flowable instance
      Throws:
      NullPointerException - if item is null
      See Also:
    • 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 current Flowable's backpressure behavior.
      Scheduler:
      onTerminateDetach does not operate by default on a particular Scheduler.
      Returns:
      the new Flowable instance the sequence is terminated or downstream cancels
      Since:
      2.0
    • 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 ParallelFlowable.runOn(Scheduler) to specify the Scheduler where each rail will execute.

      To merge the parallel 'rails' back into a single sequence, use ParallelFlowable.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; 2.1 - beta

      Returns:
      the new ParallelFlowable instance
      Since:
      2.2
    • parallel

      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 ParallelFlowable.runOn(Scheduler) to specify the Scheduler where each rail will execute.

      To merge the parallel 'rails' back into a single sequence, use ParallelFlowable.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; 2.1 - beta

      Parameters:
      parallelism - the number of 'rails' to use
      Returns:
      the new ParallelFlowable instance
      Throws:
      IllegalArgumentException - if parallelism is non-positive
      Since:
      2.2
    • parallel

      @BackpressureSupport(FULL) @SchedulerSupport("none") @CheckReturnValue @NonNull public final @NonNull 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 ParallelFlowable.runOn(Scheduler) to specify the Scheduler where each rail will execute.

      To merge the parallel 'rails' back into a single sequence, use ParallelFlowable.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; 2.1 - beta

      Parameters:
      parallelism - the number of 'rails' to use
      prefetch - the number of items each 'rail' should prefetch
      Returns:
      the new ParallelFlowable instance
      Throws:
      IllegalArgumentException - if parallelism or prefetch is non-positive
      Since:
      2.2
    • 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 current Flowable 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:
      the new ConnectableFlowable instance
      See Also:
    • publish

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> publish(@NonNull @NonNull Function<? super Flowable<@NonNull T>,@NonNull ? extends org.reactivestreams.Publisher<@NonNull 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 current Flowable to honor backpressure and if this expectation is violated, the operator will signal a MissingBackpressureException through the Flowable provided to the function. Since the Publisher returned by the selector may be independent of the provided Flowable 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.
      Type Parameters:
      R - the type of items emitted by the resulting Flowable
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if selector is null
      See Also:
    • publish

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> publish(@NonNull @NonNull Function<? super Flowable<@NonNull T>,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull 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 current Flowable to honor backpressure and if this expectation is violated, the operator will signal a MissingBackpressureException through the Flowable provided to the function. Since the Publisher returned by the selector may be independent of the provided Flowable 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.
      Type Parameters:
      R - the type of items emitted by the resulting Flowable
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if selector is null
      IllegalArgumentException - if prefetch is non-positive
      See Also:
    • 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 current Flowable 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:
      the new ConnectableFlowable instance
      Throws:
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • rebatchRequests

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final @NonNull 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 new Flowable instance
      Throws:
      IllegalArgumentException - if n is non-positive
      Since:
      2.0
    • reduce

      Returns a Maybe that applies a specified accumulator function to the first item emitted by the current Flowable, then feeds the result of that function along with the second item emitted by the current Flowable into the same function, and so on until all items have been emitted by the current and finite Flowable, and emits 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 this operator requires the upstream to signal onComplete for the accumulator object 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 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 current Flowable, whose result will be used in the next accumulator call
      Returns:
      the new Maybe instance
      Throws:
      NullPointerException - if reducer is null
      See Also:
    • reduce

      Returns a Single that applies a specified accumulator function to the first item emitted by the current Flowable and a specified seed value, then feeds the result of that function along with the second item emitted by the current Flowable into the same function, and so on until all items have been emitted by the current and finite Flowable, 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 Flowable 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(Supplier):

      
       Flowable<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)));
       

      Note that this operator requires the upstream to signal onComplete for the accumulator object 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 of its downstream consumer and consumes the upstream source in unbounded mode.
      Scheduler:
      reduce does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the accumulator and output value type
      Parameters:
      seed - the initial (seed) accumulator value
      reducer - an accumulator function to be invoked on each item emitted by the current Flowable, the result of which will be used in the next accumulator call
      Returns:
      the new Single instance
      Throws:
      NullPointerException - if seed or reducer is null
      See Also:
    • reduceWith

      Returns a Single that applies a specified accumulator function to the first item emitted by the current Flowable and a seed value derived from calling a specified seedSupplier, then feeds the result of that function along with the second item emitted by the current Flowable into the same function, and so on until all items have been emitted by the current and finite Flowable, 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 this operator requires the upstream to signal onComplete for the accumulator object 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 of its downstream consumer and consumes the upstream source in unbounded mode.
      Scheduler:
      reduceWith does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the accumulator and output value type
      Parameters:
      seedSupplier - the Supplier that provides the initial (seed) accumulator value for each individual Subscriber
      reducer - an accumulator function to be invoked on each item emitted by the current Flowable, the result of which will be used in the next accumulator call
      Returns:
      the new Single instance
      Throws:
      NullPointerException - if seedSupplier or reducer is null
      See Also:
    • repeat

      Returns a Flowable that repeats the sequence of items emitted by the current Flowable indefinitely.

      Backpressure:
      The operator honors downstream backpressure and expects the current Flowable 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:
      the new Flowable instance
      See Also:
    • repeat

      Returns a Flowable that repeats the sequence of items emitted by the current Flowable at most count times.

      Backpressure:
      The operator honors downstream backpressure and expects the current Flowable 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 current Flowable items are repeated, a count of 0 will yield an empty sequence
      Returns:
      the new Flowable instance
      Throws:
      IllegalArgumentException - if times is less than zero
      See Also:
    • repeatUntil

      Returns a Flowable that repeats the sequence of items emitted by the current Flowable until the provided stop function returns true.

      Backpressure:
      The operator honors downstream backpressure and expects the current Flowable 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
      See Also:
    • repeatWhen

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final @NonNull Flowable<T> repeatWhen(@NonNull @NonNull Function<? super Flowable<Object>,@NonNull ? extends org.reactivestreams.Publisher<@NonNull ?>> handler)
      Returns a Flowable that emits the same values as the current Flowable with the exception of an onComplete. An onComplete notification from the source will result in the emission of a void item to the Flowable 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 current Flowable.

      Backpressure:
      The operator honors downstream backpressure and expects the current Flowable 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 new Flowable instance
      Throws:
      NullPointerException - if handler is null
      See Also:
    • 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 Flowable resembles an ordinary Flowable, 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 current Flowable sequence.
      Scheduler:
      This version of replay does not operate by default on a particular Scheduler.
      Returns:
      the new ConnectableFlowable instance
      See Also:
    • replay

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> replay(@NonNull @NonNull Function<? super Flowable<@NonNull T>,@NonNull ? extends org.reactivestreams.Publisher<@NonNull 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 current Flowable.

      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 current Flowable sequence.
      Scheduler:
      This version of replay does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the type of items emitted by the resulting Flowable
      Parameters:
      selector - the selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the current Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if selector is null
      See Also:
    • replay

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> replay(@NonNull @NonNull Function<? super Flowable<@NonNull T>,@NonNull ? extends org.reactivestreams.Publisher<@NonNull 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 current Flowable, replaying bufferSize notifications.

      Note that due to concurrency requirements, replay(bufferSize) may hold strong references to more than bufferSize source emissions.

      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 current Flowable sequence.
      Scheduler:
      This version of replay does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the type of items emitted by the resulting Flowable
      Parameters:
      selector - the selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the current Flowable
      bufferSize - the buffer size that limits the number of items the operator can replay
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if selector is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • replay

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> replay(@NonNull @NonNull Function<? super Flowable<@NonNull T>,@NonNull ? extends org.reactivestreams.Publisher<@NonNull R>> selector, int bufferSize, boolean eagerTruncate)
      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 current Flowable, replaying bufferSize notifications.

      Note that due to concurrency requirements, replay(bufferSize) may hold strong references to more than bufferSize source emissions.

      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 current Flowable sequence.
      Scheduler:
      This version of replay does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the type of items emitted by the resulting Flowable
      Parameters:
      selector - the selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the current Flowable
      bufferSize - the buffer size that limits the number of items the operator can replay
      eagerTruncate - if true, whenever the internal buffer is truncated to the given bufferSize, the oldest item will be guaranteed dereferenced, thus avoiding unexpected retention
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if selector is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • replay

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("io.reactivex:computation") @NonNull public final <@NonNull R> @NonNull Flowable<R> replay(@NonNull @NonNull Function<? super Flowable<@NonNull T>,@NonNull ? extends org.reactivestreams.Publisher<@NonNull R>> selector, int bufferSize, long time, @NonNull @NonNull 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 current Flowable, replaying no more than bufferSize items that were emitted within a specified time window.

      Note that due to concurrency requirements, replay(bufferSize) may hold strong references to more than bufferSize source emissions.

      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 current Flowable sequence.
      Scheduler:
      This version of replay operates by default on the computation Scheduler.
      Type Parameters:
      R - the type of items emitted by the resulting Flowable
      Parameters:
      selector - a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the current Flowable
      bufferSize - the buffer size that limits the number of items the operator can replay
      time - the duration of the window in which the replayed items must have been emitted
      unit - the time unit of time
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if selector or unit is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • replay

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("custom") public final <@NonNull R> @NonNull Flowable<R> replay(@NonNull @NonNull Function<? super Flowable<@NonNull T>,@NonNull ? extends org.reactivestreams.Publisher<@NonNull R>> selector, int bufferSize, long time, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull 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 current Flowable, replaying no more than bufferSize items that were emitted within a specified time window.

      Note that due to concurrency requirements, replay(bufferSize) may hold strong references to more than bufferSize source emissions.

      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 current Flowable sequence.
      Scheduler:
      You specify which Scheduler this operator will use.
      Type Parameters:
      R - the type of items emitted by the resulting Flowable
      Parameters:
      selector - a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the current Flowable
      bufferSize - the buffer size that limits the number of items the operator 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:
      the new Flowable instance
      Throws:
      NullPointerException - if selector, unit or scheduler is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • replay

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("custom") public final <@NonNull R> @NonNull Flowable<R> replay(@NonNull @NonNull Function<? super Flowable<@NonNull T>,@NonNull ? extends org.reactivestreams.Publisher<@NonNull R>> selector, int bufferSize, long time, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, boolean eagerTruncate)
      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 current Flowable, replaying no more than bufferSize items that were emitted within a specified time window.

      Note that due to concurrency requirements, replay(bufferSize) may hold strong references to more than bufferSize source emissions.

      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 current Flowable sequence.
      Scheduler:
      You specify which Scheduler this operator will use.
      Type Parameters:
      R - the type of items emitted by the resulting Flowable
      Parameters:
      selector - a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the current Flowable
      bufferSize - the buffer size that limits the number of items the operator 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
      eagerTruncate - if true, whenever the internal buffer is truncated to the given bufferSize/age, the oldest item will be guaranteed dereferenced, thus avoiding unexpected retention
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if selector, unit or scheduler is null
      IllegalArgumentException - if bufferSize is less than zero
      See Also:
    • replay

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("io.reactivex:computation") @NonNull public final <@NonNull R> @NonNull Flowable<R> replay(@NonNull @NonNull Function<? super Flowable<@NonNull T>,@NonNull ? extends org.reactivestreams.Publisher<@NonNull R>> selector, long time, @NonNull @NonNull 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 current Flowable, 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 current Flowable sequence.
      Scheduler:
      This version of replay operates by default on the computation Scheduler.
      Type Parameters:
      R - the type of items emitted by the resulting Flowable
      Parameters:
      selector - a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the current Flowable
      time - the duration of the window in which the replayed items must have been emitted
      unit - the time unit of time
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if selector or unit is null
      See Also:
    • replay

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("custom") public final <@NonNull R> @NonNull Flowable<R> replay(@NonNull @NonNull Function<? super Flowable<@NonNull T>,@NonNull ? extends org.reactivestreams.Publisher<@NonNull R>> selector, long time, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull 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 current Flowable, 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 current Flowable sequence.
      Scheduler:
      You specify which Scheduler this operator will use.
      Type Parameters:
      R - the type of items emitted by the resulting Flowable
      Parameters:
      selector - a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the current Flowable
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if selector, unit or scheduler is null
      See Also:
    • replay

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("custom") public final <@NonNull R> @NonNull Flowable<R> replay(@NonNull @NonNull Function<? super Flowable<@NonNull T>,@NonNull ? extends org.reactivestreams.Publisher<@NonNull R>> selector, long time, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, boolean eagerTruncate)
      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 current Flowable, 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 current Flowable sequence.
      Scheduler:
      You specify which Scheduler this operator will use.
      Type Parameters:
      R - the type of items emitted by the resulting Flowable
      Parameters:
      selector - a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the current Flowable
      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
      eagerTruncate - if true, whenever the internal buffer is truncated to the given age, the oldest item will be guaranteed dereferenced, thus avoiding unexpected retention
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if selector, unit or scheduler is null
      See Also:
    • replay

      Returns a ConnectableFlowable that shares a single subscription to the current Flowable and replays at most bufferSize items to late Subscribers. A Connectable Flowable resembles an ordinary Flowable, except that it does not begin emitting items when it is subscribed to, but only when its connect method is called.

      Note that due to concurrency requirements, replay(bufferSize) may hold strong references to more than bufferSize source emissions. To ensure no beyond-bufferSize items are referenced, use the replay(int, boolean) overload with eagerTruncate = true.

      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 current Flowable 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:
      the new ConnectableFlowable instance
      Throws:
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • replay

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final @NonNull ConnectableFlowable<T> replay(int bufferSize, boolean eagerTruncate)
      Returns a ConnectableFlowable that shares a single subscription to the current Flowable and replays at most bufferSize items to late Subscribers. A connectable Flowable resembles an ordinary Flowable, except that it does not begin emitting items when it is subscribed to, but only when its connect method is called.

      Note that due to concurrency requirements, replay(bufferSize) may hold strong references to more than bufferSize source emissions. To ensure no beyond-bufferSize items are referenced, set eagerTruncate = true.

      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 current Flowable 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
      eagerTruncate - if true, whenever the internal buffer is truncated to the given bufferSize, the oldest item will be guaranteed dereferenced, thus avoiding unexpected retention
      Returns:
      the new ConnectableFlowable instance
      Throws:
      IllegalArgumentException - if bufferSize is non-positive
      Since:
      3.0.0
      See Also:
    • replay

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull ConnectableFlowable<T> replay(int bufferSize, long time, @NonNull @NonNull TimeUnit unit)
      Returns a ConnectableFlowable that shares a single subscription to the current Flowable and replays at most bufferSize items that were emitted during a specified time window. A connectable Flowable resembles an ordinary Flowable, except that it does not begin emitting items when it is subscribed to, but only when its connect method is called.

      Note that due to concurrency requirements, replay(bufferSize) may hold strong references to more than bufferSize source emissions. To ensure no out-of-date or beyond-bufferSize items are referenced, use the replay(int, long, TimeUnit, Scheduler, boolean) overload with eagerTruncate = true.

      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 current Flowable 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:
      the new ConnectableFlowable instance
      Throws:
      NullPointerException - if unit is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • replay

      Returns a ConnectableFlowable that shares a single subscription to the current Flowable and replays a maximum of bufferSize items that are emitted within a specified time window to late Subscribers. A connectable Flowable resembles an ordinary Flowable, except that it does not begin emitting items when it is subscribed to, but only when its connect method is called.

      Note that due to concurrency requirements, replay(bufferSize) may hold strong references to more than bufferSize source emissions. To ensure no out-of-date or beyond-bufferSize items are referenced, use the replay(int, long, TimeUnit, Scheduler, boolean) overload with eagerTruncate = true.

      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 current Flowable 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:
      the new ConnectableFlowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • replay

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("custom") @NonNull public final @NonNull ConnectableFlowable<T> replay(int bufferSize, long time, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, boolean eagerTruncate)
      Returns a ConnectableFlowable that shares a single subscription to the current Flowable and replays a maximum of bufferSize items that are emitted within a specified time window to late Subscribers. A connectable Flowable resembles an ordinary Flowable, except that it does not begin emitting items when it is subscribed to, but only when its connect method is called.

      Note that due to concurrency requirements, replay(bufferSize) may hold strong references to more than bufferSize source emissions. To ensure no out-of-date or beyond-bufferSize items are referenced, set eagerTruncate = true.

      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 current Flowable 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
      eagerTruncate - if true, whenever the internal buffer is truncated to the given bufferSize/age, the oldest item will be guaranteed dereferenced, thus avoiding unexpected retention
      Returns:
      the new ConnectableFlowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      IllegalArgumentException - if bufferSize is non-positive
      Since:
      3.0.0
      See Also:
    • replay

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull ConnectableFlowable<T> replay(long time, @NonNull @NonNull TimeUnit unit)
      Returns a ConnectableFlowable that shares a single subscription to the current Flowable and replays all items emitted by it within a specified time window to late Subscribers. A connectable Flowable resembles an ordinary Flowable, except that it does not begin emitting items when it is subscribed to, but only when its connect method is called.

      Note that the internal buffer may retain strong references to the oldest item. To ensure no out-of-date items are referenced, use the replay(long, TimeUnit, Scheduler, boolean) overload with eagerTruncate = true.

      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 current Flowable 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:
      the new ConnectableFlowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • replay

      Returns a ConnectableFlowable that shares a single subscription to the current Flowable and replays all items emitted by it within a specified time window to late Subscribers. A connectable Flowable resembles an ordinary Flowable, except that it does not begin emitting items when it is subscribed to, but only when its connect method is called.

      Note that the internal buffer may retain strong references to the oldest item. To ensure no out-of-date items are referenced, use the replay(long, TimeUnit, Scheduler, boolean) overload with eagerTruncate = true.

      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 current Flowable 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:
      the new ConnectableFlowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • replay

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("custom") @NonNull public final @NonNull ConnectableFlowable<T> replay(long time, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, boolean eagerTruncate)
      Returns a ConnectableFlowable that shares a single subscription to the current Flowable and replays all items emitted by it within a specified time window to late Subscribers. A connectable Flowable resembles an ordinary Flowable, except that it does not begin emitting items when it is subscribed to, but only when its connect method is called.

      Note that the internal buffer may retain strong references to the oldest item. To ensure no out-of-date items are referenced, set eagerTruncate = true.

      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 current Flowable 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
      eagerTruncate - if true, whenever the internal buffer is truncated to the given bufferSize/age, the oldest item will be guaranteed dereferenced, thus avoiding unexpected retention
      Returns:
      the new ConnectableFlowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • retry

      Returns a Flowable that mirrors the current Flowable, resubscribing to it if it calls onError (infinite retry count).

      If the current Flowable calls Subscriber.onError(java.lang.Throwable), this method will resubscribe to the current Flowable rather than propagating the onError call.

      Any and all items emitted by the current Flowable will be emitted by the resulting Flowable, even those emitted during failed subscriptions. For example, if the current Flowable 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 current Flowable 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 new Flowable instance
      See Also:
    • retry

      Returns a Flowable that mirrors the current Flowable, 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 current Flowable 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 new Flowable instance
      Throws:
      NullPointerException - if predicate is null
      See Also:
    • retry

      Returns a Flowable that mirrors the current Flowable, resubscribing to it if it calls onError up to a specified number of retries.

      If the current Flowable calls Subscriber.onError(java.lang.Throwable), this method will resubscribe to the current Flowable for a maximum of count resubscriptions rather than propagating the onError call.

      Any and all items emitted by the current Flowable will be emitted by the resulting Flowable, even those emitted during failed subscriptions. For example, if the current Flowable 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 current Flowable 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 resubscribe if the current Flowable fails
      Returns:
      the new Flowable instance
      Throws:
      IllegalArgumentException - if times is negative
      See Also:
    • retry

      Retries at most times or until the predicate returns false, whichever happens first.
      Backpressure:
      The operator honors downstream backpressure and expects the current Flowable 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 resubscribe if the current Flowable fails
      predicate - the predicate called with the failure Throwable and should return true to trigger a retry.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if predicate is null
      IllegalArgumentException - if times is negative
    • retry

      Retries the current Flowable if the predicate returns true.
      Backpressure:
      The operator honors downstream backpressure and expects the current Flowable 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
      Throws:
      NullPointerException - if predicate is null
    • retryUntil

      Retries until the given stop function returns true.
      Backpressure:
      The operator honors downstream backpressure and expects the current Flowable 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
      Throws:
      NullPointerException - if stop is null
    • retryWhen

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final @NonNull Flowable<T> retryWhen(@NonNull @NonNull Function<? super Flowable<Throwable>,@NonNull ? extends org.reactivestreams.Publisher<@NonNull ?>> handler)
      Returns a Flowable that emits the same values as the current Flowable with the exception of an onError. An onError notification from the source will result in the emission of a Throwable item to the Flowable 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 current Flowable.

      Example: This retries 3 times, each time incrementing the number of seconds it waits.

      
        Flowable.create((FlowableEmitter<? super String> s) -> {
            System.out.println("subscribing");
            s.onError(new RuntimeException("always fails"));
        }, BackpressureStrategy.BUFFER).retryWhen(attempts -> {
            return attempts.zipWith(Flowable.range(1, 3), (n, i) -> i).flatMap(i -> {
                System.out.println("delay retry by " + i + " second(s)");
                return Flowable.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
        

      Note that the inner Publisher returned by the handler function should signal either onNext, onError or onComplete in response to the received Throwable to indicate the operator should retry or terminate. If the upstream to the operator is asynchronous, signaling onNext followed by onComplete immediately may result in the sequence to be completed immediately. Similarly, if this inner Publisher signals onError or onComplete while the upstream is active, the sequence is terminated with the same signal immediately.

      The following example demonstrates how to retry an asynchronous source with a delay:

      
       Flowable.timer(1, TimeUnit.SECONDS)
           .doOnSubscribe(s -> System.out.println("subscribing"))
           .map(v -> { throw new RuntimeException(); })
           .retryWhen(errors -> {
               AtomicInteger counter = new AtomicInteger();
               return errors
                         .takeWhile(e -> counter.getAndIncrement() != 3)
                         .flatMap(e -> {
                             System.out.println("delay retry by " + counter.get() + " second(s)");
                             return Flowable.timer(counter.get(), TimeUnit.SECONDS);
                         });
           })
           .blockingSubscribe(System.out::println, System.out::println);
       
      Backpressure:
      The operator honors downstream backpressure and expects both the source and inner Publishers 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 new Flowable instance
      Throws:
      NullPointerException - if handler is null
      See Also:
    • safeSubscribe

      @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") public final void safeSubscribe(@NonNull @NonNull org.reactivestreams.Subscriber<? super @NonNull T> subscriber)
      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:
      subscriber - the incoming Subscriber instance
      Throws:
      NullPointerException - if subscriber is null
    • sample

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<T> sample(long period, @NonNull @NonNull TimeUnit unit)
      Returns a Flowable that emits the most recently emitted item (if any) emitted by the current Flowable 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • sample

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<T> sample(long period, @NonNull @NonNull TimeUnit unit, boolean emitLast)
      Returns a Flowable that emits the most recently emitted item (if any) emitted by the current Flowable 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      Since:
      2.1
      See Also:
    • sample

      Returns a Flowable that emits the most recently emitted item (if any) emitted by the current Flowable 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • sample

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("custom") public final @NonNull Flowable<T> sample(long period, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, boolean emitLast)
      Returns a Flowable that emits the most recently emitted item (if any) emitted by the current Flowable 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      Since:
      2.1
      See Also:
    • sample

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("custom") public final @NonNull Flowable<T> sample(long period, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, boolean emitLast, @NonNull @NonNull Consumer<? super @NonNull T> onDropped)
      Returns a Flowable that emits the most recently emitted item (if any) emitted by the current Flowable 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.
      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.
      onDropped - called with the current entry when it has been replaced by a new one
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null or onDropped is null
      Since:
      3.1.6 - Experimental
      See Also:
    • sample

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("none") public final <@NonNull U> @NonNull Flowable<T> sample(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull 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 current Flowable 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.
      Type Parameters:
      U - the element type of the sampler Publisher
      Parameters:
      sampler - the Publisher to use for sampling the current Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if sampler is null
      See Also:
    • sample

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("none") public final <@NonNull U> @NonNull Flowable<T> sample(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull 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 current Flowable 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

      Type Parameters:
      U - the element type of the sampler Publisher
      Parameters:
      sampler - the Publisher to use for sampling the current Flowable
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if sampler is null
      Since:
      2.1
      See Also:
    • scan

      Returns a Flowable that emits the first value emitted by the current Flowable, then emits one value for each subsequent value emitted by the current Flowable. Each emission after the first is the result of applying the specified accumulator function to the previous emission and the corresponding value from the current Flowable.

      This sort of function is sometimes called an accumulator.

      Backpressure:
      The operator honors downstream backpressure and expects the current Flowable to honor backpressure as well. Violating this expectation, a MissingBackpressureException may get signaled 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 current Flowable, whose result will be emitted to Subscribers via onNext and used in the next accumulator call
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if accumulator is null
      See Also:
    • scan

      Returns a Flowable that emits the provided initial (seed) value, then emits one value for each value emitted by the current Flowable. Each emission after the first is the result of applying the specified accumulator function to the previous emission and the corresponding value from the current Flowable.

      This sort of function is sometimes called an accumulator.

      Note that the Flowable 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 Flowable 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(Supplier):

      
       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 current Flowable to honor backpressure as well. Violating this expectation, a MissingBackpressureException may get signaled somewhere downstream. The downstream request pattern is not preserved across this operator. The upstream is requested bufferSize() - 1 upfront and 75% of bufferSize() thereafter.
      Scheduler:
      scan does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the initial, accumulator and result type
      Parameters:
      initialValue - the initial (seed) accumulator item
      accumulator - an accumulator function to be invoked on each item emitted by the current Flowable, whose result will be emitted to Subscribers via onNext and used in the next accumulator call
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if initialValue or accumulator is null
      See Also:
    • scanWith

      Returns a Flowable that emits the provided initial (seed) value, then emits one value for each value emitted by the current Flowable. Each emission after the first is the result of applying the specified accumulator function to the previous emission and the corresponding value from the current Flowable.

      This sort of function is sometimes called an accumulator.

      Note that the Flowable 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 current Flowable to honor backpressure as well. Violating this expectation, a MissingBackpressureException may get signaled somewhere downstream. The downstream request pattern is not preserved across this operator. The upstream is requested bufferSize() - 1 upfront and 75% of bufferSize() thereafter.
      Scheduler:
      scanWith does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the initial, accumulator and result type
      Parameters:
      seedSupplier - a Supplier that returns the initial (seed) accumulator item for each individual Subscriber
      accumulator - an accumulator function to be invoked on each item emitted by the current Flowable, whose result will be emitted to Subscribers via onNext and used in the next accumulator call
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if seedSupplier or accumulator is null
      See Also:
    • serialize

      Forces the current Flowable'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 current Flowable's backpressure behavior.
      Scheduler:
      serialize does not operate by default on a particular Scheduler.
      Returns:
      the new Flowable instance
      See Also:
    • share

      Returns a new Flowable that multicasts (and shares a single subscription to) the current Flowable. As long as there is at least one Subscriber, the current Flowable will be subscribed and emitting data. When all subscribers have canceled it will cancel the current Flowable.

      This is an alias for publish().refCount().

      Backpressure:
      The operator honors backpressure and expects the current Flowable 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:
      the new Flowable instance
      See Also:
    • 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 current Flowable in an unbounded manner (i.e., without applying backpressure).
      Scheduler:
      singleElement does not operate by default on a particular Scheduler.
      Returns:
      the new Maybe instance
      See Also:
    • single

      Returns a Single that emits the single item emitted by the current Flowable if it emits only a single item, or a default item if the current Flowable emits no items. If the current Flowable emits more than one item, an IllegalArgumentException is signaled instead.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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 current Flowable emits no item
      Returns:
      the new Single instance
      Throws:
      NullPointerException - if defaultItem is null
      See Also:
    • 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 signaled and if this Flowable emits more than one item, an IllegalArgumentException will be signaled.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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
      See Also:
    • skip

      Returns a Flowable that skips the first count items emitted by the current Flowable and emits the remainder.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable'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:
      the new Flowable instance
      Throws:
      IllegalArgumentException - if count is negative
      See Also:
    • skip

      Returns a Flowable that skips values emitted by the current Flowable before a specified time window elapses.

      Backpressure:
      The operator doesn't support backpressure as it uses time to skip an arbitrary number of elements and thus has to consume the current Flowable 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • skip

      Returns a Flowable that skips values emitted by the current Flowable before a specified time window on a specified Scheduler elapses.

      Backpressure:
      The operator doesn't support backpressure as it uses time to skip an arbitrary number of elements and thus has to consume the current Flowable 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • skipLast

      Returns a Flowable that drops a specified number of items from the end of the sequence emitted by the current Flowable.

      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 resulting Flowable. This causes such items to be delayed.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable'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:
      the new Flowable instance
      Throws:
      IllegalArgumentException - if count is less than zero
      See Also:
    • skipLast

      Returns a Flowable that drops items emitted by the current Flowable 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 an arbitrary number of elements and thus has to consume the current Flowable 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • skipLast

      @CheckReturnValue @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") @NonNull public final @NonNull Flowable<T> skipLast(long time, @NonNull @NonNull TimeUnit unit, boolean delayError)
      Returns a Flowable that drops items emitted by the current Flowable 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 an arbitrary number of elements and thus has to consume the current Flowable 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 signaled by the current Flowable is delayed until the regular elements are consumed by the downstream; if false, an exception is immediately signaled and all regular elements dropped
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • skipLast

      Returns a Flowable that drops items emitted by the current Flowable 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 an arbitrary number of elements and thus has to consume the current Flowable 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • skipLast

      @CheckReturnValue @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("custom") @NonNull public final @NonNull Flowable<T> skipLast(long time, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, boolean delayError)
      Returns a Flowable that drops items emitted by the current Flowable 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 an arbitrary number of elements and thus has to consume the current Flowable 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 signaled by the current Flowable is delayed until the regular elements are consumed by the downstream; if false, an exception is immediately signaled and all regular elements dropped
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • skipLast

      @CheckReturnValue @NonNull @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("custom") public final @NonNull Flowable<T> skipLast(long time, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, boolean delayError, int bufferSize)
      Returns a Flowable that drops items emitted by the current Flowable 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 an arbitrary number of elements and thus has to consume the current Flowable 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 signaled by the current Flowable is delayed until the regular elements are consumed by the downstream; if false, an exception is immediately signaled and all regular elements dropped
      bufferSize - the hint about how many elements to expect to be skipped
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • skipUntil

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull U> @NonNull Flowable<T> skipUntil(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull U> other)
      Returns a Flowable that skips items emitted by the current Flowable until a second Publisher emits an item.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      skipUntil does not operate by default on a particular Scheduler.
      Type Parameters:
      U - the element type of the other Publisher
      Parameters:
      other - the second Publisher that has to emit an item before the current Flowable's elements begin to be mirrored by the resulting Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other is null
      See Also:
    • skipWhile

      Returns a Flowable that skips all items emitted by the current Flowable 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 current Flowable'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 current Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if predicate is null
      See Also:
    • 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 current Flowable in an unbounded manner (i.e., without applying backpressure to it).
      Scheduler:
      sorted does not operate by default on a particular Scheduler.
      Returns:
      the new Flowable instance
    • sorted

      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 current Flowable in an unbounded manner (i.e., without applying backpressure to it).
      Scheduler:
      sorted does not operate by default on a particular Scheduler.
      Parameters:
      comparator - a function that compares two items emitted by the current Flowable and returns an Integer that indicates their sort order
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if comparator is null
    • startWithIterable

      Returns a Flowable that emits the items in a specified Iterable before it begins to emit items emitted by the current Flowable.

      Backpressure:
      The operator honors backpressure from downstream. The Current Flowable is expected to honor backpressure as well. If it violates this rule, it may throw an IllegalStateException when the current Flowable completes.
      Scheduler:
      startWithIterable does not operate by default on a particular Scheduler.
      Parameters:
      items - an Iterable that contains the items you want the resulting Flowable to emit first
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if items is null
      Since:
      3.0.0
      See Also:
    • startWith

      Returns a Flowable which first runs the other CompletableSource then the current Flowable if the other completed normally.

      Backpressure:
      The returned Flowable honors the backpressure of the downstream consumer.
      Scheduler:
      startWith does not operate by default on a particular Scheduler.
      Parameters:
      other - the other CompletableSource to run first
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other is null
      Since:
      3.0.0
    • startWith

      Returns a Flowable which first runs the other SingleSource then the current Flowable if the other succeeded normally.

      Backpressure:
      The returned Flowable honors the backpressure of the downstream consumer.
      Scheduler:
      startWith does not operate by default on a particular Scheduler.
      Parameters:
      other - the other SingleSource to run first
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other is null
      Since:
      3.0.0
    • startWith

      Returns a Flowable which first runs the other MaybeSource then the current Flowable if the other succeeded or completed normally.

      Backpressure:
      The returned Flowable honors the backpressure of the downstream consumer.
      Scheduler:
      startWith does not operate by default on a particular Scheduler.
      Parameters:
      other - the other MaybeSource to run first
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other is null
      Since:
      3.0.0
    • startWith

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final @NonNull Flowable<T> startWith(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> other)
      Returns a Flowable that emits the items in a specified Publisher before it begins to emit items emitted by the current Flowable.

      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 current Flowable 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:
      the new Flowable instance
      Throws:
      NullPointerException - if other is null
      See Also:
    • startWithItem

      Returns a Flowable that emits a specified item before it begins to emit items emitted by the current Flowable.

      Backpressure:
      The operator honors backpressure from downstream. The current Flowable is expected to honor backpressure as well. If it violates this rule, it may throw an IllegalStateException when the current Flowable completes.
      Scheduler:
      startWithItem does not operate by default on a particular Scheduler.
      Parameters:
      item - the item to emit first
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if item is null
      Since:
      3.0.0
      See Also:
    • startWithArray

      Returns a Flowable that emits the specified items before it begins to emit items emitted by the current Flowable.

      Backpressure:
      The operator honors backpressure from downstream. The current Flowable is expected to honor backpressure as well. If it violates this rule, it may throw an IllegalStateException when the current Flowable completes.
      Scheduler:
      startWithArray does not operate by default on a particular Scheduler.
      Parameters:
      items - the array of values to emit first
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if items is null
      See Also:
    • subscribe

      Subscribes to the current Flowable and ignores onNext and onComplete emissions.

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

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner (i.e., no backpressure is applied to it).
      Scheduler:
      subscribe does not operate by default on a particular Scheduler.
      Returns:
      the new Disposable instance that allows cancelling the flow
      See Also:
    • subscribe

      Subscribes to the current Flowable 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(Throwable) handler.

      Backpressure:
      The operator consumes the current Flowable 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 current Flowable
      Returns:
      the new Disposable instance that allows cancelling the flow
      Throws:
      NullPointerException - if onNext is null
      See Also:
    • subscribe

      Subscribes to the current Flowable and provides callbacks to handle the items it emits and any error notification it issues.
      Backpressure:
      The operator consumes the current Flowable 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 current Flowable
      onError - the Consumer<Throwable> you have designed to accept any error notification from the current Flowable
      Returns:
      the new Disposable instance that allows cancelling the flow
      Throws:
      NullPointerException - if onNext or onError is null
      See Also:
    • subscribe

      Subscribes to the current Flowable and provides callbacks to handle the items it emits and any error or completion notification it issues.
      Backpressure:
      The operator consumes the current Flowable 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 current Flowable
      onError - the Consumer<Throwable> you have designed to accept any error notification from the current Flowable
      onComplete - the Action you have designed to accept a completion notification from the the current Flowable
      Returns:
      the new Disposable instance that allows cancelling the flow
      Throws:
      NullPointerException - if onNext, onError or onComplete is null
      See Also:
    • subscribe

      Wraps the given onXXX callbacks into a Disposable Subscriber, adds it to the given DisposableContainer and ensures, that if the upstream terminates or this particular Disposable is disposed, the Subscriber is removed from the given container.

      The Subscriber will be removed after the callback for the terminal event has been invoked.

      Backpressure:
      The operator consumes the current Flowable 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 callback for upstream items
      onError - the callback for an upstream error if any
      onComplete - the callback for the upstream completion if any
      container - the DisposableContainer (such as CompositeDisposable) to add and remove the created Disposable Subscriber
      Returns:
      the Disposable that allows disposing the particular subscription.
      Throws:
      NullPointerException - if onNext, onError, onComplete or container is null
      Since:
      3.1.0
    • subscribe

      @BackpressureSupport(SPECIAL) @SchedulerSupport("none") public final void subscribe(@NonNull @NonNull org.reactivestreams.Subscriber<? super @NonNull T> subscriber)
      Specified by:
      subscribe in interface org.reactivestreams.Publisher<T>
    • subscribe

      @BackpressureSupport(SPECIAL) @SchedulerSupport("none") public final void subscribe(@NonNull @NonNull FlowableSubscriber<? super @NonNull T> subscriber)
      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 Subscriber.onError(Throwable).

      This subscribe method relaxes the following Reactive Streams rules:

      • §1.3: onNext should not be called concurrently until onSubscribe returns. FlowableSubscriber.onSubscribe(Subscription) 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(Throwable) 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; 2.1 - beta

      Parameters:
      subscriber - the FlowableSubscriber that will consume signals from this Flowable
      Throws:
      NullPointerException - if subscriber is null
      Since:
      2.2
    • subscribeActual

      protected abstract void subscribeActual(@NonNull @NonNull org.reactivestreams.Subscriber<? super @NonNull T> subscriber)
      Operator implementations (both source and intermediate) should implement this method that performs the necessary business logic and handles the incoming Subscribers.

      There is no need to call any of the plugin hooks on the current Flowable instance or the Subscriber; all hooks and basic safeguards have been applied by subscribe(Subscriber) before this method gets called.

      Parameters:
      subscriber - the incoming Subscriber, never null
    • subscribeWith

      @CheckReturnValue @BackpressureSupport(SPECIAL) @SchedulerSupport("none") @NonNull public final <@NonNull E extends org.reactivestreams.Subscriber<? super @NonNull T>> E subscribeWith(@NonNull 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.
      Type Parameters:
      E - the type of the Subscriber to use and return
      Parameters:
      subscriber - the Subscriber (subclass) to use and return, not null
      Returns:
      the input subscriber
      Throws:
      NullPointerException - if subscriber is null
      Since:
      2.0
    • subscribeOn

      Asynchronously subscribes Subscribers to the current Flowable 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 current Flowable's backpressure behavior.
      Scheduler:
      You specify which Scheduler this operator will use.
      Parameters:
      scheduler - the Scheduler to perform subscription actions on
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if scheduler is null
      See Also:
    • subscribeOn

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("custom") public final @NonNull Flowable<T> subscribeOn(@NonNull @NonNull Scheduler scheduler, boolean requestOn)
      Asynchronously subscribes Subscribers to the current Flowable 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 current Flowable's backpressure behavior.
      Scheduler:
      You specify which Scheduler this operator will use.

      History: 2.1.1 - experimental

      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 new Flowable instance
      Throws:
      NullPointerException - if scheduler is null
      Since:
      2.2
      See Also:
    • switchIfEmpty

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final @NonNull Flowable<T> switchIfEmpty(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> other)
      Returns a Flowable that emits the items emitted by the current Flowable or the items of an alternate Publisher if the current Flowable is empty.

      Backpressure:
      If the current Flowable is empty, the alternate Publisher is expected to honor backpressure. If the current Flowable is non-empty, it is expected to honor backpressure as instead. In either case, if violated, a MissingBackpressureException may get signaled 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:
      the new Flowable instance
      Throws:
      NullPointerException - if other is null
      Since:
      1.1.0
    • switchMap

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> switchMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull R>> mapper)
      Returns a new Flowable by applying a function that you supply to each item emitted by the current Flowable that returns a Publisher, and then emitting the items emitted by the most recently emitted of these Publishers.

      The resulting Flowable completes if both the current Flowable and the last inner Publisher, if any, complete. If the current Flowable signals an onError, the inner Publisher is canceled 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.
      Type Parameters:
      R - the element type of the inner Publishers and the output
      Parameters:
      mapper - a function that, when applied to an item emitted by the current Flowable, returns a Publisher
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      See Also:
    • switchMap

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> switchMap(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull R>> mapper, int bufferSize)
      Returns a new Flowable by applying a function that you supply to each item emitted by the current Flowable that returns a Publisher, and then emitting the items emitted by the most recently emitted of these Publishers.

      The resulting Flowable completes if both the current Flowable and the last inner Publisher, if any, complete. If the current Flowable signals an onError, the inner Publisher is canceled 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.
      Type Parameters:
      R - the element type of the inner Publishers and the output
      Parameters:
      mapper - a function that, when applied to an item emitted by the current Flowable, returns a Publisher
      bufferSize - the number of elements to prefetch from the current active inner Publisher
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • switchMapCompletable

      Maps the upstream values into CompletableSources, subscribes to the newer one while disposing the subscription to the previous CompletableSource, thus keeping at most one active CompletableSource running.

      Since a CompletableSource doesn't produce any items, the resulting reactive type of this operator is a Completable that can only indicate successful completion or a failure in any of the inner CompletableSources or the failure of the current Flowable.

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner and otherwise does not have backpressure in its return type because no items are ever produced.
      Scheduler:
      switchMapCompletable does not operate by default on a particular Scheduler.
      Error handling:
      If either this Flowable or the active CompletableSource signals an onError, the resulting Completable is terminated immediately with that Throwable. Use the switchMapCompletableDelayError(Function) to delay such inner failures until every inner CompletableSources and the main Flowable terminates in some fashion. If they fail concurrently, the operator may combine the Throwables into a CompositeException and signal it to the downstream instead. If any inactivated (switched out) CompletableSource signals an onError late, the Throwables will be signaled to the global error handler via RxJavaPlugins.onError(Throwable) method as UndeliverableException errors.

      History: 2.1.11 - experimental

      Parameters:
      mapper - the function called with each upstream item and should return a CompletableSource to be subscribed to and awaited for (non blockingly) for its terminal event
      Returns:
      the new Completable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.2
      See Also:
    • switchMapCompletableDelayError

      Maps the upstream values into CompletableSources, subscribes to the newer one while disposing the subscription to the previous CompletableSource, thus keeping at most one active CompletableSource running and delaying any main or inner errors until all of them terminate.

      Since a CompletableSource doesn't produce any items, the resulting reactive type of this operator is a Completable that can only indicate successful completion or a failure in any of the inner CompletableSources or the failure of the current Flowable.

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner and otherwise does not have backpressure in its return type because no items are ever produced.
      Scheduler:
      switchMapCompletableDelayError does not operate by default on a particular Scheduler.
      Error handling:
      The errors of this Flowable and all the CompletableSources, who had the chance to run to their completion, are delayed until all of them terminate in some fashion. At this point, if there was only one failure, the respective Throwable is emitted to the downstream. If there was more than one failure, the operator combines all Throwables into a CompositeException and signals that to the downstream. If any inactivated (switched out) CompletableSource signals an onError late, the Throwables will be signaled to the global error handler via RxJavaPlugins.onError(Throwable) method as UndeliverableException errors.

      History: 2.1.11 - experimental

      Parameters:
      mapper - the function called with each upstream item and should return a CompletableSource to be subscribed to and awaited for (non blockingly) for its terminal event
      Returns:
      the new Completable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.2
      See Also:
    • switchMapDelayError

      @CheckReturnValue @BackpressureSupport(SPECIAL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> switchMapDelayError(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull R>> mapper)
      Returns a new Flowable by applying a function that you supply to each item emitted by the current Flowable 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 Flowable completes if both the current Flowable and the last inner Publisher, if any, complete. If the current Flowable 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 signaled.

      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.
      Type Parameters:
      R - the element type of the inner Publishers and the output
      Parameters:
      mapper - a function that, when applied to an item emitted by the current Flowable, returns a Publisher
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.0
      See Also:
    • switchMapDelayError

      @CheckReturnValue @BackpressureSupport(SPECIAL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> switchMapDelayError(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends @NonNull R>> mapper, int bufferSize)
      Returns a new Flowable by applying a function that you supply to each item emitted by the current Flowable 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 Flowable completes if both the current Flowable and the last inner Publisher, if any, complete. If the current Flowable 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 signaled.

      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.
      Type Parameters:
      R - the element type of the inner Publishers and the output
      Parameters:
      mapper - a function that, when applied to an item emitted by the current Flowable, returns a Publisher
      bufferSize - the number of elements to prefetch from the current active inner Publisher
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if bufferSize is non-positive
      Since:
      2.0
      See Also:
    • switchMap0

      <R> Flowable<R> switchMap0(Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<? extends R>> mapper, int bufferSize, boolean delayError)
    • switchMapMaybe

      @CheckReturnValue @NonNull @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> switchMapMaybe(@NonNull @NonNull Function<? super @NonNull T,? extends MaybeSource<? extends @NonNull R>> mapper)
      Maps the upstream items into MaybeSources and switches (subscribes) to the newer ones while disposing the older ones (and ignoring their signals) and emits the latest success value of the current one if available while failing immediately if this Flowable or any of the active inner MaybeSources fail.

      Backpressure:
      The operator honors backpressure from downstream. The main Flowable is consumed in an unbounded manner (i.e., without backpressure).
      Scheduler:
      switchMapMaybe does not operate by default on a particular Scheduler.
      Error handling:
      This operator terminates with an onError if this Flowable or any of the inner MaybeSources fail while they are active. When this happens concurrently, their individual Throwable errors may get combined and emitted as a single CompositeException. Otherwise, a late (i.e., inactive or switched out) onError from this Flowable or from any of the inner MaybeSources will be forwarded to the global error handler via RxJavaPlugins.onError(Throwable) as UndeliverableException

      History: 2.1.11 - experimental

      Type Parameters:
      R - the output value type
      Parameters:
      mapper - the function called with the current upstream event and should return a MaybeSource to replace the current active inner source and get subscribed to.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.2
      See Also:
    • switchMapMaybeDelayError

      @CheckReturnValue @NonNull @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> switchMapMaybeDelayError(@NonNull @NonNull Function<? super @NonNull T,? extends MaybeSource<? extends @NonNull R>> mapper)
      Maps the upstream items into MaybeSources and switches (subscribes) to the newer ones while disposing the older ones (and ignoring their signals) and emits the latest success value of the current one if available, delaying errors from this Flowable or the inner MaybeSources until all terminate.

      Backpressure:
      The operator honors backpressure from downstream. The main Flowable is consumed in an unbounded manner (i.e., without backpressure).
      Scheduler:
      switchMapMaybeDelayError does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Type Parameters:
      R - the output value type
      Parameters:
      mapper - the function called with the current upstream event and should return a MaybeSource to replace the current active inner source and get subscribed to.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.2
      See Also:
    • switchMapSingle

      @CheckReturnValue @NonNull @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> switchMapSingle(@NonNull @NonNull Function<? super @NonNull T,? extends SingleSource<? extends @NonNull R>> mapper)
      Maps the upstream items into SingleSources and switches (subscribes) to the newer ones while disposing the older ones (and ignoring their signals) and emits the latest success value of the current one while failing immediately if this Flowable or any of the active inner SingleSources fail.

      Backpressure:
      The operator honors backpressure from downstream. The main Flowable is consumed in an unbounded manner (i.e., without backpressure).
      Scheduler:
      switchMapSingle does not operate by default on a particular Scheduler.
      Error handling:
      This operator terminates with an onError if this Flowable or any of the inner SingleSources fail while they are active. When this happens concurrently, their individual Throwable errors may get combined and emitted as a single CompositeException. Otherwise, a late (i.e., inactive or switched out) onError from this Flowable or from any of the inner SingleSources will be forwarded to the global error handler via RxJavaPlugins.onError(Throwable) as UndeliverableException

      History: 2.1.11 - experimental

      Type Parameters:
      R - the output value type
      Parameters:
      mapper - the function called with the current upstream event and should return a SingleSource to replace the current active inner source and get subscribed to.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.2
      See Also:
    • switchMapSingleDelayError

      @CheckReturnValue @NonNull @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> switchMapSingleDelayError(@NonNull @NonNull Function<? super @NonNull T,? extends SingleSource<? extends @NonNull R>> mapper)
      Maps the upstream items into SingleSources and switches (subscribes) to the newer ones while disposing the older ones (and ignoring their signals) and emits the latest success value of the current one, delaying errors from this Flowable or the inner SingleSources until all terminate.

      Backpressure:
      The operator honors backpressure from downstream. The main Flowable is consumed in an unbounded manner (i.e., without backpressure).
      Scheduler:
      switchMapSingleDelayError does not operate by default on a particular Scheduler.

      History: 2.1.11 - experimental

      Type Parameters:
      R - the output value type
      Parameters:
      mapper - the function called with the current upstream event and should return a SingleSource to replace the current active inner source and get subscribed to.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      2.2
      See Also:
    • take

      Returns a Flowable that emits only the first count items emitted by the current Flowable. If the source emits fewer than count items then all of its items are emitted.

      This method returns a Flowable that will invoke a subscribing Subscriber's onNext function a maximum of count times before invoking onComplete.

      Limits both the number of upstream items (after which the sequence completes) and the total downstream request amount requested from the upstream to possibly prevent the creation of excess items by the upstream.

      The operator requests at most the given count of items from upstream even if the downstream requests more than that. For example, given a take(5), if the downstream requests 1, a request of 1 is submitted to the upstream and the operator remembers that only 4 items can be requested now on. A request of 5 at this point will request 4 from the upstream and any subsequent requests will be ignored.

      Note that requests are negotiated on an operator boundary and take's amount may not be preserved further upstream. For example, source.observeOn(Schedulers.computation()).take(5) will still request the default (128) elements from the given source.

      Backpressure:
      The current Flowable is consumed in a bounded manner.
      Scheduler:
      This version of take does not operate by default on a particular Scheduler.
      Parameters:
      count - the maximum number of items and the total request amount, non-negative. Zero will immediately cancel the upstream on subscription and complete the downstream.
      Returns:
      the new Flowable instance
      Throws:
      IllegalArgumentException - if count is negative
      See Also:
    • take

      @CheckReturnValue @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<T> take(long time, @NonNull @NonNull TimeUnit unit)
      Returns a Flowable that emits those items emitted by source Publisher before a specified time runs out.

      If time runs out before the Flowable completes normally, the onComplete event will be signaled on the default computation Scheduler.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable'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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • take

      Returns a Flowable that emits those items emitted by source Publisher before a specified time (on a specified Scheduler) runs out.

      If time runs out before the Flowable completes normally, the onComplete event will be signaled on the provided Scheduler.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable'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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • takeLast

      Returns a Flowable that emits at most the last count items emitted by the current Flowable. 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 current Flowable
      Returns:
      the new Flowable instance
      Throws:
      IllegalArgumentException - if count is negative
      See Also:
    • takeLast

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final @NonNull Flowable<T> takeLast(long count, long time, @NonNull @NonNull TimeUnit unit)
      Returns a Flowable that emits at most a specified number of items from the current Flowable that were emitted in a specified window of time before the current Flowable completed.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      IllegalArgumentException - if count is negative
      See Also:
    • takeLast

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("custom") @NonNull public final @NonNull Flowable<T> takeLast(long count, long time, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler)
      Returns a Flowable that emits at most a specified number of items from the current Flowable that were emitted in a specified window of time before the current Flowable completed, where the timing information is provided by a given Scheduler.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      IllegalArgumentException - if count is less than zero
      See Also:
    • takeLast

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("custom") public final @NonNull Flowable<T> takeLast(long count, long time, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, boolean delayError, int bufferSize)
      Returns a Flowable that emits at most a specified number of items from the current Flowable that were emitted in a specified window of time before the current Flowable completed, where the timing information is provided by a given Scheduler.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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 signaled by the current Flowable is delayed until the regular elements are consumed by the downstream; if false, an exception is immediately signaled and all regular elements dropped
      bufferSize - the hint about how many elements to expect to be last
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      IllegalArgumentException - if count is negative or bufferSize is non-positive
      See Also:
    • takeLast

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<T> takeLast(long time, @NonNull @NonNull TimeUnit unit)
      Returns a Flowable that emits the items from the current Flowable that were emitted in a specified window of time before the current Flowable completed.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • takeLast

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<T> takeLast(long time, @NonNull @NonNull TimeUnit unit, boolean delayError)
      Returns a Flowable that emits the items from the current Flowable that were emitted in a specified window of time before the current Flowable completed.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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 signaled by the current Flowable is delayed until the regular elements are consumed by the downstream; if false, an exception is immediately signaled and all regular elements dropped
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • takeLast

      Returns a Flowable that emits the items from the current Flowable that were emitted in a specified window of time before the current Flowable completed, where the timing information is provided by a specified Scheduler.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • takeLast

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("custom") @NonNull public final @NonNull Flowable<T> takeLast(long time, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, boolean delayError)
      Returns a Flowable that emits the items from the current Flowable that were emitted in a specified window of time before the current Flowable completed, where the timing information is provided by a specified Scheduler.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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 signaled by the current Flowable is delayed until the regular elements are consumed by the downstream; if false, an exception is immediately signaled and all regular elements dropped
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • takeLast

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("custom") @NonNull public final @NonNull Flowable<T> takeLast(long time, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, boolean delayError, int bufferSize)
      Returns a Flowable that emits the items from the current Flowable that were emitted in a specified window of time before the current Flowable completed, where the timing information is provided by a specified Scheduler.

      Backpressure:
      The operator honors backpressure from downstream and consumes the current Flowable 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 signaled by the current Flowable is delayed until the regular elements are consumed by the downstream; if false, an exception is immediately signaled and all regular elements dropped
      bufferSize - the hint about how many elements to expect to be last
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • takeUntil

      Returns a Flowable that emits items emitted by the current Flowable, 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 current Flowable and returns a Boolean
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if stopPredicate is null
      Since:
      1.1.0
      See Also:
    • takeUntil

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") public final <@NonNull U> @NonNull Flowable<T> takeUntil(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull U> other)
      Returns a Flowable that emits the items emitted by the current Flowable until a second Publisher emits an item or completes.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      takeUntil does not operate by default on a particular Scheduler.
      Type Parameters:
      U - the type of items emitted by other
      Parameters:
      other - the Publisher whose first emitted item or completion will cause takeUntil to stop emitting items from the current Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other is null
      See Also:
    • takeWhile

      Returns a Flowable that emits items emitted by the current Flowable 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 current Flowable'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 current Flowable and returns a Boolean
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if predicate is null
      See Also:
    • throttleFirst

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<T> throttleFirst(long windowDuration, @NonNull @NonNull TimeUnit unit)
      Returns a Flowable that emits only the first item emitted by the current Flowable during sequential time windows of a specified duration.

      This differs from throttleLast(long, java.util.concurrent.TimeUnit) in that this only tracks the passage of time whereas throttleLast(long, java.util.concurrent.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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • throttleFirst

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("custom") public final @NonNull Flowable<T> throttleFirst(long skipDuration, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler)
      Returns a Flowable that emits only the first item emitted by the current Flowable during sequential time windows of a specified duration, where the windows are managed by a specified Scheduler.

      This differs from throttleLast(long, java.util.concurrent.TimeUnit) in that this only tracks the passage of time whereas throttleLast(long, java.util.concurrent.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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • throttleFirst

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("custom") public final @NonNull Flowable<T> throttleFirst(long skipDuration, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, @NonNull @NonNull Consumer<? super @NonNull T> onDropped)
      Returns a Flowable that emits only the first item emitted by the current Flowable during sequential time windows of a specified duration, where the windows are managed by a specified Scheduler.

      This differs from throttleLast(long, java.util.concurrent.TimeUnit) in that this only tracks the passage of time whereas throttleLast(long, java.util.concurrent.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
      onDropped - called when an item doesn't get delivered to the downstream
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler or onDropped is null
      Since:
      3.1.6 - Experimental
      See Also:
    • throttleLast

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<T> throttleLast(long intervalDuration, @NonNull @NonNull TimeUnit unit)
      Returns a Flowable that emits only the last item emitted by the current Flowable during sequential time windows of a specified duration.

      This differs from throttleFirst(long, java.util.concurrent.TimeUnit) in that this ticks along at a scheduled interval whereas throttleFirst(long, java.util.concurrent.TimeUnit) does not tick, it just tracks the 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 current Flowable will be emitted
      unit - the unit of time of intervalDuration
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • throttleLast

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("custom") @NonNull public final @NonNull Flowable<T> throttleLast(long intervalDuration, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler)
      Returns a Flowable that emits only the last item emitted by the current Flowable during sequential time windows of a specified duration, where the duration is governed by a specified Scheduler.

      This differs from throttleFirst(long, TimeUnit, Scheduler) in that this ticks along at a scheduled interval whereas throttleFirst does not tick, it just tracks the 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 current Flowable 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • throttleLast

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("custom") @NonNull public final @NonNull Flowable<T> throttleLast(long intervalDuration, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, @NonNull @NonNull Consumer<? super @NonNull T> onDropped)
      Returns a Flowable that emits only the last item emitted by the current Flowable during sequential time windows of a specified duration, where the duration is governed by a specified Scheduler.

      This differs from throttleFirst(long, TimeUnit, Scheduler) in that this ticks along at a scheduled interval whereas throttleFirst does not tick, it just tracks the 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 current Flowable 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
      onDropped - called with the current entry when it has been replaced by a new one
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null or onDropped is null
      Since:
      3.1.6 - Experimental
      See Also:
    • throttleLatest

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<T> throttleLatest(long timeout, @NonNull @NonNull TimeUnit unit)
      Throttles items from the upstream Flowable by first emitting the next item from upstream, then periodically emitting the latest item (if any) when the specified timeout elapses between them.

      Unlike the option with throttleLatest(long, TimeUnit, boolean), the very last item being held back (if any) is not emitted when the upstream completes.

      If no items were emitted from the upstream during this timeout phase, the next upstream item is emitted immediately and the timeout window starts from then.

      Backpressure:
      This operator does not support backpressure as it uses time to control data flow. If the downstream is not ready to receive items, a MissingBackpressureException will be signaled.
      Scheduler:
      throttleLatest operates by default on the computation Scheduler.

      History: 2.1.14 - experimental

      Parameters:
      timeout - the time to wait after an item emission towards the downstream before trying to emit the latest item from upstream again
      unit - the time unit
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      Since:
      2.2
      See Also:
    • throttleLatest

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<T> throttleLatest(long timeout, @NonNull @NonNull TimeUnit unit, boolean emitLast)
      Throttles items from the upstream Flowable by first emitting the next item from upstream, then periodically emitting the latest item (if any) when the specified timeout elapses between them.

      If no items were emitted from the upstream during this timeout phase, the next upstream item is emitted immediately and the timeout window starts from then.

      Backpressure:
      This operator does not support backpressure as it uses time to control data flow. If the downstream is not ready to receive items, a MissingBackpressureException will be signaled.
      Scheduler:
      throttleLatest operates by default on the computation Scheduler.

      History: 2.1.14 - experimental

      Parameters:
      timeout - the time to wait after an item emission towards the downstream before trying to emit the latest item from upstream again
      unit - the time unit
      emitLast - If true, the very last item from the upstream will be emitted immediately when the upstream completes, regardless if there is a timeout window active or not. If false, the very last upstream item is ignored and the flow terminates.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      Since:
      2.2
      See Also:
    • throttleLatest

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("custom") @NonNull public final @NonNull Flowable<T> throttleLatest(long timeout, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler)
      Throttles items from the upstream Flowable by first emitting the next item from upstream, then periodically emitting the latest item (if any) when the specified timeout elapses between them.

      Unlike the option with throttleLatest(long, TimeUnit, Scheduler, boolean), the very last item being held back (if any) is not emitted when the upstream completes.

      If no items were emitted from the upstream during this timeout phase, the next upstream item is emitted immediately and the timeout window starts from then.

      Backpressure:
      This operator does not support backpressure as it uses time to control data flow. If the downstream is not ready to receive items, a MissingBackpressureException will be signaled.
      Scheduler:
      You specify which Scheduler this operator will use.

      History: 2.1.14 - experimental

      Parameters:
      timeout - the time to wait after an item emission towards the downstream before trying to emit the latest item from upstream again
      unit - the time unit
      scheduler - the Scheduler where the timed wait and latest item emission will be performed
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      Since:
      2.2
      See Also:
    • throttleLatest

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("custom") public final @NonNull Flowable<T> throttleLatest(long timeout, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, boolean emitLast)
      Throttles items from the upstream Flowable by first emitting the next item from upstream, then periodically emitting the latest item (if any) when the specified timeout elapses between them.

      If no items were emitted from the upstream during this timeout phase, the next upstream item is emitted immediately and the timeout window starts from then.

      Backpressure:
      This operator does not support backpressure as it uses time to control data flow. If the downstream is not ready to receive items, a MissingBackpressureException will be signaled.
      Scheduler:
      You specify which Scheduler this operator will use.

      History: 2.1.14 - experimental

      Parameters:
      timeout - the time to wait after an item emission towards the downstream before trying to emit the latest item from upstream again
      unit - the time unit
      scheduler - the Scheduler where the timed wait and latest item emission will be performed
      emitLast - If true, the very last item from the upstream will be emitted immediately when the upstream completes, regardless if there is a timeout window active or not. If false, the very last upstream item is ignored and the flow terminates.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      Since:
      2.2
    • throttleLatest

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("custom") public final @NonNull Flowable<T> throttleLatest(long timeout, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, boolean emitLast, @NonNull @NonNull Consumer<? super @NonNull T> onDropped)
      Throttles items from the upstream Flowable by first emitting the next item from upstream, then periodically emitting the latest item (if any) when the specified timeout elapses between them, invoking the consumer for any dropped item.

      If no items were emitted from the upstream during this timeout phase, the next upstream item is emitted immediately and the timeout window starts from then.

      Backpressure:
      This operator does not support backpressure as it uses time to control data flow. If the downstream is not ready to receive items, a MissingBackpressureException will be signaled.
      Scheduler:
      You specify which Scheduler this operator will use.
      Error handling:
      If the upstream signals an onError or onDropped callback crashes, the error is delivered immediately to the downstream. If both happen, a CompositeException is created, containing both the upstream and the callback error. If the onDropped callback crashes during cancellation, the exception is forwarded to the global error handler via RxJavaPlugins.onError(Throwable).
      Parameters:
      timeout - the time to wait after an item emission towards the downstream before trying to emit the latest item from upstream again
      unit - the time unit
      scheduler - the Scheduler where the timed wait and latest item emission will be performed
      emitLast - If true, the very last item from the upstream will be emitted immediately when the upstream completes, regardless if there is a timeout window active or not. If false, the very last upstream item is ignored and the flow terminates.
      onDropped - called when an item is replaced by a newer item that doesn't get delivered to the downstream, including the very last item if emitLast is false and the current undelivered item when the sequence gets canceled.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit, scheduler or onDropped is null
      Since:
      3.1.6 - Experimental
    • throttleWithTimeout

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<T> throttleWithTimeout(long timeout, @NonNull @NonNull TimeUnit unit)
      Returns a Flowable that mirrors the current Flowable, except that it drops items emitted by the current Flowable that are followed by newer items before a timeout value expires. The timer resets on each emission (alias to debounce(long, TimeUnit)).

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

      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 current Flowable in which it emits no items in order for the item to be emitted by the resulting Flowable
      unit - the unit of time for the specified timeout
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • throttleWithTimeout

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("custom") @NonNull public final @NonNull Flowable<T> throttleWithTimeout(long timeout, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler)
      Returns a Flowable that mirrors the current Flowable, except that it drops items emitted by the current Flowable that are followed by newer items before a timeout value expires on a specified Scheduler. The timer resets on each emission (alias to debounce(long, TimeUnit, Scheduler)).

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

      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 current Flowable in which it emits no items in order for the item to be emitted by the resulting Flowable
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • throttleWithTimeout

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("custom") @NonNull public final @NonNull Flowable<T> throttleWithTimeout(long timeout, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, @NonNull @NonNull Consumer<? super @NonNull T> onDropped)
      Returns a Flowable that mirrors the current Flowable, except that it drops items emitted by the current Flowable that are followed by newer items before a timeout value expires on a specified Scheduler. The timer resets on each emission (alias to debounce(long, TimeUnit, Scheduler, Consumer)).

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

      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 current Flowable in which it emits no items in order for the item to be emitted by the resulting Flowable
      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
      onDropped - called with the current entry when it has been replaced by a new one
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null or onDropped is null
      Since:
      3.1.6 - Experimental
      See Also:
    • timeInterval

      Returns a Flowable that emits records of the time interval between consecutive items emitted by the current Flowable.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      timeInterval does not operate on any particular scheduler but uses the current time from the computation Scheduler.
      Returns:
      the new Flowable instance
      See Also:
    • timeInterval

      Returns a Flowable that emits records of the time interval between consecutive items emitted by the current Flowable, where this interval is computed on a specified Scheduler.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      timeInterval 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:
      the new Flowable instance
      Throws:
      NullPointerException - if scheduler is null
      See Also:
    • timeInterval

      Returns a Flowable that emits records of the time interval between consecutive items emitted by the current Flowable.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable'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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • timeInterval

      Returns a Flowable that emits records of the time interval between consecutive items emitted by the current Flowable, where this interval is computed on a specified Scheduler.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      timeInterval 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • timeout

      @CheckReturnValue @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") @NonNull public final <@NonNull V> @NonNull Flowable<T> timeout(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<@NonNull V>> itemTimeoutIndicator)
      Returns a Flowable that mirrors the current Flowable, but notifies Subscribers of a TimeoutException if an item emitted by the current Flowable 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 current Flowables violate this, it may throw an IllegalStateException when the current Flowable completes.
      Scheduler:
      This version of timeout operates by default on the immediate Scheduler.
      Type Parameters:
      V - the timeout value type (ignored)
      Parameters:
      itemTimeoutIndicator - a function that returns a Publisher for each item emitted by the current Flowable and that determines the timeout window for the subsequent item
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if itemTimeoutIndicator is null
      See Also:
    • timeout

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull V> @NonNull Flowable<T> timeout(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<@NonNull V>> itemTimeoutIndicator, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> fallback)
      Returns a Flowable that mirrors the current Flowable, but that switches to a fallback Publisher if an item emitted by the current Flowable 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 current Flowables violate this, it may throw an IllegalStateException when the current Flowable completes.
      Scheduler:
      This version of timeout operates by default on the immediate Scheduler.
      Type Parameters:
      V - the timeout value type (ignored)
      Parameters:
      itemTimeoutIndicator - a function that returns a Publisher, for each item emitted by the current Flowable, that determines the timeout window for the subsequent item
      fallback - the fallback Publisher to switch to if the current Flowable times out
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if itemTimeoutIndicator or fallback is null
      See Also:
    • timeout

      @CheckReturnValue @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<T> timeout(long timeout, @NonNull @NonNull TimeUnit unit)
      Returns a Flowable that mirrors the current Flowable 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 Flowable terminates and notifies Subscribers of a TimeoutException.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable'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
      unit - the unit of time that applies to the timeout argument.
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • timeout

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("io.reactivex:computation") public final @NonNull Flowable<T> timeout(long timeout, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> fallback)
      Returns a Flowable that mirrors the current Flowable 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 current Flowable is disposed and the resulting Flowable 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 current Flowables violate this, it may throw an IllegalStateException when the current Flowable completes.
      Scheduler:
      This version of timeout operates by default on the computation Scheduler.
      Parameters:
      timeout - maximum duration between items before a timeout occurs
      unit - the unit of time that applies to the timeout argument
      fallback - the fallback Publisher to use in case of a timeout
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or fallback is null
      See Also:
    • timeout

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("custom") public final @NonNull Flowable<T> timeout(long timeout, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> fallback)
      Returns a Flowable that mirrors the current Flowable 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 current Flowable is disposed and the resulting Flowable 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 current Flowables violate this, it may throw an IllegalStateException when the current Flowable completes.
      Scheduler:
      You specify which Scheduler this operator will use.
      Parameters:
      timeout - maximum duration between items before a timeout occurs
      unit - the unit of time that applies to the timeout argument
      scheduler - the Scheduler to run the timeout timers on
      fallback - the Publisher to use as the fallback in case of a timeout
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit, scheduler or fallback is null
      See Also:
    • timeout

      Returns a Flowable that mirrors the current Flowable but applies a timeout policy for each emitted item, where this policy is governed by a specified Scheduler. If the next item isn't emitted within the specified timeout duration starting from its predecessor, the resulting Flowable terminates and notifies Subscribers of a TimeoutException.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      You specify which Scheduler this operator will use.
      Parameters:
      timeout - maximum duration between items before a timeout occurs
      unit - the unit of time that applies to the timeout argument
      scheduler - the Scheduler to run the timeout timers on
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • timeout

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") public final <@NonNull U, @NonNull V> @NonNull Flowable<T> timeout(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull U> firstTimeoutIndicator, @NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<@NonNull V>> itemTimeoutIndicator)
      Returns a Flowable that mirrors the current Flowable, but notifies Subscribers of a TimeoutException if either the first item emitted by the current Flowable 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 operate by default on any Scheduler.
      Type Parameters:
      U - the first timeout value type (ignored)
      V - the subsequent timeout value type (ignored)
      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 current Flowable and that determines the timeout window in which the subsequent source item must arrive in order to continue the sequence
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if firstTimeoutIndicator or itemTimeoutIndicator is null
      See Also:
    • timeout

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull U, @NonNull V> @NonNull Flowable<T> timeout(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull U> firstTimeoutIndicator, @NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<@NonNull V>> itemTimeoutIndicator, @NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull T> fallback)
      Returns a Flowable that mirrors the current Flowable, but switches to a fallback Publisher if either the first item emitted by the current Flowable 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 current Flowables violate this, it may throw an IllegalStateException when the current Flowable completes.
      Scheduler:
      timeout does not operate by default on any Scheduler.
      Type Parameters:
      U - the first timeout value type (ignored)
      V - the subsequent timeout value type (ignored)
      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 current Flowable and that determines the timeout window in which the subsequent source item must arrive in order to continue the sequence
      fallback - the fallback Publisher to switch to if the current Flowable times out
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if firstTimeoutIndicator, itemTimeoutIndicator or fallback is null
      See Also:
    • timeout0

      private Flowable<T> timeout0(long timeout, TimeUnit unit, org.reactivestreams.Publisher<? extends @NonNull T> fallback, Scheduler scheduler)
    • timeout0

      private <@NonNull U, @NonNull V> Flowable<T> timeout0(org.reactivestreams.Publisher<@NonNull U> firstTimeoutIndicator, Function<? super @NonNull T,@NonNull ? extends org.reactivestreams.Publisher<@NonNull V>> itemTimeoutIndicator, org.reactivestreams.Publisher<? extends @NonNull T> fallback)
    • timestamp

      Returns a Flowable that emits each item emitted by the current Flowable, wrapped in a Timed object.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      timestamp does not operate on any particular scheduler but uses the current time from the computation Scheduler.
      Returns:
      the new Flowable instance
      See Also:
    • timestamp

      Returns a Flowable that emits each item emitted by the current Flowable, 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 current Flowable'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:
      the new Flowable instance
      Throws:
      NullPointerException - if scheduler is null
      See Also:
    • timestamp

      Returns a Flowable that emits each item emitted by the current Flowable, wrapped in a Timed object.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable'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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • timestamp

      Returns a Flowable that emits each item emitted by the current Flowable, 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 current Flowable'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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • to

      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.

      History: 2.1.7 - experimental

      Type Parameters:
      R - the resulting object type
      Parameters:
      converter - the function that receives the current Flowable instance and returns a value
      Returns:
      the converted value
      Throws:
      NullPointerException - if converter is null
      Since:
      2.2
    • 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 by having the operator compose a list of all of these items and then to invoke the SingleObserver's onSuccess method once, passing it the entire list, by calling the Flowable'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 current Flowable in an unbounded manner (i.e., without applying backpressure to it).
      Scheduler:
      toList does not operate by default on a particular Scheduler.
      Returns:
      the new Single instance
      See Also:
    • toList

      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 by having the operator compose a list of all of these items and then to invoke the SingleObserver's onSuccess method once, passing it the entire list, by calling the Flowable'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 current Flowable 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:
      the new Single instance
      Throws:
      IllegalArgumentException - if capacityHint is non-positive
      See Also:
    • toList

      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 by having the operator compose a collection of all of these items and then to invoke the SingleObserver's onSuccess method once, passing it the entire collection, by calling the Flowable'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 current Flowable in an unbounded manner (i.e., without applying backpressure to it).
      Scheduler:
      toList does not operate by default on a particular Scheduler.
      Type Parameters:
      U - the subclass of a collection of Ts
      Parameters:
      collectionSupplier - the Supplier returning the collection (for each individual Subscriber) to be filled in
      Returns:
      the new Single instance
      Throws:
      NullPointerException - if collectionSupplier is null
      See Also:
    • toMap

      Returns a Single that emits a single HashMap containing all items emitted by the finite 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.

      Note that this operator requires the upstream to signal onComplete for the accumulated map 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 current Flowable in an unbounded manner (i.e., without applying backpressure to it).
      Scheduler:
      toMap does not operate by default on a particular Scheduler.
      Type Parameters:
      K - the key type of the Map
      Parameters:
      keySelector - the function that extracts the key from a source item to be used in the HashMap
      Returns:
      the new Single instance
      Throws:
      NullPointerException - if keySelector is null
      See Also:
    • toMap

      @CheckReturnValue @NonNull @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final <@NonNull K, @NonNull V> @NonNull Single<Map<K,V>> toMap(@NonNull @NonNull Function<? super @NonNull T,? extends @NonNull K> keySelector, @NonNull @NonNull Function<? super @NonNull T,? extends @NonNull V> valueSelector)
      Returns a Single that emits a single HashMap containing values corresponding to items emitted by the finite 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.

      Note that this operator requires the upstream to signal onComplete for the accumulated map 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 current Flowable in an unbounded manner (i.e., without applying backpressure to it).
      Scheduler:
      toMap does not operate by default on a particular Scheduler.
      Type Parameters:
      K - the key type of the Map
      V - the value type of the Map
      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:
      the new Single instance
      Throws:
      NullPointerException - if keySelector or valueSelector is null
      See Also:
    • toMap

      @CheckReturnValue @NonNull @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final <@NonNull K, @NonNull V> @NonNull Single<Map<K,V>> toMap(@NonNull @NonNull Function<? super @NonNull T,? extends @NonNull K> keySelector, @NonNull @NonNull Function<? super @NonNull T,? extends @NonNull V> valueSelector, @NonNull @NonNull Supplier<? extends Map<@NonNull K,@NonNull 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 finite source Publisher.

      Note that this operator requires the upstream to signal onComplete for the accumulated map 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 current Flowable in an unbounded manner (i.e., without applying backpressure to it).
      Scheduler:
      toMap does not operate by default on a particular Scheduler.
      Type Parameters:
      K - the key type of the Map
      V - the value type of the Map
      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:
      the new Single instance
      Throws:
      NullPointerException - if keySelector, valueSelector or mapSupplier is null
      See Also:
    • toMultimap

      Returns a Single that emits a single HashMap that contains an ArrayList of items emitted by the finite source Publisher keyed by a specified keySelector function.

      Note that this operator requires the upstream to signal onComplete for the accumulated map 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:
      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.
      Type Parameters:
      K - the key type of the Map
      Parameters:
      keySelector - the function that extracts the key from the source items to be used as key in the HashMap
      Returns:
      the new Single instance
      Throws:
      NullPointerException - if keySelector is null
      See Also:
    • toMultimap

      @CheckReturnValue @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") @NonNull public final <@NonNull K, @NonNull V> @NonNull Single<Map<K,Collection<V>>> toMultimap(@NonNull @NonNull Function<? super @NonNull T,? extends @NonNull K> keySelector, @NonNull @NonNull Function<? super @NonNull T,? extends @NonNull 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 finite source Publisher, keyed by a specified keySelector function.

      Note that this operator requires the upstream to signal onComplete for the accumulated map 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 current Flowable in an unbounded manner (i.e., without applying backpressure to it).
      Scheduler:
      toMultimap does not operate by default on a particular Scheduler.
      Type Parameters:
      K - the key type of the Map
      V - the value type of the Map
      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:
      the new Single instance
      Throws:
      NullPointerException - if keySelector or valueSelector is null
      See Also:
    • toMultimap

      @CheckReturnValue @NonNull @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final <@NonNull K, @NonNull V> @NonNull Single<Map<K,Collection<V>>> toMultimap(@NonNull @NonNull Function<? super @NonNull T,? extends @NonNull K> keySelector, @NonNull @NonNull Function<? super @NonNull T,? extends @NonNull V> valueSelector, @NonNull @NonNull Supplier<? extends Map<@NonNull K,Collection<@NonNull V>>> mapSupplier, @NonNull @NonNull Function<? super @NonNull K,? extends Collection<? super @NonNull 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 finite source Publisher, and keyed by the keySelector function.

      Note that this operator requires the upstream to signal onComplete for the accumulated map 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 current Flowable in an unbounded manner (i.e., without applying backpressure to it).
      Scheduler:
      toMultimap does not operate by default on a particular Scheduler.
      Type Parameters:
      K - the key type of the Map
      V - the value type of the Map
      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:
      the new Single instance
      Throws:
      NullPointerException - if keySelector, valueSelector, mapSupplier or collectionFactory is null
      See Also:
    • toMultimap

      @CheckReturnValue @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") @NonNull public final <@NonNull K, @NonNull V> @NonNull Single<Map<K,Collection<V>>> toMultimap(@NonNull @NonNull Function<? super @NonNull T,? extends @NonNull K> keySelector, @NonNull @NonNull Function<? super @NonNull T,? extends @NonNull V> valueSelector, @NonNull @NonNull Supplier<Map<@NonNull K,Collection<@NonNull 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 finite source Publisher and keyed by the keySelector function.

      Note that this operator requires the upstream to signal onComplete for the accumulated map 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 current Flowable in an unbounded manner (i.e., without applying backpressure to it).
      Scheduler:
      toMultimap does not operate by default on a particular Scheduler.
      Type Parameters:
      K - the key type of the Map
      V - the value type of the Map
      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:
      the new Single instance
      Throws:
      NullPointerException - if keySelector, valueSelector or mapSupplier is null
      See Also:
    • 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
      Since:
      2.0
    • toSortedList

      Returns a Single that emits a List that contains the items emitted by the finite 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 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 current Flowable in an unbounded manner (i.e., without applying backpressure to it).
      Scheduler:
      toSortedList does not operate by default on a particular Scheduler.
      Returns:
      the new Single instance
      See Also:
    • toSortedList

      Returns a Single that emits a List that contains the items emitted by the finite source Publisher, in a sorted order based on a specified comparison function.

      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 current Flowable 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 current Flowable and returns an int that indicates their sort order
      Returns:
      the new Single instance
      Throws:
      NullPointerException - if comparator is null
      See Also:
    • toSortedList

      @CheckReturnValue @NonNull @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") public final @NonNull Single<List<T>> toSortedList(@NonNull @NonNull Comparator<? super @NonNull T> comparator, int capacityHint)
      Returns a Single that emits a List that contains the items emitted by the finite source Publisher, in a sorted order based on a specified comparison function.

      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 current Flowable 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 current Flowable and returns an int that indicates their sort order
      capacityHint - the initial capacity of the ArrayList used to accumulate items before sorting
      Returns:
      the new Single instance
      Throws:
      NullPointerException - if comparator is null
      IllegalArgumentException - if capacityHint is non-positive
      Since:
      2.0
      See Also:
    • toSortedList

      @CheckReturnValue @BackpressureSupport(UNBOUNDED_IN) @SchedulerSupport("none") @NonNull public final @NonNull Single<List<T>> toSortedList(int capacityHint)
      Returns a Single that emits a List that contains the items emitted by the finite 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 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 current Flowable 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:
      the new Single instance
      Throws:
      IllegalArgumentException - if capacityHint is non-positive
      Since:
      2.0
      See Also:
    • unsubscribeOn

      Cancels the current Flowable asynchronously by invoking Subscription.cancel() on the specified Scheduler.

      The operator suppresses signals from the current Flowable immediately when the downstream cancels the flow because the actual cancellation itself could take an arbitrary amount of time to take effect and make the flow stop producing items.

      Backpressure:
      The operator doesn't interfere with backpressure which is determined by the current Flowable's backpressure behavior.
      Scheduler:
      You specify which Scheduler this operator will use.
      Parameters:
      scheduler - the Scheduler to perform cancellation actions on
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if scheduler is null
      See Also:
    • window

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

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window will only contain one element. The behavior is a trade-off between no-dataloss and ensuring upstream cancellation can happen.

      Backpressure:
      The operator honors backpressure of its inner and outer subscribers, however, the inner Flowable 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:
      the new Flowable instance
      Throws:
      IllegalArgumentException - if count is non-positive
      See Also:
    • window

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final @NonNull Flowable<Flowable<T>> window(long count, long skip)
      Returns a Flowable that emits windows of items it collects from the current Flowable. The resulting Flowable emits windows every skip items, each containing no more than count items. When the current Flowable completes or encounters an error, the resulting Flowable emits the current window and propagates the notification from the current Flowable.

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window may not contain any elements. In this case, subsequent elements will be dropped until the condition for the next window boundary is satisfied. The behavior is a trade-off between no-dataloss and ensuring upstream cancellation can happen under some race conditions.

      Backpressure:
      The operator honors backpressure of its inner and outer subscribers, however, the inner Flowable 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:
      the new Flowable instance
      Throws:
      IllegalArgumentException - if count or skip is non-positive
      See Also:
    • window

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final @NonNull Flowable<Flowable<T>> window(long count, long skip, int bufferSize)
      Returns a Flowable that emits windows of items it collects from the current Flowable. The resulting Flowable emits windows every skip items, each containing no more than count items. When the current Flowable completes or encounters an error, the resulting Flowable emits the current window and propagates the notification from the current Flowable.

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window may not contain any elements. In this case, subsequent elements will be dropped until the condition for the next window boundary is satisfied. The behavior is a trade-off between no-dataloss and ensuring upstream cancellation can happen under some race conditions.

      Backpressure:
      The operator honors backpressure of its inner and outer subscribers, however, the inner Flowable 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:
      the new Flowable instance
      Throws:
      IllegalArgumentException - if count, skip or bufferSize is non-positive
      See Also:
    • window

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<Flowable<T>> window(long timespan, long timeskip, @NonNull @NonNull TimeUnit unit)
      Returns a Flowable that emits windows of items it collects from the current Flowable. The resulting Flowable 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 current Flowable completes or encounters an error, the resulting Flowable emits the current window and propagates the notification from the current Flowable.

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window may not contain any elements. In this case, subsequent elements will be dropped until the condition for the next window boundary is satisfied. The behavior is a trade-off for ensuring upstream cancellation can happen under some race conditions.

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner. The resulting Flowable doesn't support backpressure as it uses time to control the creation of windows. The emitted inner Flowables 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • window

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("custom") @NonNull public final @NonNull Flowable<Flowable<T>> window(long timespan, long timeskip, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler)
      Returns a Flowable that emits windows of items it collects from the current Flowable. The resulting Flowable 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 current Flowable completes or encounters an error, the resulting Flowable emits the current window and propagates the notification from the current Flowable.

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window may not contain any elements. In this case, subsequent elements will be dropped until the condition for the next window boundary is satisfied. The behavior is a trade-off for ensuring upstream cancellation can happen under some race conditions.

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner. The resulting Flowable doesn't support backpressure as it uses time to control the creation of windows. The returned inner Flowables 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • window

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("custom") public final @NonNull Flowable<Flowable<T>> window(long timespan, long timeskip, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, int bufferSize)
      Returns a Flowable that emits windows of items it collects from the current Flowable. The resulting Flowable 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 current Flowable completes or encounters an error, the resulting Flowable emits the current window and propagates the notification from the current Flowable.

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window may not contain any elements. In this case, subsequent elements will be dropped until the condition for the next window boundary is satisfied. The behavior is a trade-off for ensuring upstream cancellation can happen under some race conditions.

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner. The resulting Flowable doesn't support backpressure as it uses time to control the creation of windows. The returned inner Flowables 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      IllegalArgumentException - if timespan, timeskip or bufferSize is non-positive
      See Also:
    • window

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<Flowable<T>> window(long timespan, @NonNull @NonNull TimeUnit unit)
      Returns a Flowable that emits windows of items it collects from the current Flowable. The resulting Flowable emits connected, non-overlapping windows, each of a fixed duration specified by the timespan argument. When the current Flowable completes or encounters an error, the resulting Flowable emits the current window and propagates the notification from the current Flowable.

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window may not contain any elements. In this case, subsequent elements will be dropped until the condition for the next window boundary is satisfied. The behavior is a trade-off for ensuring upstream cancellation can happen under some race conditions.

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner. The resulting Flowable doesn't support backpressure as it uses time to control the creation of windows. The emitted inner Flowables 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      See Also:
    • window

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<Flowable<T>> window(long timespan, @NonNull @NonNull TimeUnit unit, long count)
      Returns a Flowable that emits windows of items it collects from the current Flowable. The resulting Flowable 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 current Flowable completes or encounters an error, the resulting Flowable emits the current window and propagates the notification from the current Flowable.

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window may not contain any elements. In this case, subsequent elements will be dropped until the condition for the next window boundary is satisfied. The behavior is a trade-off for ensuring upstream cancellation can happen under some race conditions.

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner. The resulting Flowable doesn't support backpressure as it uses time to control the creation of windows. The emitted inner Flowables 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      IllegalArgumentException - if count is non-positive
      See Also:
    • window

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("io.reactivex:computation") @NonNull public final @NonNull Flowable<Flowable<T>> window(long timespan, @NonNull @NonNull TimeUnit unit, long count, boolean restart)
      Returns a Flowable that emits windows of items it collects from the current Flowable. The resulting Flowable 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 current Flowable completes or encounters an error, the resulting Flowable emits the current window and propagates the notification from the current Flowable.

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window may not contain any elements. In this case, subsequent elements will be dropped until the condition for the next window boundary is satisfied. The behavior is a trade-off for ensuring upstream cancellation can happen under some race conditions.

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner. The resulting Flowable doesn't support backpressure as it uses time to control the creation of windows. The emitted inner Flowables 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit is null
      IllegalArgumentException - if count is non-positive
      See Also:
    • window

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

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window may not contain any elements. In this case, subsequent elements will be dropped until the condition for the next window boundary is satisfied. The behavior is a trade-off for ensuring upstream cancellation can happen under some race conditions.

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner. The resulting Flowable doesn't support backpressure as it uses time to control the creation of windows. The emitted inner Flowables 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      See Also:
    • window

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("custom") @NonNull public final @NonNull Flowable<Flowable<T>> window(long timespan, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, long count)
      Returns a Flowable that emits windows of items it collects from the current Flowable. The resulting Flowable 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 current Flowable completes or encounters an error, the resulting Flowable emits the current window and propagates the notification from the current Flowable.

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window may not contain any elements. In this case, subsequent elements will be dropped until the condition for the next window boundary is satisfied. The behavior is a trade-off for ensuring upstream cancellation can happen under some race conditions.

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner. The resulting Flowable doesn't support backpressure as it uses time to control the creation of windows. The emitted inner Flowables 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      IllegalArgumentException - if count is non-positive
      See Also:
    • window

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("custom") @NonNull public final @NonNull Flowable<Flowable<T>> window(long timespan, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, long count, boolean restart)
      Returns a Flowable that emits windows of items it collects from the current Flowable. The resulting Flowable 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 current Flowable completes or encounters an error, the resulting Flowable emits the current window and propagates the notification from the current Flowable.

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window may not contain any elements. In this case, subsequent elements will be dropped until the condition for the next window boundary is satisfied. The behavior is a trade-off for ensuring upstream cancellation can happen under some race conditions.

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner. The resulting Flowable doesn't support backpressure as it uses time to control the creation of windows. The emitted inner Flowables 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      IllegalArgumentException - if count is non-positive
      See Also:
    • window

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("custom") public final @NonNull Flowable<Flowable<T>> window(long timespan, @NonNull @NonNull TimeUnit unit, @NonNull @NonNull Scheduler scheduler, long count, boolean restart, int bufferSize)
      Returns a Flowable that emits windows of items it collects from the current Flowable. The resulting Flowable 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 current Flowable completes or encounters an error, the resulting Flowable emits the current window and propagates the notification from the current Flowable.

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window may not contain any elements. In this case, subsequent elements will be dropped until the condition for the next window boundary is satisfied. The behavior is a trade-off for ensuring upstream cancellation can happen under some race conditions.

      Backpressure:
      The operator consumes the current Flowable in an unbounded manner. The resulting Flowable doesn't support backpressure as it uses time to control the creation of windows. The emitted inner Flowables 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:
      the new Flowable instance
      Throws:
      NullPointerException - if unit or scheduler is null
      IllegalArgumentException - if count, timespan or bufferSize is non-positive
      See Also:
    • window

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("none") @NonNull public final <@NonNull B> @NonNull Flowable<Flowable<T>> window(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull B> boundaryIndicator)
      Returns a Flowable that emits non-overlapping windows of items it collects from the current Flowable where the boundary of each window is determined by the items emitted from a specified boundary-governing Publisher.

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window may not contain any elements. In this case, subsequent elements will be dropped until the condition for the next window boundary is satisfied. The behavior is a trade-off for ensuring upstream cancellation can happen under some race conditions.

      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.
      Type Parameters:
      B - the window element type (ignored)
      Parameters:
      boundaryIndicator - a Publisher whose emitted items close and open windows
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if boundaryIndicator is null
      See Also:
    • window

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("none") public final <@NonNull B> @NonNull Flowable<Flowable<T>> window(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull B> boundaryIndicator, int bufferSize)
      Returns a Flowable that emits non-overlapping windows of items it collects from the current Flowable where the boundary of each window is determined by the items emitted from a specified boundary-governing Publisher.

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window may not contain any elements. In this case, subsequent elements will be dropped until the condition for the next window boundary is satisfied. The behavior is a trade-off for ensuring upstream cancellation can happen under some race conditions.

      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.
      Type Parameters:
      B - the window element type (ignored)
      Parameters:
      boundaryIndicator - a Publisher whose emitted items close and open windows
      bufferSize - the capacity hint for the buffer in the inner windows
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if boundaryIndicator is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • window

      @CheckReturnValue @BackpressureSupport(ERROR) @SchedulerSupport("none") @NonNull public final <@NonNull U, @NonNull V> @NonNull Flowable<Flowable<T>> window(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull U> openingIndicator, @NonNull @NonNull Function<? super @NonNull U,@NonNull ? extends org.reactivestreams.Publisher<@NonNull V>> closingIndicator)
      Returns a Flowable that emits windows of items it collects from the current Flowable. The resulting Flowable emits windows that contain those items emitted by the current Flowable between the time when the windowOpenings Publisher emits an item and when the Publisher returned by closingSelector emits an item.

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window may not contain any elements. In this case, subsequent elements will be dropped until the condition for the next window boundary is satisfied. The behavior is a trade-off for ensuring upstream cancellation can happen under some race conditions.

      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.
      Type Parameters:
      U - the element type of the window-opening Publisher
      V - the element type of the window-closing Publishers
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if openingIndicator or closingIndicator is null
      See Also:
    • window

      @CheckReturnValue @NonNull @BackpressureSupport(ERROR) @SchedulerSupport("none") public final <@NonNull U, @NonNull V> @NonNull Flowable<Flowable<T>> window(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull U> openingIndicator, @NonNull @NonNull Function<? super @NonNull U,@NonNull ? extends org.reactivestreams.Publisher<@NonNull V>> closingIndicator, int bufferSize)
      Returns a Flowable that emits windows of items it collects from the current Flowable. The resulting Flowable emits windows that contain those items emitted by the current Flowable between the time when the windowOpenings Publisher emits an item and when the Publisher returned by closingSelector emits an item.

      Note that ignoring windows or subscribing later (i.e., on another thread) will result in so-called window abandonment where a window may not contain any elements. In this case, subsequent elements will be dropped until the condition for the next window boundary is satisfied. The behavior is a trade-off for ensuring upstream cancellation can happen under some race conditions.

      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.
      Type Parameters:
      U - the element type of the window-opening Publisher
      V - the element type of the window-closing Publishers
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if openingIndicator or closingIndicator is null
      IllegalArgumentException - if bufferSize is non-positive
      See Also:
    • withLatestFrom

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") public final <@NonNull U, @NonNull R> @NonNull Flowable<R> withLatestFrom(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull U> other, @NonNull @NonNull BiFunction<? super @NonNull T,? super @NonNull U,? extends @NonNull R> combiner)
      Merges the specified Publisher into the current Flowable sequence by using the resultSelector function only when the current Flowable (this instance) emits an item.

      Note that this operator doesn't emit anything until the other source has produced at least one value. The resulting emission only happens when the current Flowable emits (and not when the other source emits, unlike combineLatest). If the other source doesn't produce any value and just completes, the sequence is completed immediately. If the upstream completes before the other source has produced at least one value, the sequence completes without emission.

      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.
      Type Parameters:
      U - the element type of the other Publisher
      R - the result type of the combination
      Parameters:
      other - the other Publisher
      combiner - the function to call when the current Flowable emits an item and the other Publisher has already emitted an item, to generate the item to be emitted by the resulting Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other or combiner is null
      Since:
      2.0
      See Also:
    • withLatestFrom

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") public final <@NonNull T1, @NonNull T2, @NonNull R> @NonNull Flowable<R> withLatestFrom(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<@NonNull T2> source2, @NonNull @NonNull Function3<? super @NonNull T,? super @NonNull T1,? super @NonNull T2,@NonNull R> combiner)
      Combines the value emission from the current Flowable 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 the current Flowable 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. If the upstream completes before all other sources have produced at least one value, the sequence completes without emission.

      Backpressure:
      This operator is a pass-through for backpressure behavior between the current Flowable 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.
      Type Parameters:
      T1 - the first other source's value type
      T2 - the second other source's value type
      R - the result value type
      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 Flowable instance
      Throws:
      NullPointerException - if source1, source2 or combiner is null
      Since:
      2.0
    • withLatestFrom

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") public final <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull R> @NonNull Flowable<R> withLatestFrom(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<@NonNull T2> source2, @NonNull @NonNull org.reactivestreams.Publisher<@NonNull T3> source3, @NonNull @NonNull Function4<? super @NonNull T,? super @NonNull T1,? super @NonNull T2,? super @NonNull T3,@NonNull R> combiner)
      Combines the value emission from the current Flowable 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 the current Flowable 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. If the upstream completes before all other sources have produced at least one value, the sequence completes without emission.

      Backpressure:
      This operator is a pass-through for backpressure behavior between the current Flowable 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.
      Type Parameters:
      T1 - the first other source's value type
      T2 - the second other source's value type
      T3 - the third other source's value type
      R - the result value type
      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 Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3 or combiner is null
      Since:
      2.0
    • withLatestFrom

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") public final <@NonNull T1, @NonNull T2, @NonNull T3, @NonNull T4, @NonNull R> @NonNull Flowable<R> withLatestFrom(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull T1> source1, @NonNull @NonNull org.reactivestreams.Publisher<@NonNull T2> source2, @NonNull @NonNull org.reactivestreams.Publisher<@NonNull T3> source3, @NonNull @NonNull org.reactivestreams.Publisher<@NonNull T4> source4, @NonNull @NonNull Function5<? super @NonNull T,? super @NonNull T1,? super @NonNull T2,? super @NonNull T3,? super @NonNull T4,@NonNull R> combiner)
      Combines the value emission from the current Flowable 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 the current Flowable 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. If the upstream completes before all other sources have produced at least one value, the sequence completes without emission.

      Backpressure:
      This operator is a pass-through for backpressure behavior between the current Flowable 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.
      Type Parameters:
      T1 - the first other source's value type
      T2 - the second other source's value type
      T3 - the third other source's value type
      T4 - the fourth other source's value type
      R - the result value type
      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 Flowable instance
      Throws:
      NullPointerException - if source1, source2, source3, source4 or combiner is null
      Since:
      2.0
    • withLatestFrom

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> withLatestFrom(@NonNull @NonNull org.reactivestreams.Publisher<@NonNull ?>[] others, @NonNull @NonNull Function<? super Object[],@NonNull R> combiner)
      Combines the value emission from the current Flowable 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 the current Flowable 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. If the upstream completes before all other sources have produced at least one value, the sequence completes without emission.

      Backpressure:
      This operator is a pass-through for backpressure behavior between the current Flowable 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.
      Type Parameters:
      R - the result value type
      Parameters:
      others - the array of other sources
      combiner - the function called with an array of values from each participating Publisher
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if others or combiner is null
      Since:
      2.0
    • withLatestFrom

      @CheckReturnValue @NonNull @BackpressureSupport(PASS_THROUGH) @SchedulerSupport("none") public final <@NonNull R> @NonNull Flowable<R> withLatestFrom(@NonNull @NonNull Iterable<@NonNull ? extends org.reactivestreams.Publisher<@NonNull ?>> others, @NonNull @NonNull Function<? super Object[],@NonNull R> combiner)
      Combines the value emission from the current Flowable 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 the current Flowable 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. If the upstream completes before all other sources have produced at least one value, the sequence completes without emission.

      Backpressure:
      This operator is a pass-through for backpressure behavior between the current Flowable 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.
      Type Parameters:
      R - the result value type
      Parameters:
      others - the iterable of other sources
      combiner - the function called with an array of values from each participating Publisher
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if others or combiner is null
      Since:
      2.0
    • zipWith

      Returns a Flowable that emits items that are the result of applying a specified function to pairs of values, one each from the current Flowable and a specified Iterable sequence.

      Note that the other Iterable is evaluated as items are observed from the current Flowable; 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.
      Type Parameters:
      U - the type of items in the other Iterable
      R - the type of items emitted by the resulting Flowable
      Parameters:
      other - the Iterable sequence
      zipper - a function that combines the pairs of items from the current Flowable and the Iterable to generate the items to be emitted by the resulting Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other or zipper is null
      See Also:
    • zipWith

      @CheckReturnValue @NonNull @BackpressureSupport(FULL) @SchedulerSupport("none") public final <@NonNull U, @NonNull R> @NonNull Flowable<R> zipWith(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull U> other, @NonNull @NonNull BiFunction<? super @NonNull T,? super @NonNull U,? extends @NonNull 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 current Flowable and another specified Publisher.

      The operator subscribes to its sources in the order they are specified and completes eagerly if one of the sources is shorter than the rest while canceling 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.
      Type Parameters:
      U - the type of items emitted by the other Publisher
      R - the type of items emitted by the resulting Flowable
      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 Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other or zipper is null
      See Also:
    • zipWith

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull U, @NonNull R> @NonNull Flowable<R> zipWith(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull U> other, @NonNull @NonNull BiFunction<? super @NonNull T,? super @NonNull U,? extends @NonNull 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 current Flowable and another specified Publisher.

      The operator subscribes to its sources in the order they are specified and completes eagerly if one of the sources is shorter than the rest while canceling 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.
      Type Parameters:
      U - the type of items emitted by the other Publisher
      R - the type of items emitted by the resulting Flowable
      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 Flowable
      delayError - if true, errors from the current Flowable or the other Publisher is delayed until both terminate
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if other or zipper is null
      Since:
      2.0
      See Also:
    • zipWith

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull U, @NonNull R> @NonNull Flowable<R> zipWith(@NonNull @NonNull org.reactivestreams.Publisher<? extends @NonNull U> other, @NonNull @NonNull BiFunction<? super @NonNull T,? super @NonNull U,? extends @NonNull 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 current Flowable and another specified Publisher.

      The operator subscribes to its sources in the order they are specified and completes eagerly if one of the sources is shorter than the rest while canceling 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.
      Type Parameters:
      U - the type of items emitted by the other Publisher
      R - the type of items emitted by the resulting Flowable
      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 Flowable
      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:
      the new Flowable instance
      Throws:
      NullPointerException - if other or zipper is null
      IllegalArgumentException - if bufferSize is non-positive
      Since:
      2.0
      See Also:
    • 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
      Since:
      2.0
    • test

      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
      Since:
      2.0
    • test

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final @NonNull 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 canceled before the subscription?
      Returns:
      the new TestSubscriber instance
      Since:
      2.0
    • fromOptional

      Converts the existing value of the provided optional into a just(Object) or an empty optional into an empty() Flowable instance.

      Note that the operator takes an already instantiated optional reference and does not by any means create this original optional. If the optional is to be created per consumer upon subscription, use defer(Supplier) around fromOptional:

      
       Flowable.defer(() -> Flowable.fromOptional(createOptional()));
       
      Backpressure:
      The returned Flowable supports backpressure.
      Scheduler:
      fromOptional does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the element type of the optional value
      Parameters:
      optional - the optional value to convert into a Flowable
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if optional is null
      Since:
      3.0.0
      See Also:
    • fromCompletionStage

      Signals the completion value or error of the given (hot) CompletionStage-based asynchronous calculation.

      Note that the operator takes an already instantiated, running or terminated CompletionStage. If the CompletionStage is to be created per consumer upon subscription, use defer(Supplier) around fromCompletionStage:

      
       Flowable.defer(() -> Flowable.fromCompletionStage(createCompletionStage()));
       

      If the CompletionStage completes with null, a NullPointerException is signaled.

      Canceling the flow can't cancel the execution of the CompletionStage because CompletionStage itself doesn't support cancellation. Instead, the operator detaches from the CompletionStage.

      Backpressure:
      The returned Flowable supports backpressure and caches the completion value until the downstream is ready to receive it.
      Scheduler:
      fromCompletionStage does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the element type of the CompletionStage
      Parameters:
      stage - the CompletionStage to convert to Flowable and signal its terminal value or error
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if stage is null
      Since:
      3.0.0
    • fromStream

      Converts a Stream into a finite Flowable and emits its items in the sequence.

      The operator closes the Stream upon cancellation and when it terminates. Any exceptions raised when closing a Stream are routed to the global error handler (RxJavaPlugins.onError(Throwable). If a Stream should not be closed, turn it into an Iterable and use fromIterable(Iterable):

      
       Stream<T> stream = ...
       Flowable.fromIterable(stream::iterator);
       

      Note that Streams can be consumed only once; any subsequent attempt to consume a Stream will result in an IllegalStateException.

      Primitive streams are not supported and items have to be boxed manually (e.g., via IntStream.boxed()):

      
       IntStream intStream = IntStream.rangeClosed(1, 10);
       Flowable.fromStream(intStream.boxed());
       

      Stream does not support concurrent usage so creating and/or consuming the same instance multiple times from multiple threads can lead to undefined behavior.

      Backpressure:
      The operator honors backpressure from downstream and iterates the given Stream on demand (i.e., when requested).
      Scheduler:
      fromStream does not operate by default on a particular Scheduler.
      Type Parameters:
      T - the element type of the source Stream
      Parameters:
      stream - the Stream of values to emit
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if stream is null
      Since:
      3.0.0
      See Also:
    • mapOptional

      Maps each upstream value into an Optional and emits the contained item if not empty.

      Backpressure:
      The operator is a pass-through for downstream requests but issues request(1) whenever the mapped Optional is empty.
      Scheduler:
      mapOptional does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the non-null output type
      Parameters:
      mapper - the function that receives the upstream item and should return a non-empty Optional to emit as the output or an empty Optional to skip to the next upstream value
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      3.0.0
      See Also:
    • collect

      Collects the finite upstream's values into a container via a Stream Collector callback set and emits it as the success result.

      Backpressure:
      The operator consumes the upstream in an unbounded manner.
      Scheduler:
      collect does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the non-null result type
      A - the intermediate container type used for the accumulation
      Parameters:
      collector - the interface defining the container supplier, accumulator and finisher functions; see Collectors for some standard implementations
      Returns:
      the new Single instance
      Throws:
      NullPointerException - if collector is null
      Since:
      3.0.0
      See Also:
    • firstStage

      Signals the first upstream item (or the default item if the upstream is empty) via a CompletionStage.

      The upstream can be canceled by converting the resulting CompletionStage into CompletableFuture via CompletionStage.toCompletableFuture() and calling CompletableFuture.cancel(boolean) on it. The upstream will be also cancelled if the resulting CompletionStage is converted to and completed manually by CompletableFuture.complete(Object) or CompletableFuture.completeExceptionally(Throwable).

      CompletionStages don't have a notion of emptiness and allow nulls, therefore, one can either use a defaultItem of null or turn the flow into a sequence of Optionals and default to Optional.empty():

      
       CompletionStage<Optional<T>> stage = source.map(Optional::of).firstStage(Optional.empty());
       
      Backpressure:
      The operator requests one item from upstream and then when received, cancels the upstream.
      Scheduler:
      firstStage does not operate by default on a particular Scheduler.
      Parameters:
      defaultItem - the item to signal if the upstream is empty
      Returns:
      the new CompletionStage instance
      Since:
      3.0.0
      See Also:
    • singleStage

      Signals the only expected upstream item (or the default item if the upstream is empty) or signals IllegalArgumentException if the upstream has more than one item via a CompletionStage.

      The upstream can be canceled by converting the resulting CompletionStage into CompletableFuture via CompletionStage.toCompletableFuture() and calling CompletableFuture.cancel(boolean) on it. The upstream will be also cancelled if the resulting CompletionStage is converted to and completed manually by CompletableFuture.complete(Object) or CompletableFuture.completeExceptionally(Throwable).

      CompletionStages don't have a notion of emptiness and allow nulls, therefore, one can either use a defaultItem of null or turn the flow into a sequence of Optionals and default to Optional.empty():

      
       CompletionStage<Optional<T>> stage = source.map(Optional::of).singleStage(Optional.empty());
       
      Backpressure:
      The operator requests two items from upstream and then when more than one item is received, cancels the upstream.
      Scheduler:
      singleStage does not operate by default on a particular Scheduler.
      Parameters:
      defaultItem - the item to signal if the upstream is empty
      Returns:
      the new CompletionStage instance
      Since:
      3.0.0
      See Also:
    • lastStage

      Signals the last upstream item (or the default item if the upstream is empty) via a CompletionStage.

      The upstream can be canceled by converting the resulting CompletionStage into CompletableFuture via CompletionStage.toCompletableFuture() and calling CompletableFuture.cancel(boolean) on it. The upstream will be also cancelled if the resulting CompletionStage is converted to and completed manually by CompletableFuture.complete(Object) or CompletableFuture.completeExceptionally(Throwable).

      CompletionStages don't have a notion of emptiness and allow nulls, therefore, one can either use a defaultItem of null or turn the flow into a sequence of Optionals and default to Optional.empty():

      
       CompletionStage<Optional<T>> stage = source.map(Optional::of).lastStage(Optional.empty());
       
      Backpressure:
      The operator requests an unbounded number of items from the upstream.
      Scheduler:
      lastStage does not operate by default on a particular Scheduler.
      Parameters:
      defaultItem - the item to signal if the upstream is empty
      Returns:
      the new CompletionStage instance
      Since:
      3.0.0
      See Also:
    • firstOrErrorStage

      Signals the first upstream item or a NoSuchElementException if the upstream is empty via a CompletionStage.

      The upstream can be canceled by converting the resulting CompletionStage into CompletableFuture via CompletionStage.toCompletableFuture() and calling CompletableFuture.cancel(boolean) on it. The upstream will be also cancelled if the resulting CompletionStage is converted to and completed manually by CompletableFuture.complete(Object) or CompletableFuture.completeExceptionally(Throwable).

      Backpressure:
      The operator requests one item from upstream and then when received, cancels the upstream.
      Scheduler:
      firstOrErrorStage does not operate by default on a particular Scheduler.
      Returns:
      the new CompletionStage instance
      Since:
      3.0.0
      See Also:
    • singleOrErrorStage

      Signals the only expected upstream item, a NoSuchElementException if the upstream is empty or signals IllegalArgumentException if the upstream has more than one item via a CompletionStage.

      The upstream can be canceled by converting the resulting CompletionStage into CompletableFuture via CompletionStage.toCompletableFuture() and calling CompletableFuture.cancel(boolean) on it. The upstream will be also cancelled if the resulting CompletionStage is converted to and completed manually by CompletableFuture.complete(Object) or CompletableFuture.completeExceptionally(Throwable).

      Backpressure:
      The operator requests two items from upstream and then when more than one item is received, cancels the upstream.
      Scheduler:
      singleOrErrorStage does not operate by default on a particular Scheduler.
      Returns:
      the new CompletionStage instance
      Since:
      3.0.0
      See Also:
    • lastOrErrorStage

      Signals the last upstream item or a NoSuchElementException if the upstream is empty via a CompletionStage.

      The upstream can be canceled by converting the resulting CompletionStage into CompletableFuture via CompletionStage.toCompletableFuture() and calling CompletableFuture.cancel(boolean) on it. The upstream will be also cancelled if the resulting CompletionStage is converted to and completed manually by CompletableFuture.complete(Object) or CompletableFuture.completeExceptionally(Throwable).

      Backpressure:
      The operator requests an unbounded number of items from the upstream.
      Scheduler:
      lastOrErrorStage does not operate by default on a particular Scheduler.
      Returns:
      the new CompletionStage instance
      Since:
      3.0.0
      See Also:
    • blockingStream

      Creates a sequential Stream to consume or process this Flowable in a blocking manner via the Java Stream API.

      Cancellation of the upstream is done via BaseStream.close(), therefore, it is strongly recommended the consumption is performed within a try-with-resources construct:

      
       Flowable<Integer> source = Flowable.range(1, 10)
              .subscribeOn(Schedulers.computation());
      
       try (Stream<Integer> stream = source.blockingStream()) {
           stream.limit(3).forEach(System.out::println);
       }
       
      Backpressure:
      The operator requests bufferSize() amount upfront and 75% of it after each 75% of the amount received.
      Scheduler:
      blockingStream does not operate by default on a particular Scheduler.
      Returns:
      the new Stream instance
      Since:
      3.0.0
      See Also:
    • blockingStream

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final @NonNull Stream<T> blockingStream(int prefetch)
      Creates a sequential Stream to consume or process this Flowable in a blocking manner via the Java Stream API.

      Cancellation of the upstream is done via BaseStream.close(), therefore, it is strongly recommended the consumption is performed within a try-with-resources construct:

      
       Flowable<Integer> source = Flowable.range(1, 10)
              .subscribeOn(Schedulers.computation());
      
       try (Stream<Integer> stream = source.blockingStream(4)) {
           stream.limit(3).forEach(System.out::println);
       }
       
      Backpressure:
      The operator requests the given prefetch amount upfront and 75% of it after each 75% of the amount received.
      Scheduler:
      blockingStream does not operate by default on a particular Scheduler.
      Parameters:
      prefetch - the number of items to request from the upstream to limit the number of in-flight items and item generation.
      Returns:
      the new Stream instance
      Throws:
      IllegalArgumentException - if prefetch is non-positive
      Since:
      3.0.0
    • concatMapStream

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> concatMapStream(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends Stream<? extends @NonNull R>> mapper)
      Maps each upstream item into a Stream and emits the Stream's items to the downstream in a sequential fashion.

      Due to the blocking and sequential nature of Java Streams, the streams are mapped and consumed in a sequential fashion without interleaving (unlike a more general flatMap(Function)). Therefore, flatMapStream and concatMapStream are identical operators and are provided as aliases.

      The operator closes the Stream upon cancellation and when it terminates. Any exceptions raised when closing a Stream are routed to the global error handler (RxJavaPlugins.onError(Throwable). If a Stream should not be closed, turn it into an Iterable and use concatMapIterable(Function):

      
       source.concatMapIterable(v -> createStream(v)::iterator);
       

      Note that Streams can be consumed only once; any subsequent attempt to consume a Stream will result in an IllegalStateException.

      Primitive streams are not supported and items have to be boxed manually (e.g., via IntStream.boxed()):

      
       source.concatMapStream(v -> IntStream.rangeClosed(v + 1, v + 10).boxed());
       

      Stream does not support concurrent usage so creating and/or consuming the same instance multiple times from multiple threads can lead to undefined behavior.

      Backpressure:
      The operator honors the downstream backpressure and consumes the inner stream only on demand. The operator prefetches bufferSize() items of the upstream (then 75% of it after the 75% received) and caches them until they are ready to be mapped into Streams after the current Stream has been consumed.
      Scheduler:
      concatMapStream does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the element type of the Streams and the result
      Parameters:
      mapper - the function that receives an upstream item and should return a Stream whose elements will be emitted to the downstream
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      3.0.0
      See Also:
    • concatMapStream

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> concatMapStream(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends Stream<? extends @NonNull R>> mapper, int prefetch)
      Maps each upstream item into a Stream and emits the Stream's items to the downstream in a sequential fashion.

      Due to the blocking and sequential nature of Java Streams, the streams are mapped and consumed in a sequential fashion without interleaving (unlike a more general flatMap(Function)). Therefore, flatMapStream and concatMapStream are identical operators and are provided as aliases.

      The operator closes the Stream upon cancellation and when it terminates. Any exceptions raised when closing a Stream are routed to the global error handler (RxJavaPlugins.onError(Throwable). If a Stream should not be closed, turn it into an Iterable and use concatMapIterable(Function, int):

      
       source.concatMapIterable(v -> createStream(v)::iterator, 32);
       

      Note that Streams can be consumed only once; any subsequent attempt to consume a Stream will result in an IllegalStateException.

      Primitive streams are not supported and items have to be boxed manually (e.g., via IntStream.boxed()):

      
       source.concatMapStream(v -> IntStream.rangeClosed(v + 1, v + 10).boxed(), 32);
       

      Stream does not support concurrent usage so creating and/or consuming the same instance multiple times from multiple threads can lead to undefined behavior.

      Backpressure:
      The operator honors the downstream backpressure and consumes the inner stream only on demand. The operator prefetches the given amount of upstream items and caches them until they are ready to be mapped into Streams after the current Stream has been consumed.
      Scheduler:
      concatMapStream does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the element type of the Streams and the result
      Parameters:
      mapper - the function that receives an upstream item and should return a Stream whose elements will be emitted to the downstream
      prefetch - the number of upstream items to request upfront, then 75% of this amount after each 75% upstream items received
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if prefetch is non-positive
      Since:
      3.0.0
      See Also:
    • flatMapStream

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> flatMapStream(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends Stream<? extends @NonNull R>> mapper)
      Maps each upstream item into a Stream and emits the Stream's items to the downstream in a sequential fashion.

      Due to the blocking and sequential nature of Java Streams, the streams are mapped and consumed in a sequential fashion without interleaving (unlike a more general flatMap(Function)). Therefore, flatMapStream and concatMapStream are identical operators and are provided as aliases.

      The operator closes the Stream upon cancellation and when it terminates. Any exceptions raised when closing a Stream are routed to the global error handler (RxJavaPlugins.onError(Throwable). If a Stream should not be closed, turn it into an Iterable and use flatMapIterable(Function):

      
       source.flatMapIterable(v -> createStream(v)::iterator);
       

      Note that Streams can be consumed only once; any subsequent attempt to consume a Stream will result in an IllegalStateException.

      Primitive streams are not supported and items have to be boxed manually (e.g., via IntStream.boxed()):

      
       source.flatMapStream(v -> IntStream.rangeClosed(v + 1, v + 10).boxed());
       

      Stream does not support concurrent usage so creating and/or consuming the same instance multiple times from multiple threads can lead to undefined behavior.

      Backpressure:
      The operator honors the downstream backpressure and consumes the inner stream only on demand. The operator prefetches bufferSize() items of the upstream (then 75% of it after the 75% received) and caches them until they are ready to be mapped into Streams after the current Stream has been consumed.
      Scheduler:
      flatMapStream does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the element type of the Streams and the result
      Parameters:
      mapper - the function that receives an upstream item and should return a Stream whose elements will be emitted to the downstream
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      Since:
      3.0.0
      See Also:
    • flatMapStream

      @CheckReturnValue @BackpressureSupport(FULL) @SchedulerSupport("none") @NonNull public final <@NonNull R> @NonNull Flowable<R> flatMapStream(@NonNull @NonNull Function<? super @NonNull T,@NonNull ? extends Stream<? extends @NonNull R>> mapper, int prefetch)
      Maps each upstream item into a Stream and emits the Stream's items to the downstream in a sequential fashion.

      Due to the blocking and sequential nature of Java Streams, the streams are mapped and consumed in a sequential fashion without interleaving (unlike a more general flatMap(Function)). Therefore, flatMapStream and concatMapStream are identical operators and are provided as aliases.

      The operator closes the Stream upon cancellation and when it terminates. Any exceptions raised when closing a Stream are routed to the global error handler (RxJavaPlugins.onError(Throwable). If a Stream should not be closed, turn it into an Iterable and use flatMapIterable(Function, int):

      
       source.flatMapIterable(v -> createStream(v)::iterator, 32);
       

      Note that Streams can be consumed only once; any subsequent attempt to consume a Stream will result in an IllegalStateException.

      Primitive streams are not supported and items have to be boxed manually (e.g., via IntStream.boxed()):

      
       source.flatMapStream(v -> IntStream.rangeClosed(v + 1, v + 10).boxed(), 32);
       

      Stream does not support concurrent usage so creating and/or consuming the same instance multiple times from multiple threads can lead to undefined behavior.

      Backpressure:
      The operator honors the downstream backpressure and consumes the inner stream only on demand. The operator prefetches the given amount of upstream items and caches them until they are ready to be mapped into Streams after the current Stream has been consumed.
      Scheduler:
      flatMapStream does not operate by default on a particular Scheduler.
      Type Parameters:
      R - the element type of the Streams and the result
      Parameters:
      mapper - the function that receives an upstream item and should return a Stream whose elements will be emitted to the downstream
      prefetch - the number of upstream items to request upfront, then 75% of this amount after each 75% upstream items received
      Returns:
      the new Flowable instance
      Throws:
      NullPointerException - if mapper is null
      IllegalArgumentException - if prefetch is non-positive
      Since:
      3.0.0
      See Also: