Input: Maps each element of the upstream Flowable into CompletableSources subscribes to them and waits until the upstream and all CompletableSources complete . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the upstream in an unbounded manner . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Completable flatMapCompletable ( Function < ? super T , ? extends CompletableSource > mapper ) { return flatMapCompletable ( mapper , false , Integer . MAX_VALUE ) ; }


Input: 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 . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > If { [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Completable flatMapCompletable ( Function < ? super T , ? extends CompletableSource > mapper , boolean delayErrors , int maxConcurrency ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; ObjectHelper . verifyPositive ( maxConcurrency , "maxConcurrency" ) ; return RxJavaPlugins . onAssembly ( new FlowableFlatMapCompletableCompletable < T > ( this , mapper , delayErrors , maxConcurrency ) ) ; }


Input: 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 . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the upstream in an unbounded manner . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Flowable < R > flatMapMaybe ( Function < ? super T , ? extends MaybeSource < ? extends R > > mapper ) { return flatMapMaybe ( mapper , false , Integer . MAX_VALUE ) ; }


Input: 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 . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the upstream in an unbounded manner . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Flowable < R > flatMapSingle ( Function < ? super T , ? extends SingleSource < ? extends R > > mapper ) { return flatMapSingle ( mapper , false , Integer . MAX_VALUE ) ; }


Input: Maps each element of the upstream Flowable into SingleSources subscribes to at most { [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Flowable < R > flatMapSingle ( Function < ? super T , ? extends SingleSource < ? extends R > > mapper , boolean delayErrors , int maxConcurrency ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; ObjectHelper . verifyPositive ( maxConcurrency , "maxConcurrency" ) ; return RxJavaPlugins . onAssembly ( new FlowableFlatMapSingle < T , R > ( this , mapper , delayErrors , maxConcurrency ) ) ; }


Input: Subscribes to the { @link Publisher } and receives notifications for each element . <p > Alias to { @link #subscribe ( Consumer ) } <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the source { @code Publisher } in an unbounded manner ( i . e . no backpressure is applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code forEach } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . NONE ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Disposable forEach ( Consumer < ? super T > onNext ) { return subscribe ( onNext ) ; }


Input: Subscribes to the { @link Publisher } and receives notifications for each element until the onNext Predicate returns false . <p > If the Flowable emits an error it is wrapped into an { @link io . reactivex . exceptions . OnErrorNotImplementedException OnErrorNotImplementedException } and routed to the RxJavaPlugins . onError handler . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the source { @code Publisher } in an unbounded manner ( i . e . no backpressure is applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code forEachWhile } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . NONE ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Disposable forEachWhile ( Predicate < ? super T > onNext ) { return forEachWhile ( onNext , Functions . ON_ERROR_MISSING , Functions . EMPTY_ACTION ) ; }


Input: Subscribes to the { @link Publisher } and receives notifications for each element and error events until the onNext Predicate returns false . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the source { @code Publisher } in an unbounded manner ( i . e . no backpressure is applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code forEachWhile } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . NONE ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Disposable forEachWhile ( Predicate < ? super T > onNext , Consumer < ? super Throwable > onError ) { return forEachWhile ( onNext , onError , Functions . EMPTY_ACTION ) ; }


Input: Subscribes to the { @link Publisher } and receives notifications for each element and the terminal events until the onNext Predicate returns false . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the source { @code Publisher } in an unbounded manner ( i . e . no backpressure is applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code forEachWhile } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . NONE ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Disposable forEachWhile ( final Predicate < ? super T > onNext , final Consumer < ? super Throwable > onError , final Action onComplete ) { ObjectHelper . requireNonNull ( onNext , "onNext is null" ) ; ObjectHelper . requireNonNull ( onError , "onError is null" ) ; ObjectHelper . requireNonNull ( onComplete , "onComplete is null" ) ; ForEachWhileSubscriber < T > s = new ForEachWhileSubscriber < T > ( onNext , onError , onComplete ) ; subscribe ( s ) ; return s ; }


Input: Groups the items emitted by a { @code Publisher } according to a specified criterion and emits these grouped items as { @link GroupedFlowable } s . The emitted { @code GroupedPublisher } allows only a single { @link Subscriber } during its lifetime and if this { @code Subscriber } cancels before the source terminates the next emission by the source having the same key will trigger a new { @code GroupedPublisher } emission . <p > <img width = 640 height = 360 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / groupBy . png alt = > <p > <em > Note : < / em > A { @link 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 { @code GroupedPublisher } s that do not concern you . Instead you can signal to them that they may discard their buffers by applying an operator like { @link #ignoreElements } to them . <p > Note that the { @link GroupedFlowable } s should be subscribed to as soon as possible otherwise the unconsumed groups may starve other groups due to the internal backpressure coordination of the { @code groupBy } operator . Such hangs can be usually avoided by using { @link #flatMap ( Function int ) } or { @link #concatMapEager ( Function int int ) } and overriding the default maximum concurrency value to be greater or equal to the expected number of groups possibly using { @code Integer . MAX_VALUE } if the number of expected groups is unknown . [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < K > Flowable < GroupedFlowable < K , T > > groupBy ( Function < ? super T , ? extends K > keySelector ) { return groupBy ( keySelector , Functions . < T > identity ( ) , false , bufferSize ( ) ) ; }


Input: Groups the items emitted by a { @code Publisher } according to a specified criterion and emits these grouped items as { @link GroupedFlowable } s . The emitted { @code GroupedPublisher } allows only a single { @link Subscriber } during its lifetime and if this { @code Subscriber } cancels before the source terminates the next emission by the source having the same key will trigger a new { @code GroupedPublisher } emission . <p > <img width = 640 height = 360 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / groupBy . png alt = > <p > <em > Note : < / em > A { @link 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 { @code GroupedPublisher } s that do not concern you . Instead you can signal to them that they may discard their buffers by applying an operator like { @link #ignoreElements } to them . <p > Note that the { @link GroupedFlowable } s should be subscribed to as soon as possible otherwise the unconsumed groups may starve other groups due to the internal backpressure coordination of the { @code groupBy } operator . Such hangs can be usually avoided by using { @link #flatMap ( Function int ) } or { @link #concatMapEager ( Function int int ) } and overriding the default maximum concurrency value to be greater or equal to the expected number of groups possibly using { @code Integer . MAX_VALUE } if the number of expected groups is unknown . [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < K , V > Flowable < GroupedFlowable < K , V > > groupBy ( Function < ? super T , ? extends K > keySelector , Function < ? super T , ? extends V > valueSelector ) { return groupBy ( keySelector , valueSelector , false , bufferSize ( ) ) ; }


Input: Groups the items emitted by a { @code Publisher } according to a specified criterion and emits these grouped items as { @link GroupedFlowable } s . The emitted { @code GroupedPublisher } allows only a single { @link Subscriber } during its lifetime and if this { @code Subscriber } cancels before the source terminates the next emission by the source having the same key will trigger a new { @code GroupedPublisher } emission . <p > <img width = 640 height = 360 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / groupBy . png alt = > <p > <em > Note : < / em > A { @link 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 { @code GroupedPublisher } s that do not concern you . Instead you can signal to them that they may discard their buffers by applying an operator like { @link #ignoreElements } to them . <p > Note that the { @link GroupedFlowable } s should be subscribed to as soon as possible otherwise the unconsumed groups may starve other groups due to the internal backpressure coordination of the { @code groupBy } operator . Such hangs can be usually avoided by using { @link #flatMap ( Function int ) } or { @link #concatMapEager ( Function int int ) } and overriding the default maximum concurrency value to be greater or equal to the expected number of groups possibly using { @code Integer . MAX_VALUE } if the number of expected groups is unknown . [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < K , V > Flowable < GroupedFlowable < K , V > > groupBy ( Function < ? super T , ? extends K > keySelector , Function < ? super T , ? extends V > valueSelector , boolean delayError , int bufferSize ) { ObjectHelper . requireNonNull ( keySelector , "keySelector is null" ) ; ObjectHelper . requireNonNull ( valueSelector , "valueSelector is null" ) ; ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return RxJavaPlugins . onAssembly ( new FlowableGroupBy < T , K , V > ( this , keySelector , valueSelector , bufferSize , delayError , null ) ) ; }


Input: Hides the identity of this Flowable and its Subscription . <p > Allows hiding extra features such as { @link Processor } s { @link Subscriber } methods or preventing certain identity - based optimizations ( fusion ) . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator is a pass - through for backpressure the behavior is determined by the upstream s backpressure behavior . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code hide } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > @return the new Flowable instance [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > hide ( ) { return RxJavaPlugins . onAssembly ( new FlowableHide < T > ( this ) ) ; }


Input: Ignores all items emitted by the source Publisher and only calls { @code onComplete } or { @code onError } . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / ignoreElements . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator ignores backpressure as it doesn t emit any elements and consumes the source { @code Publisher } in an unbounded manner ( i . e . no backpressure is applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code ignoreElements } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Completable ignoreElements ( ) { return RxJavaPlugins . onAssembly ( new FlowableIgnoreElementsCompletable < T > ( this ) ) ; }


Input: Returns a Single that emits { @code true } if the source Publisher is empty otherwise { @code false } . <p > In Rx . Net this is negated as the { @code any } Subscriber but we renamed this in RxJava to better match Java naming idioms . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / isEmpty . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and consumes the source { @code Publisher } in an unbounded manner ( i . e . without applying backpressure ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code isEmpty } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < Boolean > isEmpty ( ) { return all ( Functions . alwaysFalse ( ) ) ; }


Input: Returns a Maybe that emits the last item emitted by this Flowable or completes if this Flowable is empty . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / last . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and consumes the source { @code Publisher } in an unbounded manner ( i . e . without applying backpressure ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code lastElement } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > lastElement ( ) { return RxJavaPlugins . onAssembly ( new FlowableLastMaybe < T > ( this ) ) ; }


Input: Returns a Single that emits only the last item emitted by this Flowable or signals a { @link NoSuchElementException } if this Flowable is empty . <p > <img width = 640 height = 236 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / lastOrError . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and consumes the source { @code Publisher } in an unbounded manner ( i . e . without applying backpressure ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code lastOrError } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > lastOrError ( ) { return RxJavaPlugins . onAssembly ( new FlowableLastSingle < T > ( this , null ) ) ; }


Input: 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 . <p > The operator requests at most the given { [CODESPLIT] @ BackpressureSupport ( BackpressureKind . SPECIAL ) @ SchedulerSupport ( SchedulerSupport . NONE ) @ CheckReturnValue public final Flowable < T > limit ( long count ) { if ( count < 0 ) { throw new IllegalArgumentException ( "count >= 0 required but it was " + count ) ; } return RxJavaPlugins . onAssembly ( new FlowableLimit < T > ( this , count ) ) ; }


Input: Returns a Flowable that represents all of the emissions <em > and< / em > notifications from the source Publisher into emissions marked with their original types within { @link Notification } objects . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / materialize . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and expects it from the source { @code Publisher } . If this expectation is violated the operator <em > may< / em > throw an { @code IllegalStateException } . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code materialize } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < Notification < T > > materialize ( ) { return RxJavaPlugins . onAssembly ( new FlowableMaterialize < T > ( this ) ) ; }


Input: Flattens this and another Publisher into a single Publisher without any transformation . <p > <img width = 640 height = 380 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / merge . png alt = > <p > You can combine items emitted by multiple Publishers so that they appear as a single Publisher by using the { @code mergeWith } method . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream . This and the other { @code Publisher } s are expected to honor backpressure ; if violated the operator <em > may< / em > signal { @code MissingBackpressureException } . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code mergeWith } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > mergeWith ( Publisher < ? extends T > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return merge ( this , other ) ; }


Input: Merges the sequence of items of this Flowable with the success value of the other SingleSource . <p > <img width = 640 height = 380 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / merge . png alt = > <p > The success value of the other { [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > mergeWith ( @ NonNull SingleSource < ? extends T > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableMergeWithSingle < T > ( this , other ) ) ; }


Input: 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 . <p > <img width = 640 height = 380 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / merge . png alt = > <p > The success value of the other { [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > mergeWith ( @ NonNull MaybeSource < ? extends T > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableMergeWithMaybe < T > ( this , other ) ) ; }


Input: Modifies a Publisher to perform its emissions and notifications on a specified { @link Scheduler } asynchronously with a bounded buffer of { @link #bufferSize () } slots . [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Flowable < T > observeOn ( Scheduler scheduler ) { return observeOn ( scheduler , false , bufferSize ( ) ) ; }


Input: Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer these items indefinitely until they can be emitted . <p > <img width = 640 height = 300 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / bp . obp . buffer . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and consumes the source { @code Publisher } in an unbounded manner ( i . e . not applying backpressure to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code onBackpressureBuffer } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > onBackpressureBuffer ( ) { return onBackpressureBuffer ( bufferSize ( ) , false , true ) ; }


Input: Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to a given amount of items until they can be emitted . The resulting Publisher will signal a { @code BufferOverflowException } via { @code onError } as soon as the buffer s capacity is exceeded dropping all undelivered items and canceling the source . <p > <img width = 640 height = 300 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / bp . obp . buffer . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and consumes the source { @code Publisher } in an unbounded manner ( i . e . not applying backpressure to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code onBackpressureBuffer } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > onBackpressureBuffer ( int capacity ) { return onBackpressureBuffer ( capacity , false , false ) ; }


Input: Instructs a Publisher that is emitting items faster than its Subscriber can consume them to discard rather than emit those items that its Subscriber is not prepared to observe . <p > <img width = 640 height = 245 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / bp . obp . drop . png alt = > <p > If the downstream request count hits 0 then the Publisher will refrain from calling { @code onNext } until the Subscriber invokes { @code request ( n ) } again to increase the request count . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and consumes the source { @code Publisher } in an unbounded manner ( i . e . not applying backpressure to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code onBackpressureDrop } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > onBackpressureDrop ( ) { return RxJavaPlugins . onAssembly ( new FlowableOnBackpressureDrop < T > ( this ) ) ; }


Input: Instructs a Publisher that is emitting items faster than its Subscriber can consume them to discard rather than emit those items that its Subscriber is not prepared to observe . <p > <img width = 640 height = 245 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / bp . obp . drop . png alt = > <p > If the downstream request count hits 0 then the Publisher will refrain from calling { @code onNext } until the Subscriber invokes { @code request ( n ) } again to increase the request count . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and consumes the source { @code Publisher } in an unbounded manner ( i . e . not applying backpressure to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code onBackpressureDrop } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > onBackpressureDrop ( Consumer < ? super T > onDrop ) { ObjectHelper . requireNonNull ( onDrop , "onDrop is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableOnBackpressureDrop < T > ( this , onDrop ) ) ; }


Input: Instructs a Publisher to pass control to another Publisher rather than invoking { @link Subscriber#onError onError } if it encounters an error . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / onErrorResumeNext . png alt = > <p > By default when a Publisher encounters an error that prevents it from emitting the expected item to its { @link Subscriber } the Publisher invokes its Subscriber s { @code onError } method and then quits without invoking any more of its Subscriber s methods . The { @code onErrorResumeNext } method changes this behavior . If you pass a function that returns a Publisher ( { @code resumeFunction } ) to { @code onErrorResumeNext } if the original Publisher encounters an error instead of invoking its Subscriber s { @code onError } method it will instead relinquish control to the Publisher returned from { @code resumeFunction } which will invoke the Subscriber s { @link Subscriber#onNext onNext } method if it is able to do so . In such a case because no Publisher necessarily invokes { @code onError } the Subscriber may never know that an error happened . <p > You can use this to prevent errors from propagating or to supply fallback data should errors be encountered . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream . This and the resuming { @code Publisher } s are expected to honor backpressure as well . If any of them violate this expectation the operator <em > may< / em > throw an { @code IllegalStateException } when the source { @code Publisher } completes or a { @code MissingBackpressureException } is signaled somewhere downstream . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code onErrorResumeNext } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > onErrorResumeNext ( Function < ? super Throwable , ? extends Publisher < ? extends T > > resumeFunction ) { ObjectHelper . requireNonNull ( resumeFunction , "resumeFunction is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableOnErrorNext < T > ( this , resumeFunction , false ) ) ; }


Input: Nulls out references to the upstream producer and downstream Subscriber if the sequence is terminated or downstream cancels . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator doesn t interfere with backpressure which is determined by the source { [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > onTerminateDetach ( ) { return RxJavaPlugins . onAssembly ( new FlowableDetach < T > ( this ) ) ; }


Input: 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 . <p > Note that the rails don t execute in parallel on their own and one needs to apply { [CODESPLIT] @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) @ CheckReturnValue public final ParallelFlowable < T > parallel ( ) { return ParallelFlowable . from ( this ) ; }


Input: Parallelizes the flow by creating the specified number of rails and dispatches the upstream items to them in a round - robin fashion . <p > Note that the rails don t execute in parallel on their own and one needs to apply { [CODESPLIT] @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) @ CheckReturnValue public final ParallelFlowable < T > parallel ( int parallelism ) { ObjectHelper . verifyPositive ( parallelism , "parallelism" ) ; return ParallelFlowable . from ( this , parallelism ) ; }


Input: Returns a { @link ConnectableFlowable } which is a variety of Publisher that waits until its { @link ConnectableFlowable#connect connect } method is called before it begins emitting items to those { @link Subscriber } s that have subscribed to it . <p > <img width = 640 height = 510 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / publishConnect . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The returned { @code ConnectableFlowable } honors backpressure for each of its { @code Subscriber } s and expects the source { @code Publisher } to honor backpressure as well . If this expectation is violated the operator will signal a { @code MissingBackpressureException } to its { @code Subscriber } s and disconnect . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code publish } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final ConnectableFlowable < T > publish ( ) { return publish ( bufferSize ( ) ) ; }


Input: Returns a Flowable that emits the results of invoking a specified selector on items emitted by a { @link ConnectableFlowable } that shares a single subscription to the underlying sequence . <p > <img width = 640 height = 510 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / publishConnect . f . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator expects the source { @code Publisher } to honor backpressure and if this expectation is violated the operator will signal a { @code MissingBackpressureException } through the { @code Publisher } provided to the function . Since the { @code Publisher } returned by the { @code selector } may be independent of the provided { @code Publisher } to the function the output s backpressure behavior is determined by this returned { @code Publisher } . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code publish } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Flowable < R > publish ( Function < ? super Flowable < T > , ? extends Publisher < R > > selector ) { return publish ( selector , bufferSize ( ) ) ; }


Input: Returns a { @link ConnectableFlowable } which is a variety of Publisher that waits until its { @link ConnectableFlowable#connect connect } method is called before it begins emitting items to those { @link Subscriber } s that have subscribed to it . <p > <img width = 640 height = 510 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / publishConnect . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The returned { @code ConnectableFlowable } honors backpressure for each of its { @code Subscriber } s and expects the source { @code Publisher } to honor backpressure as well . If this expectation is violated the operator will signal a { @code MissingBackpressureException } to its { @code Subscriber } s and disconnect . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code publish } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final ConnectableFlowable < T > publish ( int bufferSize ) { ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return FlowablePublish . create ( this , bufferSize ) ; }


Input: Requests { @code n } initially from the upstream and then 75% of { @code n } subsequently after 75% of { @code n } values have been emitted to the downstream . [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > rebatchRequests ( int n ) { return observeOn ( ImmediateThinScheduler . INSTANCE , true , n ) ; }


Input: Returns a Maybe that applies a specified accumulator function to the first item emitted by a source Publisher then feeds the result of that function along with the second item emitted by the source Publisher into the same function and so on until all items have been emitted by the finite source Publisher and emits the final result from the final call to your function as its sole item . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / reduce . png alt = > <p > 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 { @code inject } method that does a similar operation on lists . <p > Note that this operator requires the upstream to signal { @code 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 { @code OutOfMemoryError } . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure of its downstream consumer and consumes the upstream source in unbounded mode . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code reduce } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > reduce ( BiFunction < T , T , T > reducer ) { ObjectHelper . requireNonNull ( reducer , "reducer is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableReduceMaybe < T > ( this , reducer ) ) ; }


Input: Returns a Single that applies a specified accumulator function to the first item emitted by a source Publisher and a specified seed value then feeds the result of that function along with the second item emitted by a Publisher into the same function and so on until all items have been emitted by the finite source Publisher emitting the final result from the final call to your function as its sole item . <p > <img width = 640 height = 325 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / reduceSeed . png alt = > <p > 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 { @code inject } method that does a similar operation on lists . <p > Note that the { @code seed } is shared among all subscribers to the resulting Publisher and may cause problems if it is mutable . To make sure each subscriber gets its own value defer the application of this operator via { @link #defer ( Callable ) } : <pre > <code > Publisher&lt ; T&gt ; source = ... Single . defer (( ) - &gt ; source . reduce ( new ArrayList&lt ; &gt ; () ( list item ) - &gt ; list . add ( item ))) ; [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Single < R > reduce ( R seed , BiFunction < R , ? super T , R > reducer ) { ObjectHelper . requireNonNull ( seed , "seed is null" ) ; ObjectHelper . requireNonNull ( reducer , "reducer is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableReduceSeedSingle < T , R > ( this , seed , reducer ) ) ; }


Input: Returns a Single that applies a specified accumulator function to the first item emitted by a source Publisher and a seed value derived from calling a specified seedSupplier then feeds the result of that function along with the second item emitted by a Publisher into the same function and so on until all items have been emitted by the finite source Publisher emitting the final result from the final call to your function as its sole item . <p > <img width = 640 height = 325 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / reduceSeed . png alt = > <p > 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 { @code inject } method that does a similar operation on lists . <p > Note that this operator requires the upstream to signal { @code 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 { @code OutOfMemoryError } . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure of its downstream consumer and consumes the upstream source in unbounded mode . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code reduceWith } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Single < R > reduceWith ( Callable < R > seedSupplier , BiFunction < R , ? super T , R > reducer ) { ObjectHelper . requireNonNull ( seedSupplier , "seedSupplier is null" ) ; ObjectHelper . requireNonNull ( reducer , "reducer is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableReduceWithSingle < T , R > ( this , seedSupplier , reducer ) ) ; }


Input: Returns a Flowable that repeats the sequence of items emitted by the source Publisher indefinitely . <p > <img width = 640 height = 309 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / repeat . o . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors downstream backpressure and expects the source { @code Publisher } to honor backpressure as well . If this expectation is violated the operator <em > may< / em > throw an { @code IllegalStateException } . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code repeat } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > repeat ( ) { return repeat ( Long . MAX_VALUE ) ; }


Input: Returns a Flowable that repeats the sequence of items emitted by the source Publisher at most { @code count } times . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / repeat . on . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors downstream backpressure and expects the source { @code Publisher } to honor backpressure as well . If this expectation is violated the operator <em > may< / em > throw an { @code IllegalStateException } . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code repeat } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > repeat ( long times ) { if ( times < 0 ) { throw new IllegalArgumentException ( "times >= 0 required but it was " + times ) ; } if ( times == 0 ) { return empty ( ) ; } return RxJavaPlugins . onAssembly ( new FlowableRepeat < T > ( this , times ) ) ; }


Input: Returns a { @link ConnectableFlowable } that shares a single subscription to the underlying Publisher that will replay all of its items and notifications to any future { @link Subscriber } . A Connectable Publisher resembles an ordinary Publisher except that it does not begin emitting items when it is subscribed to but only when its { @code connect } method is called . <p > <img width = 640 height = 515 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / replay . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator supports backpressure . Note that the upstream requests are determined by the child Subscriber which requests the largest amount : i . e . two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code replay } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final ConnectableFlowable < T > replay ( ) { return FlowableReplay . createFrom ( this ) ; }


Input: Returns a Flowable that emits items that are the results of invoking a specified selector on items emitted by a { @link ConnectableFlowable } that shares a single subscription to the source Publisher replaying no more than { @code bufferSize } items that were emitted within a specified time window . <p > Note that due to concurrency requirements { @code replay ( bufferSize ) } may hold strong references to more than { @code bufferSize } source emissions . <p > <img width = 640 height = 445 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / replay . fnt . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator supports backpressure . Note that the upstream requests are determined by the child Subscriber which requests the largest amount : i . e . two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code replay } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final < R > Flowable < R > replay ( Function < ? super Flowable < T > , ? extends Publisher < R > > selector , int bufferSize , long time , TimeUnit unit ) { return replay ( selector , bufferSize , time , unit , Schedulers . computation ( ) ) ; }


Input: Returns a Flowable that emits items that are the results of invoking a specified selector on items emitted by a { @link ConnectableFlowable } that shares a single subscription to the source Publisher . <p > <img width = 640 height = 445 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / replay . fs . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator supports backpressure . Note that the upstream requests are determined by the child Subscriber which requests the largest amount : i . e . two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final < R > Flowable < R > replay ( final Function < ? super Flowable < T > , ? extends Publisher < R > > selector , final Scheduler scheduler ) { ObjectHelper . requireNonNull ( selector , "selector is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return FlowableReplay . multicastSelector ( FlowableInternalHelper . replayCallable ( this ) , FlowableInternalHelper . replayFunction ( selector , scheduler ) ) ; }


Input: Returns a { @link ConnectableFlowable } that shares a single subscription to the source Publisher that replays at most { @code bufferSize } items emitted by that Publisher . A Connectable Publisher resembles an ordinary Publisher except that it does not begin emitting items when it is subscribed to but only when its { @code connect } method is called . <p > Note that due to concurrency requirements { @code replay ( bufferSize ) } may hold strong references to more than { @code bufferSize } source emissions . <p > <img width = 640 height = 515 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / replay . n . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator supports backpressure . Note that the upstream requests are determined by the child Subscriber which requests the largest amount : i . e . two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code replay } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final ConnectableFlowable < T > replay ( final int bufferSize ) { ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return FlowableReplay . create ( this , bufferSize ) ; }


Input: Returns a { @link ConnectableFlowable } that shares a single subscription to the source Publisher and replays at most { @code bufferSize } items that were emitted during a specified time window . A Connectable Publisher resembles an ordinary Publisher except that it does not begin emitting items when it is subscribed to but only when its { @code connect } method is called . <p > Note that due to concurrency requirements { @code replay ( bufferSize ) } may hold strong references to more than { @code bufferSize } source emissions . <p > <img width = 640 height = 515 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / replay . nt . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator supports backpressure . Note that the upstream requests are determined by the child Subscriber which requests the largest amount : i . e . two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code replay } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final ConnectableFlowable < T > replay ( int bufferSize , long time , TimeUnit unit ) { return replay ( bufferSize , time , unit , Schedulers . computation ( ) ) ; }


Input: Returns a { @link ConnectableFlowable } that shares a single subscription to the source Publisher and that replays a maximum of { @code bufferSize } items that are emitted within a specified time window . A Connectable Publisher resembles an ordinary Publisher except that it does not begin emitting items when it is subscribed to but only when its { @code connect } method is called . <p > Note that due to concurrency requirements { @code replay ( bufferSize ) } may hold strong references to more than { @code bufferSize } source emissions . <p > <img width = 640 height = 515 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / replay . nts . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator supports backpressure . Note that the upstream requests are determined by the child Subscriber which requests the largest amount : i . e . two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final ConnectableFlowable < T > replay ( final int bufferSize , final long time , final TimeUnit unit , final Scheduler scheduler ) { ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return FlowableReplay . create ( this , time , unit , scheduler , bufferSize ) ; }


Input: Returns a { @link ConnectableFlowable } that shares a single subscription to the source Publisher and replays at most { @code bufferSize } items emitted by that Publisher . A Connectable Publisher resembles an ordinary Publisher except that it does not begin emitting items when it is subscribed to but only when its { @code connect } method is called . <p > Note that due to concurrency requirements { @code replay ( bufferSize ) } may hold strong references to more than { @code bufferSize } source emissions . <p > <img width = 640 height = 515 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / replay . ns . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator supports backpressure . Note that the upstream requests are determined by the child Subscriber which requests the largest amount : i . e . two child Subscribers with requests of 10 and 100 will request 100 elements from the underlying Publisher sequence . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final ConnectableFlowable < T > replay ( final int bufferSize , final Scheduler scheduler ) { ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return FlowableReplay . observeOn ( replay ( bufferSize ) , scheduler ) ; }


Input: Returns a Flowable that mirrors the source Publisher resubscribing to it if it calls { @code onError } ( infinite retry count ) . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / retry . png alt = > <p > If the source Publisher calls { @link Subscriber#onError } this method will resubscribe to the source Publisher rather than propagating the { @code onError } call . <p > Any and all items emitted by the source Publisher will be emitted by the resulting Publisher even those emitted during failed subscriptions . For example if a Publisher fails at first but emits { @code [ 1 2 ] } then succeeds the second time and emits { @code [ 1 2 3 4 5 ] } then the complete sequence of emissions and notifications would be { @code [ 1 2 1 2 3 4 5 onComplete ] } . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors downstream backpressure and expects the source { @code Publisher } to honor backpressure as well . If this expectation is violated the operator <em > may< / em > throw an { @code IllegalStateException } . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code retry } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > retry ( ) { return retry ( Long . MAX_VALUE , Functions . alwaysTrue ( ) ) ; }


Input: Returns a Flowable that mirrors the source Publisher resubscribing to it if it calls { @code onError } up to a specified number of retries . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / retry . png alt = > <p > If the source Publisher calls { @link Subscriber#onError } this method will resubscribe to the source Publisher for a maximum of { @code count } resubscriptions rather than propagating the { @code onError } call . <p > Any and all items emitted by the source Publisher will be emitted by the resulting Publisher even those emitted during failed subscriptions . For example if a Publisher fails at first but emits { @code [ 1 2 ] } then succeeds the second time and emits { @code [ 1 2 3 4 5 ] } then the complete sequence of emissions and notifications would be { @code [ 1 2 1 2 3 4 5 onComplete ] } . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors downstream backpressure and expects the source { @code Publisher } to honor backpressure as well . If this expectation is violated the operator <em > may< / em > throw an { @code IllegalStateException } . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code retry } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > retry ( long count ) { return retry ( count , Functions . alwaysTrue ( ) ) ; }


Input: Retries the current Flowable if the predicate returns true . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors downstream backpressure and expects the source { @code Publisher } to honor backpressure as well . If this expectation is violated the operator <em > may< / em > throw an { @code IllegalStateException } . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code retry } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > retry ( Predicate < ? super Throwable > predicate ) { return retry ( Long . MAX_VALUE , predicate ) ; }


Input: 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 ) . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator leaves the reactive world and the backpressure behavior depends on the Subscriber s behavior . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final void safeSubscribe ( Subscriber < ? super T > s ) { ObjectHelper . requireNonNull ( s , "s is null" ) ; if ( s instanceof SafeSubscriber ) { subscribe ( ( SafeSubscriber < ? super T > ) s ) ; } else { subscribe ( new SafeSubscriber < T > ( s ) ) ; } }


Input: Returns a Flowable that emits the most recently emitted item ( if any ) emitted by the source Publisher within periodic time intervals . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / sample . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it uses time to control data flow . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code sample } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Flowable < T > sample ( long period , TimeUnit unit ) { return sample ( period , unit , Schedulers . computation ( ) ) ; }


Input: Returns a Flowable that emits the most recently emitted item ( if any ) emitted by the source Publisher within periodic time intervals where the intervals are defined on a particular Scheduler . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / sample . s . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it uses time to control data flow . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Flowable < T > sample ( long period , TimeUnit unit , Scheduler scheduler ) { ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableSampleTimed < T > ( this , period , unit , scheduler , false ) ) ; }


Input: Returns a Flowable that when the specified { @code sampler } Publisher emits an item or completes emits the most recently emitted item ( if any ) emitted by the source Publisher since the previous emission from the { @code sampler } Publisher . <p > <img width = 640 height = 289 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / sample . o . nolast . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it uses the emissions of the { @code sampler } Publisher to control data flow . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code sample } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U > Flowable < T > sample ( Publisher < U > sampler ) { ObjectHelper . requireNonNull ( sampler , "sampler is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableSamplePublisher < T > ( this , sampler , false ) ) ; }


Input: Returns a Flowable that applies a specified accumulator function to the first item emitted by a source Publisher and a seed value then feeds the result of that function along with the second item emitted by the source Publisher into the same function and so on until all items have been emitted by the source Publisher emitting the result of each of these iterations . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / scanSeed . png alt = > <p > This sort of function is sometimes called an accumulator . <p > Note that the Publisher that results from this method will emit the value returned by the { @code seedSupplier } as its first item . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors downstream backpressure and expects the source { @code Publisher } to honor backpressure as well . Violating this expectation a { @code MissingBackpressureException } <em > may< / em > get signaled somewhere downstream . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code scanWith } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Flowable < R > scanWith ( Callable < R > seedSupplier , BiFunction < R , ? super T , R > accumulator ) { ObjectHelper . requireNonNull ( seedSupplier , "seedSupplier is null" ) ; ObjectHelper . requireNonNull ( accumulator , "accumulator is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableScanSeed < T , R > ( this , seedSupplier , accumulator ) ) ; }


Input:
Forces a Publisher s emissions and notifications to be serialized and for it to obey  the Publisher contract in other ways .
 It is possible for a Publisher to invoke its Subscribers methods asynchronously perhaps from different threads . This could make such a Publisher poorly - behaved in that it might try to invoke { @code onComplete } or { @code onError } before one of its { @code onNext } invocations or it might call { @code onNext } from two different threads concurrently . You can force such a Publisher to be well - behaved and sequential by applying the { @code serialize } method to it .

  Backpressure :

 The operator doesn t interfere with backpressure which is determined by the source { @code Publisher } s backpressure behavior .

  Scheduler :

 { @code serialize } does not operate by default on a particular { @link Scheduler } .

 [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > serialize ( ) { return RxJavaPlugins . onAssembly ( new FlowableSerialized < T > ( this ) ) ; }


Input: Returns a new { @link Publisher } that multicasts ( and shares a single subscription to ) the original { @link Publisher } . As long as there is at least one { @link Subscriber } this { @link Publisher } will be subscribed and emitting data . When all subscribers have canceled it will cancel the source { @link Publisher } . <p > This is an alias for { @link #publish () } . { @link ConnectableFlowable#refCount () refCount () } . <p > <img width = 640 height = 510 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / publishRefCount . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure and expects the source { @code Publisher } to honor backpressure as well . If this expectation is violated the operator will signal a { @code MissingBackpressureException } to its { @code Subscriber } s . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code share } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > share ( ) { return publish ( ) . refCount ( ) ; }


Input: Returns a Maybe that completes if this Flowable is empty signals one item if this Flowable signals exactly one item or signals an { @code IllegalArgumentException } if this Flowable signals more than one item . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / single . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and consumes the source { @code Publisher } in an unbounded manner ( i . e . without applying backpressure ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code singleElement } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > singleElement ( ) { return RxJavaPlugins . onAssembly ( new FlowableSingleMaybe < T > ( this ) ) ; }


Input: 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 { @link NoSuchElementException } will be signaled and if this Flowable emits more than one item an { @code IllegalArgumentException } will be signaled . <p > <img width = 640 height = 205 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / singleOrError . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and consumes the source { @code Publisher } in an unbounded manner ( i . e . without applying backpressure ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code singleOrError } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > singleOrError ( ) { return RxJavaPlugins . onAssembly ( new FlowableSingleSingle < T > ( this , null ) ) ; }


Input: Returns a Flowable that skips the first { @code count } items emitted by the source Publisher and emits the remainder . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / skip . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator doesn t interfere with backpressure which is determined by the source { @code Publisher } s backpressure behavior . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code skip } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > skip ( long count ) { if ( count <= 0L ) { return RxJavaPlugins . onAssembly ( this ) ; } return RxJavaPlugins . onAssembly ( new FlowableSkip < T > ( this , count ) ) ; }


Input: Returns a Flowable that skips values emitted by the source Publisher before a specified time window elapses . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / skip . t . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator doesn t support backpressure as it uses time to skip an arbitrary number of elements and thus has to consume the source { @code Publisher } in an unbounded manner ( i . e . no backpressure applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code skip } does not operate on any particular scheduler but uses the current time from the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > skip ( long time , TimeUnit unit ) { return skipUntil ( timer ( time , unit ) ) ; }


Input: Returns a Flowable that skips values emitted by the source Publisher before a specified time window on a specified { @link Scheduler } elapses . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / skip . ts . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator doesn t support backpressure as it uses time to skip an arbitrary number of elements and thus has to consume the source { @code Publisher } in an unbounded manner ( i . e . no backpressure applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use for the timed skipping< / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Flowable < T > skip ( long time , TimeUnit unit , Scheduler scheduler ) { return skipUntil ( timer ( time , unit , scheduler ) ) ; }


Input: Returns a Flowable that drops a specified number of items from the end of the sequence emitted by the source Publisher . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / skipLast . png alt = > <p > This Subscriber accumulates a queue long enough to store the first { @code count } items . As more items are received items are taken from the front of the queue and emitted by the returned Publisher . This causes such items to be delayed . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator doesn t interfere with backpressure which is determined by the source { @code Publisher } s backpressure behavior . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code skipLast } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > skipLast ( int count ) { if ( count < 0 ) { throw new IndexOutOfBoundsException ( "count >= 0 required but it was " + count ) ; } if ( count == 0 ) { return RxJavaPlugins . onAssembly ( this ) ; } return RxJavaPlugins . onAssembly ( new FlowableSkipLast < T > ( this , count ) ) ; }


Input: Returns a Flowable that drops items emitted by the source Publisher during a specified time window before the source completes . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / skipLast . t . png alt = > <p > Note : this action will cache the latest items arriving in the specified time window . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator doesn t support backpressure as it uses time to skip an arbitrary number of elements and thus has to consume the source { @code Publisher } in an unbounded manner ( i . e . no backpressure applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code skipLast } does not operate on any particular scheduler but uses the current time from the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > skipLast ( long time , TimeUnit unit ) { return skipLast ( time , unit , Schedulers . computation ( ) , false , bufferSize ( ) ) ; }


Input: Returns a Flowable that drops items emitted by the source Publisher during a specified time window ( defined on a specified scheduler ) before the source completes . <p > <img width = 640 height = 340 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / skipLast . ts . png alt = > <p > Note : this action will cache the latest items arriving in the specified time window . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator doesn t support backpressure as it uses time to skip an arbitrary number of elements and thus has to consume the source { @code Publisher } in an unbounded manner ( i . e . no backpressure applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use for tracking the current time< / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Flowable < T > skipLast ( long time , TimeUnit unit , Scheduler scheduler ) { return skipLast ( time , unit , scheduler , false , bufferSize ( ) ) ; }


Input: Returns a Flowable that skips all items emitted by the source Publisher as long as a specified condition holds true but emits all further source items as soon as the condition becomes false . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / skipWhile . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator doesn t interfere with backpressure which is determined by the source { @code Publisher } s backpressure behavior . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code skipWhile } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > skipWhile ( Predicate < ? super T > predicate ) { ObjectHelper . requireNonNull ( predicate , "predicate is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableSkipWhile < T > ( this , predicate ) ) ; }


Input: Returns a Flowable that emits the events emitted by source Publisher in a sorted order . Each item emitted by the Publisher must implement { @link Comparable } with respect to all other items in the sequence . [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > sorted ( ) { return toList ( ) . toFlowable ( ) . map ( Functions . listSorter ( Functions . < T > naturalComparator ( ) ) ) . flatMapIterable ( Functions . < List < T > > identity ( ) ) ; }


Input: Returns a Flowable that emits the events emitted by source Publisher in a sorted order based on a specified comparison function . [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > sorted ( Comparator < ? super T > sortFunction ) { ObjectHelper . requireNonNull ( sortFunction , "sortFunction" ) ; return toList ( ) . toFlowable ( ) . map ( Functions . listSorter ( sortFunction ) ) . flatMapIterable ( Functions . < List < T > > identity ( ) ) ; }


Input: Returns a Flowable that emits the items in a specified { @link Iterable } before it begins to emit items emitted by the source Publisher . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / startWith . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream . The source { @code Publisher } is expected to honor backpressure as well . If it violates this rule it <em > may< / em > throw an { @code IllegalStateException } when the source { @code Publisher } completes . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code startWith } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ SuppressWarnings ( "unchecked" ) @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > startWith ( Iterable < ? extends T > items ) { return concatArray ( fromIterable ( items ) , this ) ; }


Input: Returns a Flowable that emits the specified items before it begins to emit items emitted by the source Publisher . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / startWith . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream . The source { @code Publisher } is expected to honor backpressure as well . If it violates this rule it <em > may< / em > throw an { @code IllegalStateException } when the source { @code Publisher } completes . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code startWithArray } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ SuppressWarnings ( "unchecked" ) @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > startWithArray ( T ... items ) { Flowable < T > fromArray = fromArray ( items ) ; if ( fromArray == empty ( ) ) { return RxJavaPlugins . onAssembly ( this ) ; } return concatArray ( fromArray , this ) ; }


Input: Subscribes to a Publisher and ignores { @code onNext } and { @code onComplete } emissions . <p > If the Flowable emits an error it is wrapped into an { @link io . reactivex . exceptions . OnErrorNotImplementedException OnErrorNotImplementedException } and routed to the RxJavaPlugins . onError handler . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the source { @code Publisher } in an unbounded manner ( i . e . no backpressure is applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code subscribe } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Disposable subscribe ( ) { return subscribe ( Functions . emptyConsumer ( ) , Functions . ON_ERROR_MISSING , Functions . EMPTY_ACTION , FlowableInternalHelper . RequestMax . INSTANCE ) ; }


Input: Subscribes to a Publisher and provides a callback to handle the items it emits . <p > If the Flowable emits an error it is wrapped into an { @link io . reactivex . exceptions . OnErrorNotImplementedException OnErrorNotImplementedException } and routed to the RxJavaPlugins . onError handler . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the source { @code Publisher } in an unbounded manner ( i . e . no backpressure is applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code subscribe } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Disposable subscribe ( Consumer < ? super T > onNext ) { return subscribe ( onNext , Functions . ON_ERROR_MISSING , Functions . EMPTY_ACTION , FlowableInternalHelper . RequestMax . INSTANCE ) ; }


Input: Establish a connection between this Flowable and the given FlowableSubscriber and start streaming events based on the demand of the FlowableSubscriber . <p > This is a factory method and can be called multiple times each time starting a new { [CODESPLIT] @ BackpressureSupport ( BackpressureKind . SPECIAL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final void subscribe ( FlowableSubscriber < ? super T > s ) { ObjectHelper . requireNonNull ( s , "s is null" ) ; try { Subscriber < ? super T > z = RxJavaPlugins . onSubscribe ( this , s ) ; ObjectHelper . requireNonNull ( z , "The RxJavaPlugins.onSubscribe hook returned a null FlowableSubscriber. Please check the handler provided to RxJavaPlugins.setOnFlowableSubscribe for invalid null returns. Further reading: https://github.com/ReactiveX/RxJava/wiki/Plugins" ) ; subscribeActual ( z ) ; } catch ( NullPointerException e ) { // NOPMD throw e ; } catch ( Throwable e ) { Exceptions . throwIfFatal ( e ) ; // can't call onError because no way to know if a Subscription has been set or not // can't call onSubscribe because the call might have set a Subscription already RxJavaPlugins . onError ( e ) ; NullPointerException npe = new NullPointerException ( "Actually not, but can't throw other exceptions due to RS" ) ; npe . initCause ( e ) ; throw npe ; } }


Input: Subscribes a given Subscriber ( subclass ) to this Flowable and returns the given Subscriber as is . <p > Usage example : <pre > <code > Flowable&lt ; Integer&gt ; source = Flowable . range ( 1 10 ) ; CompositeDisposable composite = new CompositeDisposable () ; [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . SPECIAL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < E extends Subscriber < ? super T > > E subscribeWith ( E subscriber ) { subscribe ( subscriber ) ; return subscriber ; }


Input: Asynchronously subscribes Subscribers to this Publisher on the specified { [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Flowable < T > subscribeOn ( @ NonNull Scheduler scheduler , boolean requestOn ) { ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableSubscribeOn < T > ( this , scheduler , requestOn ) ) ; }


Input: Returns a Flowable that emits the items emitted by the source Publisher or the items of an alternate Publisher if the source Publisher is empty . <p > <img width = 640 height = 255 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / switchifempty . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > If the source { @code Publisher } is empty the alternate { @code Publisher } is expected to honor backpressure . If the source { @code Publisher } is non - empty it is expected to honor backpressure as instead . In either case if violated a { @code MissingBackpressureException } <em > may< / em > get signaled somewhere downstream . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code switchIfEmpty } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > switchIfEmpty ( Publisher < ? extends T > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableSwitchIfEmpty < T > ( this , other ) ) ; }


Input: Maps the upstream values into { [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Completable switchMapCompletable ( @ NonNull Function < ? super T , ? extends CompletableSource > mapper ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableSwitchMapCompletable < T > ( this , mapper , false ) ) ; }


Input: Returns a new Publisher by applying a function that you supply to each item emitted by the source Publisher that returns a Publisher and then emitting the items emitted by the most recently emitted of these Publishers and delays any error until all Publishers terminate . <p > The resulting Publisher completes if both the upstream Publisher and the last inner Publisher if any complete . If the upstream Publisher signals an onError the termination of the last inner Publisher will emit that error as is or wrapped into a CompositeException along with the other possible errors the former inner Publishers signaled . <p > <img width = 640 height = 350 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / switchMap . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream . The outer { @code Publisher } is consumed in an unbounded manner ( i . e . without backpressure ) and the inner { @code Publisher } s are expected to honor backpressure but it is not enforced ; the operator won t signal a { @code MissingBackpressureException } but the violation <em > may< / em > lead to { @code OutOfMemoryError } due to internal buffer bloat . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code switchMapDelayError } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . SPECIAL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Flowable < R > switchMapDelayError ( Function < ? super T , ? extends Publisher < ? extends R > > mapper ) { return switchMapDelayError ( mapper , bufferSize ( ) ) ; }


Input: Returns a Flowable that emits only the first { @code count } items emitted by the source Publisher . If the source emits fewer than { @code count } items then all of its items are emitted . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / take . png alt = > <p > This method returns a Publisher that will invoke a subscribing { @link Subscriber } s { @link Subscriber#onNext onNext } function a maximum of { @code count } times before invoking { @link Subscriber#onComplete onComplete } . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator doesn t interfere with backpressure which is determined by the source { @code Publisher } s backpressure behavior in case the first request is smaller than the { @code count } . Otherwise the source { @code Publisher } is consumed in an unbounded manner ( i . e . without applying backpressure to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code take } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . SPECIAL ) // may trigger UNBOUNDED_IN @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > take ( long count ) { if ( count < 0 ) { throw new IllegalArgumentException ( "count >= 0 required but it was " + count ) ; } return RxJavaPlugins . onAssembly ( new FlowableTake < T > ( this , count ) ) ; }


Input: Returns a Flowable that emits those items emitted by source Publisher before a specified time runs out . <p > If time runs out before the { @code Flowable } completes normally the { @code onComplete } event will be signaled on the default { @code computation } { @link Scheduler } . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / take . t . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator doesn t interfere with backpressure which is determined by the source { @code Publisher } s backpressure behavior . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code take } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Flowable < T > take ( long time , TimeUnit unit ) { return takeUntil ( timer ( time , unit ) ) ; }


Input: Returns a Flowable that emits those items emitted by source Publisher before a specified time ( on a specified Scheduler ) runs out . <p > If time runs out before the { @code Flowable } completes normally the { @code onComplete } event will be signaled on the provided { @link Scheduler } . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / take . ts . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator doesn t interfere with backpressure which is determined by the source { @code Publisher } s backpressure behavior . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Flowable < T > take ( long time , TimeUnit unit , Scheduler scheduler ) { return takeUntil ( timer ( time , unit , scheduler ) ) ; }


Input: Returns a Flowable that emits at most the last { @code count } items emitted by the source Publisher . If the source emits fewer than { @code count } items then all of its items are emitted . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / takeLast . n . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream if the { @code count } is non - zero ; ignores backpressure if the { @code count } is zero as it doesn t signal any values . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code takeLast } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > takeLast ( int count ) { if ( count < 0 ) { throw new IndexOutOfBoundsException ( "count >= 0 required but it was " + count ) ; } else if ( count == 0 ) { return RxJavaPlugins . onAssembly ( new FlowableIgnoreElements < T > ( this ) ) ; } else if ( count == 1 ) { return RxJavaPlugins . onAssembly ( new FlowableTakeLastOne < T > ( this ) ) ; } return RxJavaPlugins . onAssembly ( new FlowableTakeLast < T > ( this , count ) ) ; }


Input: Returns a Flowable that emits at most a specified number of items from the source Publisher that were emitted in a specified window of time before the Publisher completed . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / takeLast . tn . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and consumes the source { @code Publisher } in an unbounded manner ( i . e . no backpressure is applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code takeLast } does not operate on any particular scheduler but uses the current time from the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > takeLast ( long count , long time , TimeUnit unit ) { return takeLast ( count , time , unit , Schedulers . computation ( ) , false , bufferSize ( ) ) ; }


Input: Returns a Flowable that emits at most a specified number of items from the source Publisher that were emitted in a specified window of time before the Publisher completed where the timing information is provided by a given Scheduler . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / takeLast . tns . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and consumes the source { @code Publisher } in an unbounded manner ( i . e . no backpressure is applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use for tracking the current time< / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Flowable < T > takeLast ( long count , long time , TimeUnit unit , Scheduler scheduler , boolean delayError , int bufferSize ) { ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; if ( count < 0 ) { throw new IndexOutOfBoundsException ( "count >= 0 required but it was " + count ) ; } return RxJavaPlugins . onAssembly ( new FlowableTakeLastTimed < T > ( this , count , time , unit , scheduler , bufferSize , delayError ) ) ; }


Input: Returns a Flowable that emits the items from the source Publisher that were emitted in a specified window of time before the Publisher completed where the timing information is provided by a specified Scheduler . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / takeLast . ts . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and consumes the source { @code Publisher } in an unbounded manner ( i . e . no backpressure is applied to it ) but note that this <em > may< / em > lead to { @code OutOfMemoryError } due to internal buffer bloat . Consider using { @link #takeLast ( long long TimeUnit Scheduler ) } in this case . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Flowable < T > takeLast ( long time , TimeUnit unit , Scheduler scheduler , boolean delayError , int bufferSize ) { return takeLast ( Long . MAX_VALUE , time , unit , scheduler , delayError , bufferSize ) ; }


Input: Returns a Flowable that emits items emitted by the source Publisher checks the specified predicate for each item and then completes when the condition is satisfied . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / takeUntil . p . png alt = > <p > The difference between this operator and { @link #takeWhile ( Predicate ) } is that here the condition is evaluated <em > after< / em > the item is emitted . [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > takeUntil ( Predicate < ? super T > stopPredicate ) { ObjectHelper . requireNonNull ( stopPredicate , "stopPredicate is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableTakeUntilPredicate < T > ( this , stopPredicate ) ) ; }


Input: Returns a Flowable that emits the items emitted by the source Publisher until a second Publisher emits an item . <p > <img width = 640 height = 380 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / takeUntil . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator doesn t interfere with backpressure which is determined by the source { @code Publisher } s backpressure behavior . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code takeUntil } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U > Flowable < T > takeUntil ( Publisher < U > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableTakeUntil < T , U > ( this , other ) ) ; }


Input: Returns a Flowable that emits items emitted by the source Publisher so long as each item satisfied a specified condition and then completes as soon as this condition is not satisfied . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / takeWhile . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator doesn t interfere with backpressure which is determined by the source { @code Publisher } s backpressure behavior . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code takeWhile } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > takeWhile ( Predicate < ? super T > predicate ) { ObjectHelper . requireNonNull ( predicate , "predicate is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableTakeWhile < T > ( this , predicate ) ) ; }


Input: Returns a Flowable that emits only the first item emitted by the source Publisher during sequential time windows of a specified duration . <p > This differs from { @link #throttleLast } in that this only tracks the passage of time whereas { @link #throttleLast } ticks at scheduled intervals . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / throttleFirst . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it uses time to control data flow . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code throttleFirst } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Flowable < T > throttleFirst ( long windowDuration , TimeUnit unit ) { return throttleFirst ( windowDuration , unit , Schedulers . computation ( ) ) ; }


Input: Returns a Flowable that emits only the last item emitted by the source Publisher during sequential time windows of a specified duration . <p > This differs from { @link #throttleFirst } in that this ticks along at a scheduled interval whereas { @link #throttleFirst } does not tick it just tracks the passage of time . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / throttleLast . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it uses time to control data flow . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code throttleLast } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Flowable < T > throttleLast ( long intervalDuration , TimeUnit unit ) { return sample ( intervalDuration , unit ) ; }