Input:
Returns a Flowable that emits the results of a specified combiner function applied to combinations of  n items emitted in sequence by the  n Publishers emitted by a specified Publisher .
 { @code zip } applies this function in strict sequence so the first item emitted by the new Publisher will be the result of the function applied to the first item emitted by each of the Publishers emitted by the source Publisher ; the second item emitted by the new Publisher will be the result of the function applied to the second item emitted by each of those Publishers ; and so forth .
 The resulting { @code Publisher<R > } returned from { @code zip } will invoke { @code onNext } as many times as the number of { @code onNext } invocations of the source Publisher that emits the fewest items .
 The operator subscribes to its sources in the order they are specified and completes eagerly if one of the sources is shorter than the rest while cancel the other sources . Therefore it is possible those other sources will never be able to run to completion ( and thus not calling { @code doOnComplete () } ) . This can also happen if the sources are exactly the same length ; if source A completes and B has been consumed and is about to complete the operator detects A won t be sending further values and it will cancel B immediately . For example :
  zip ( just ( range ( 1 5 ) . doOnComplete ( action1 ) range ( 6 5 ) . doOnComplete ( action2 )) ( a ) - &gt ; a )
 { @code action1 } will be called but { @code action2 } won t .
 To work around this termination property use { @link #doOnCancel ( Action ) } as well or use { @code using () } to do cleanup in case of completion or cancellation .

  Backpressure :

 The operator expects backpressure from the sources and honors backpressure from the downstream . ( I . e . zipping with { @link #interval ( long TimeUnit ) } may result in MissingBackpressureException use one of the { @code onBackpressureX } to handle similar backpressure - ignoring sources .

  Scheduler :

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

 [CODESPLIT] @ SuppressWarnings ( { "rawtypes" , "unchecked" , "cast" } ) @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T , R > Flowable < R > zip ( Publisher < ? extends Publisher < ? extends T > > sources , final Function < ? super Object [ ] , ? extends R > zipper ) { ObjectHelper . requireNonNull ( zipper , "zipper is null" ) ; return fromPublisher ( sources ) . toList ( ) . flatMapPublisher ( ( Function ) FlowableInternalHelper . < T , R > zipIterable ( zipper ) ) ; }


Input: Calls the specified converter function during assembly time and returns its resulting value . <p > This allows fluent conversion to any other type . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The backpressure behavior depends on what happens in the { [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . SPECIAL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > R as ( @ NonNull FlowableConverter < T , ? extends R > converter ) { return ObjectHelper . requireNonNull ( converter , "converter is null" ) . apply ( this ) ; }


Input: Returns the first item emitted by this { @code Flowable } or throws { @code NoSuchElementException } if it emits no items . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the source { @code Flowable } in an unbounded manner ( i . e . no backpressure applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code blockingFirst } does not operate by default on a particular { @link Scheduler } . < / dd > <dt > <b > Error handling : < / b > < / dt > <dd > If the source signals an error the operator wraps a checked { @link Exception } into { @link RuntimeException } and throws that . Otherwise { @code RuntimeException } s and { @link Error } s are rethrown as they are . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final T blockingFirst ( ) { BlockingFirstSubscriber < T > s = new BlockingFirstSubscriber < T > ( ) ; subscribe ( s ) ; T v = s . blockingGet ( ) ; if ( v != null ) { return v ; } throw new NoSuchElementException ( ) ; }


Input: Converts this { @code Flowable } into an { @link Iterable } . <p > <img width = 640 height = 315 src = https : // github . com / ReactiveX / RxJava / wiki / images / rx - operators / B . toIterable . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator expects the upstream to honor backpressure otherwise the returned Iterable s iterator will throw a { @code MissingBackpressureException } . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code blockingIterable } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Iterable < T > blockingIterable ( ) { return blockingIterable ( bufferSize ( ) ) ; }


Input: Converts this { @code Flowable } into an { @link Iterable } . <p > <img width = 640 height = 315 src = https : // github . com / ReactiveX / RxJava / wiki / images / rx - operators / B . toIterable . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator expects the upstream to honor backpressure otherwise the returned Iterable s iterator will throw a { @code MissingBackpressureException } . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code blockingIterable } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Iterable < T > blockingIterable ( int bufferSize ) { ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return new BlockingFlowableIterable < T > ( this , bufferSize ) ; }


Input: Returns the last item emitted by this { @code Flowable } or throws { @code NoSuchElementException } if this { @code Flowable } emits no items . <p > <img width = 640 height = 315 src = https : // github . com / ReactiveX / RxJava / wiki / images / rx - operators / B . last . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the source { @code Flowable } in an unbounded manner ( i . e . no backpressure applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code blockingLast } does not operate by default on a particular { @link Scheduler } . < / dd > <dt > <b > Error handling : < / b > < / dt > <dd > If the source signals an error the operator wraps a checked { @link Exception } into { @link RuntimeException } and throws that . Otherwise { @code RuntimeException } s and { @link Error } s are rethrown as they are . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final T blockingLast ( ) { BlockingLastSubscriber < T > s = new BlockingLastSubscriber < T > ( ) ; subscribe ( s ) ; T v = s . blockingGet ( ) ; if ( v != null ) { return v ; } throw new NoSuchElementException ( ) ; }


Input: Returns an { @link Iterable } that always returns the item most recently emitted by this { @code Flowable } . <p > <img width = 640 height = 490 src = https : // github . com / ReactiveX / RxJava / wiki / images / rx - operators / B . mostRecent . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the source { @code Flowable } in an unbounded manner ( i . e . no backpressure applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code blockingMostRecent } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Iterable < T > blockingMostRecent ( T initialItem ) { return new BlockingFlowableMostRecent < T > ( this , initialItem ) ; }


Input: Returns an { @link Iterable } that blocks until this { @code Flowable } emits another item then returns that item . <p > <img width = 640 height = 490 src = https : // github . com / ReactiveX / RxJava / wiki / images / rx - operators / B . next . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the source { @code Flowable } in an unbounded manner ( i . e . no backpressure applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code blockingNext } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Iterable < T > blockingNext ( ) { return new BlockingFlowableNext < T > ( this ) ; }


Input: If this { @code Flowable } completes after emitting a single item return that item otherwise throw a { @code NoSuchElementException } . <p > <img width = 640 height = 315 src = https : // github . com / ReactiveX / RxJava / wiki / images / rx - operators / B . single . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the source { @code Flowable } in an unbounded manner ( i . e . no backpressure applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code blockingSingle } does not operate by default on a particular { @link Scheduler } . < / dd > <dt > <b > Error handling : < / b > < / dt > <dd > If the source signals an error the operator wraps a checked { @link Exception } into { @link RuntimeException } and throws that . Otherwise { @code RuntimeException } s and { @link Error } s are rethrown as they are . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final T blockingSingle ( ) { return singleOrError ( ) . blockingGet ( ) ; }


Input: If this { @code Flowable } completes after emitting a single item return that item ; if it emits more than one item throw an { @code IllegalArgumentException } ; if it emits no items return a default value . <p > <img width = 640 height = 315 src = https : // github . com / ReactiveX / RxJava / wiki / images / rx - operators / B . singleOrDefault . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the source { @code Flowable } in an unbounded manner ( i . e . no backpressure applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code blockingSingle } does not operate by default on a particular { @link Scheduler } . < / dd > <dt > <b > Error handling : < / b > < / dt > <dd > If the source signals an error the operator wraps a checked { @link Exception } into { @link RuntimeException } and throws that . Otherwise { @code RuntimeException } s and { @link Error } s are rethrown as they are . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final T blockingSingle ( T defaultItem ) { return single ( defaultItem ) . blockingGet ( ) ; }


Input: Returns a { @link Future } representing the only value emitted by this { @code Flowable } . <p > <img width = 640 height = 324 src = https : // github . com / ReactiveX / RxJava / wiki / images / rx - operators / Flowable . toFuture . png alt = > <p > If the { @link Flowable } emits more than one item { @link java . util . concurrent . Future } will receive an { @link java . lang . IndexOutOfBoundsException } . If the { @link Flowable } is empty { @link java . util . concurrent . Future } will receive a { @link java . util . NoSuchElementException } . The { @code Flowable } source has to terminate in order for the returned { @code Future } to terminate as well . <p > If the { @code Flowable } may emit more than one item use { @code Flowable . toList () . toFuture () } . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the source { @code Flowable } in an unbounded manner ( i . e . no backpressure applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code toFuture } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Future < T > toFuture ( ) { return subscribeWith ( new FutureSubscriber < T > ( ) ) ; }


Input: Subscribes to the source and calls the given callbacks <strong > on the current thread< / strong > . <p > If the Flowable emits an error it is wrapped into an { [CODESPLIT] @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final void blockingSubscribe ( Consumer < ? super T > onNext ) { FlowableBlockingSubscribe . subscribe ( this , onNext , Functions . ON_ERROR_MISSING , Functions . EMPTY_ACTION ) ; }


Input: Subscribes to the source and calls the given callbacks <strong > on the current thread< / strong > . <p > Note that calling this method will block the caller thread until the upstream terminates normally or with an error . Therefore calling this method from special threads such as the Android Main Thread or the Swing Event Dispatch Thread is not recommended . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the source { [CODESPLIT] @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final void blockingSubscribe ( Consumer < ? super T > onNext , Consumer < ? super Throwable > onError , Action onComplete , int bufferSize ) { FlowableBlockingSubscribe . subscribe ( this , onNext , onError , onComplete , bufferSize ) ; }


Input: Subscribes to the source and calls the { [CODESPLIT] @ BackpressureSupport ( BackpressureKind . SPECIAL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final void blockingSubscribe ( Subscriber < ? super T > subscriber ) { FlowableBlockingSubscribe . subscribe ( this , subscriber ) ; }


Input: Returns a Flowable that emits buffers of items it collects from the source Publisher . The resulting Publisher emits connected non - overlapping buffers each containing { @code count } items . When the source Publisher completes the resulting Publisher emits the current buffer and propagates the notification from the source Publisher . Note that if the source Publisher issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / buffer3 . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and expects the source { @code Publisher } to honor it as well although not enforced ; violation <em > may< / em > lead to { @code MissingBackpressureException } somewhere downstream . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code buffer } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < List < T > > buffer ( int count ) { return buffer ( count , count ) ; }


Input: Returns a Flowable that emits buffers of items it collects from the source Publisher . The resulting Publisher emits buffers every { @code skip } items each containing { @code count } items . When the source Publisher completes the resulting Publisher emits the current buffer and propagates the notification from the source Publisher . Note that if the source Publisher issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / buffer4 . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and expects the source { @code Publisher } to honor it as well although not enforced ; violation <em > may< / em > lead to { @code MissingBackpressureException } somewhere downstream . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code buffer } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < List < T > > buffer ( int count , int skip ) { return buffer ( count , skip , ArrayListSupplier . < T > asCallable ( ) ) ; }


Input: Returns a Flowable that emits buffers of items it collects from the source Publisher . The resulting Publisher emits buffers every { @code skip } items each containing { @code count } items . When the source Publisher completes the resulting Publisher emits the current buffer and propagates the notification from the source Publisher . Note that if the source Publisher issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / buffer4 . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and expects the source { @code Publisher } to honor it as well although not enforced ; violation <em > may< / em > lead to { @code MissingBackpressureException } somewhere downstream . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code buffer } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U extends Collection < ? super T > > Flowable < U > buffer ( int count , int skip , Callable < U > bufferSupplier ) { ObjectHelper . verifyPositive ( count , "count" ) ; ObjectHelper . verifyPositive ( skip , "skip" ) ; ObjectHelper . requireNonNull ( bufferSupplier , "bufferSupplier is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableBuffer < T , U > ( this , count , skip , bufferSupplier ) ) ; }


Input: Returns a Flowable that emits buffers of items it collects from the source Publisher . The resulting Publisher emits connected non - overlapping buffers each containing { @code count } items . When the source Publisher completes the resulting Publisher emits the current buffer and propagates the notification from the source Publisher . Note that if the source Publisher issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / buffer3 . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream and expects the source { @code Publisher } to honor it as well although not enforced ; violation <em > may< / em > lead to { @code MissingBackpressureException } somewhere downstream . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code buffer } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U extends Collection < ? super T > > Flowable < U > buffer ( int count , Callable < U > bufferSupplier ) { return buffer ( count , count , bufferSupplier ) ; }


Input: Returns a Flowable that emits buffers of items it collects from the source Publisher . The resulting Publisher starts a new buffer periodically as determined by the { @code timeskip } argument . It emits each buffer after a fixed timespan specified by the { @code timespan } argument . When the source Publisher completes the resulting Publisher emits the current buffer and propagates the notification from the source Publisher . Note that if the source Publisher issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / buffer7 . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it uses time . It requests { @code Long . MAX_VALUE } upstream and does not obey downstream requests . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code buffer } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Flowable < List < T > > buffer ( long timespan , long timeskip , TimeUnit unit ) { return buffer ( timespan , timeskip , unit , Schedulers . computation ( ) , ArrayListSupplier . < T > asCallable ( ) ) ; }


Input: Returns a Flowable that emits buffers of items it collects from the source Publisher . The resulting Publisher starts a new buffer periodically as determined by the { @code timeskip } argument and on the specified { @code scheduler } . It emits each buffer after a fixed timespan specified by the { @code timespan } argument . When the source Publisher completes the resulting Publisher emits the current buffer and propagates the notification from the source Publisher . Note that if the source Publisher issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / buffer7 . s . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it uses time . It requests { @code Long . MAX_VALUE } upstream and does not obey downstream requests . < / 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 < U extends Collection < ? super T > > Flowable < U > buffer ( long timespan , long timeskip , TimeUnit unit , Scheduler scheduler , Callable < U > bufferSupplier ) { ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; ObjectHelper . requireNonNull ( bufferSupplier , "bufferSupplier is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableBufferTimed < T , U > ( this , timespan , timeskip , unit , scheduler , bufferSupplier , Integer . MAX_VALUE , false ) ) ; }


Input: Returns a Flowable that emits buffers of items it collects from the source Publisher . The resulting Publisher emits connected non - overlapping buffers each of a fixed duration specified by the { @code timespan } argument . When the source Publisher completes the resulting Publisher emits the current buffer and propagates the notification from the source Publisher . Note that if the source Publisher issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / buffer5 . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it uses time . It requests { @code Long . MAX_VALUE } upstream and does not obey downstream requests . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code buffer } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Flowable < List < T > > buffer ( long timespan , TimeUnit unit ) { return buffer ( timespan , unit , Schedulers . computation ( ) , Integer . MAX_VALUE ) ; }


Input: Returns a Flowable that emits buffers of items it collects from the source Publisher . The resulting Publisher emits connected non - overlapping buffers each of a fixed duration specified by the { @code timespan } argument as measured on the specified { @code scheduler } or a maximum size specified by the { @code count } argument ( whichever is reached first ) . When the source Publisher completes the resulting Publisher emits the current buffer and propagates the notification from the source Publisher . Note that if the source Publisher issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / buffer6 . s . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it uses time . It requests { @code Long . MAX_VALUE } upstream and does not obey downstream requests . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Flowable < List < T > > buffer ( long timespan , TimeUnit unit , Scheduler scheduler , int count ) { return buffer ( timespan , unit , scheduler , count , ArrayListSupplier . < T > asCallable ( ) , false ) ; }


Input: Returns a Flowable that emits buffers of items it collects from the source Publisher . The resulting Publisher emits connected non - overlapping buffers each of a fixed duration specified by the { @code timespan } argument as measured on the specified { @code scheduler } or a maximum size specified by the { @code count } argument ( whichever is reached first ) . When the source Publisher completes the resulting Publisher emits the current buffer and propagates the notification from the source Publisher . Note that if the source Publisher issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / buffer6 . s . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it uses time . It requests { @code Long . MAX_VALUE } upstream and does not obey downstream requests . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final < U extends Collection < ? super T > > Flowable < U > buffer ( long timespan , TimeUnit unit , Scheduler scheduler , int count , Callable < U > bufferSupplier , boolean restartTimerOnMaxSize ) { ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; ObjectHelper . requireNonNull ( bufferSupplier , "bufferSupplier is null" ) ; ObjectHelper . verifyPositive ( count , "count" ) ; return RxJavaPlugins . onAssembly ( new FlowableBufferTimed < T , U > ( this , timespan , timespan , unit , scheduler , bufferSupplier , count , restartTimerOnMaxSize ) ) ; }


Input: Returns a Flowable that emits buffers of items it collects from the source Publisher . The resulting Publisher emits buffers that it creates when the specified { @code openingIndicator } Publisher emits an item and closes when the Publisher returned from { @code closingIndicator } emits an item . If any of the source Publisher { @code openingIndicator } or { @code closingIndicator } issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling . <p > <img width = 640 height = 470 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / buffer2 . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it is instead controlled by the given Publishers and buffers data . It requests { @code Long . MAX_VALUE } upstream and does not obey downstream requests . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code buffer } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < TOpening , TClosing > Flowable < List < T > > buffer ( Flowable < ? extends TOpening > openingIndicator , Function < ? super TOpening , ? extends Publisher < ? extends TClosing > > closingIndicator ) { return buffer ( openingIndicator , closingIndicator , ArrayListSupplier . < T > asCallable ( ) ) ; }


Input: Returns a Flowable that emits buffers of items it collects from the source Publisher . The resulting Publisher emits buffers that it creates when the specified { @code openingIndicator } Publisher emits an item and closes when the Publisher returned from { @code closingIndicator } emits an item . If any of the source Publisher { @code openingIndicator } or { @code closingIndicator } issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling . <p > <img width = 640 height = 470 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / buffer2 . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it is instead controlled by the given Publishers and buffers data . It requests { @code Long . MAX_VALUE } upstream and does not obey downstream requests . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code buffer } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < TOpening , TClosing , U extends Collection < ? super T > > Flowable < U > buffer ( Flowable < ? extends TOpening > openingIndicator , Function < ? super TOpening , ? extends Publisher < ? extends TClosing > > closingIndicator , Callable < U > bufferSupplier ) { ObjectHelper . requireNonNull ( openingIndicator , "openingIndicator is null" ) ; ObjectHelper . requireNonNull ( closingIndicator , "closingIndicator is null" ) ; ObjectHelper . requireNonNull ( bufferSupplier , "bufferSupplier is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableBufferBoundary < T , U , TOpening , TClosing > ( this , openingIndicator , closingIndicator , bufferSupplier ) ) ; }


Input: Returns a Flowable that emits non - overlapping buffered items from the source Publisher each time the specified boundary Publisher emits an item . <p > <img width = 640 height = 395 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / buffer8 . png alt = > <p > Completion of either the source or the boundary Publisher causes the returned Publisher to emit the latest buffer and complete . If either the source Publisher or the boundary Publisher issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it is instead controlled by the { @code Publisher } { @code boundary } and buffers data . It requests { @code Long . MAX_VALUE } upstream and does not obey downstream requests . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code buffer } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < B > Flowable < List < T > > buffer ( Publisher < B > boundaryIndicator ) { return buffer ( boundaryIndicator , ArrayListSupplier . < T > asCallable ( ) ) ; }


Input: Returns a Flowable that emits non - overlapping buffered items from the source Publisher each time the specified boundary Publisher emits an item . <p > <img width = 640 height = 395 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / buffer8 . png alt = > <p > Completion of either the source or the boundary Publisher causes the returned Publisher to emit the latest buffer and complete . If either the source Publisher or the boundary Publisher issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it is instead controlled by the { @code Publisher } { @code boundary } and buffers data . It requests { @code Long . MAX_VALUE } upstream and does not obey downstream requests . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code buffer } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < B > Flowable < List < T > > buffer ( Publisher < B > boundaryIndicator , final int initialCapacity ) { ObjectHelper . verifyPositive ( initialCapacity , "initialCapacity" ) ; return buffer ( boundaryIndicator , Functions . < T > createArrayList ( initialCapacity ) ) ; }


Input: Returns a Flowable that emits non - overlapping buffered items from the source Publisher each time the specified boundary Publisher emits an item . <p > <img width = 640 height = 395 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / buffer8 . png alt = > <p > Completion of either the source or the boundary Publisher causes the returned Publisher to emit the latest buffer and complete . If either the source Publisher or the boundary Publisher issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it is instead controlled by the { @code Publisher } { @code boundary } and buffers data . It requests { @code Long . MAX_VALUE } upstream and does not obey downstream requests . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code buffer } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < B , U extends Collection < ? super T > > Flowable < U > buffer ( Publisher < B > boundaryIndicator , Callable < U > bufferSupplier ) { ObjectHelper . requireNonNull ( boundaryIndicator , "boundaryIndicator is null" ) ; ObjectHelper . requireNonNull ( bufferSupplier , "bufferSupplier is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableBufferExactBoundary < T , U , B > ( this , boundaryIndicator , bufferSupplier ) ) ; }


Input: Returns a Flowable that subscribes to this Publisher lazily caches all of its events and replays them in the same order as received to all the downstream subscribers . <p > <img width = 640 height = 410 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / cache . png alt = > <p > This is useful when you want a Publisher to cache responses and you can t control the subscribe / cancel behavior of all the { @link Subscriber } s . <p > The operator subscribes only when the first downstream subscriber subscribes and maintains a single subscription towards this Publisher . In contrast the operator family of { @link #replay () } that return a { @link ConnectableFlowable } require an explicit call to { @link ConnectableFlowable#connect () } . <p > <em > Note : < / em > You sacrifice the ability to cancel the origin when you use the { @code cache } Subscriber so be careful not to use this Subscriber on Publishers that emit an infinite or very large number of items that will use up memory . A possible workaround is to apply takeUntil with a predicate or another source before ( and perhaps after ) the application of cache () . <pre > <code > AtomicBoolean shouldStop = new AtomicBoolean () ; [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > cache ( ) { return cacheWithInitialCapacity ( 16 ) ; }


Input: Returns a Flowable that subscribes to this Publisher lazily caches all of its events and replays them in the same order as received to all the downstream subscribers . <p > <img width = 640 height = 410 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / cache . png alt = > <p > This is useful when you want a Publisher to cache responses and you can t control the subscribe / cancel behavior of all the { @link Subscriber } s . <p > The operator subscribes only when the first downstream subscriber subscribes and maintains a single subscription towards this Publisher . In contrast the operator family of { @link #replay () } that return a { @link ConnectableFlowable } require an explicit call to { @link ConnectableFlowable#connect () } . <p > <em > Note : < / em > You sacrifice the ability to cancel the origin when you use the { @code cache } Subscriber so be careful not to use this Subscriber on Publishers that emit an infinite or very large number of items that will use up memory . A possible workaround is to apply takeUntil with a predicate or another source before ( and perhaps after ) the application of cache () . <pre > <code > AtomicBoolean shouldStop = new AtomicBoolean () ; [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > cacheWithInitialCapacity ( int initialCapacity ) { ObjectHelper . verifyPositive ( initialCapacity , "initialCapacity" ) ; return RxJavaPlugins . onAssembly ( new FlowableCache < T > ( this , initialCapacity ) ) ; }


Input: Collects items emitted by the finite source Publisher into a single mutable data structure and returns a Single that emits this structure . <p > <img width = 640 height = 330 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / collect . png alt = > <p > This is a simplified version of { @code reduce } that does not need to return the state on each pass . <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 > This operator does not support backpressure because by intent it will receive all values and reduce them to a single { @code onNext } . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code collect } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U > Single < U > collect ( Callable < ? extends U > initialItemSupplier , BiConsumer < ? super U , ? super T > collector ) { ObjectHelper . requireNonNull ( initialItemSupplier , "initialItemSupplier is null" ) ; ObjectHelper . requireNonNull ( collector , "collector is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableCollectSingle < T , U > ( this , initialItemSupplier , collector ) ) ; }


Input: Transform a Publisher by applying a particular Transformer function to it . <p > This method operates on the Publisher itself whereas { @link #lift } operates on the Publisher s Subscribers or Subscribers . <p > If the operator you are creating is designed to act on the individual items emitted by a source Publisher use { @link #lift } . If your operator is designed to transform the source Publisher as a whole ( for instance by applying a particular set of existing RxJava operators to it ) use { @code compose } . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator itself doesn t interfere with the backpressure behavior which only depends on what kind of { @code Publisher } the transformer returns . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code compose } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ SuppressWarnings ( "unchecked" ) @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Flowable < R > compose ( FlowableTransformer < ? super T , ? extends R > composer ) { return fromPublisher ( ( ( FlowableTransformer < T , R > ) ObjectHelper . requireNonNull ( composer , "composer is null" ) ) . apply ( this ) ) ; }


Input: Maps the upstream items into { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) @ BackpressureSupport ( BackpressureKind . FULL ) public final Completable concatMapCompletable ( Function < ? super T , ? extends CompletableSource > mapper ) { return concatMapCompletable ( mapper , 2 ) ; }


Input: Maps the upstream items into { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) @ BackpressureSupport ( BackpressureKind . FULL ) public final Completable concatMapCompletableDelayError ( Function < ? super T , ? extends CompletableSource > mapper , boolean tillTheEnd ) { return concatMapCompletableDelayError ( mapper , tillTheEnd , 2 ) ; }


Input: Maps the upstream items into { [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) @ BackpressureSupport ( BackpressureKind . FULL ) public final Completable concatMapCompletableDelayError ( Function < ? super T , ? extends CompletableSource > mapper , boolean tillTheEnd , int prefetch ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; ObjectHelper . verifyPositive ( prefetch , "prefetch" ) ; return RxJavaPlugins . onAssembly ( new FlowableConcatMapCompletable < T > ( this , mapper , tillTheEnd ? ErrorMode . END : ErrorMode . BOUNDARY , prefetch ) ) ; }


Input: Maps each of the items into a Publisher subscribes to them one after the other one at a time and emits their values in order while delaying any error from either this or any of the inner Publishers till all of them terminate . [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Flowable < R > concatMapDelayError ( Function < ? super T , ? extends Publisher < ? extends R > > mapper ) { return concatMapDelayError ( mapper , 2 , true ) ; }


Input: Maps a sequence of values into Publishers and concatenates these Publishers eagerly into a single Publisher . <p > Eager concatenation means that once a subscriber subscribes this operator subscribes to all of the source Publishers . The operator buffers the values emitted by these Publishers and then drains them in order each one after the previous one completes . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > Backpressure is honored towards the downstream however due to the eagerness requirement sources are subscribed to in unbounded mode and their values are queued up in an unbounded buffer . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This method does not operate by default on a particular { [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Flowable < R > concatMapEager ( Function < ? super T , ? extends Publisher < ? extends R > > mapper , int maxConcurrency , int prefetch ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; ObjectHelper . verifyPositive ( maxConcurrency , "maxConcurrency" ) ; ObjectHelper . verifyPositive ( prefetch , "prefetch" ) ; return RxJavaPlugins . onAssembly ( new FlowableConcatMapEager < T , R > ( this , mapper , maxConcurrency , prefetch , ErrorMode . IMMEDIATE ) ) ; }


Input: Returns a Flowable that concatenate each item emitted by the source Publisher with the values in an Iterable corresponding to that item that is generated by a selector . [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U > Flowable < U > concatMapIterable ( Function < ? super T , ? extends Iterable < ? extends U > > mapper ) { return concatMapIterable ( mapper , 2 ) ; }


Input: Maps the upstream items into { [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Flowable < R > concatMapMaybe ( Function < ? super T , ? extends MaybeSource < ? extends R > > mapper ) { return concatMapMaybe ( mapper , 2 ) ; }


Input: Maps the upstream items into { [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Flowable < R > concatMapSingle ( Function < ? super T , ? extends SingleSource < ? extends R > > mapper , int prefetch ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; ObjectHelper . verifyPositive ( prefetch , "prefetch" ) ; return RxJavaPlugins . onAssembly ( new FlowableConcatMapSingle < T , R > ( this , mapper , ErrorMode . IMMEDIATE , prefetch ) ) ; }


Input: Maps the upstream items into { [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Flowable < R > concatMapSingleDelayError ( Function < ? super T , ? extends SingleSource < ? extends R > > mapper ) { return concatMapSingleDelayError ( mapper , true , 2 ) ; }


Input: Returns a { [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > concatWith ( @ NonNull SingleSource < ? extends T > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableConcatWithSingle < T > ( this , other ) ) ; }


Input: Returns a { [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > concatWith ( @ NonNull MaybeSource < ? extends T > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableConcatWithMaybe < T > ( this , other ) ) ; }


Input: Returns a { [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > concatWith ( @ NonNull CompletableSource other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableConcatWithCompletable < T > ( this , other ) ) ; }


Input: Returns a Single that emits a Boolean that indicates whether the source Publisher emitted a specified item . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / contains . 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 contains } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < Boolean > contains ( final Object item ) { ObjectHelper . requireNonNull ( item , "item is null" ) ; return any ( Functions . equalsWith ( item ) ) ; }


Input: Returns a Single that counts the total number of items emitted by the source Publisher and emits this count as a 64 - bit Long . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / longCount . 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 count } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < Long > count ( ) { return RxJavaPlugins . onAssembly ( new FlowableCountSingle < T > ( this ) ) ; }


Input: Returns a Flowable that mirrors the source Publisher except that it drops items emitted by the source Publisher that are followed by another item within a computed debounce duration . <p > <img width = 640 height = 425 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / debounce . f . png alt = > <p > The delivery of the item happens on the thread of the first { @code onNext } or { @code onComplete } signal of the generated { @code Publisher } sequence which if takes too long a newer item may arrive from the upstream causing the generated sequence to get cancelled which may also interrupt any downstream blocking operation ( yielding an { @code InterruptedException } ) . It is recommended processing items that may take long time to be moved to another thread via { @link #observeOn } applied after { @code debounce } itself . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it uses the { @code debounceSelector } to mark boundaries . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code debounce } 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 > debounce ( Function < ? super T , ? extends Publisher < U > > debounceIndicator ) { ObjectHelper . requireNonNull ( debounceIndicator , "debounceIndicator is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableDebounce < T , U > ( this , debounceIndicator ) ) ; }


Input: Returns a Flowable that mirrors the source Publisher except that it drops items emitted by the source Publisher that are followed by newer items before a timeout value expires on a specified Scheduler . The timer resets on each emission . <p > <em > Note : < / em > If items keep being emitted by the source Publisher faster than the timeout then no items will be emitted by the resulting Publisher . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / debounce . s . png alt = > <p > Delivery of the item after the grace period happens on the given { @code Scheduler } s { @code Worker } which if takes too long a newer item may arrive from the upstream causing the { @code Worker } s task to get disposed which may also interrupt any downstream blocking operation ( yielding an { @code InterruptedException } ) . It is recommended processing items that may take long time to be moved to another thread via { @link #observeOn } applied after { @code debounce } itself . <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 > debounce ( long timeout , TimeUnit unit , Scheduler scheduler ) { ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableDebounceTimed < T > ( this , timeout , unit , scheduler ) ) ; }


Input: Returns a Flowable that emits the items emitted by the source Publisher shifted forward in time by a specified delay . If { @code delayError } is true error notifications will also be delayed . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / delay . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator doesn t interfere with the backpressure behavior which is determined by the source { @code Publisher } . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code delay } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Flowable < T > delay ( long delay , TimeUnit unit , boolean delayError ) { return delay ( delay , unit , Schedulers . computation ( ) , delayError ) ; }


Input: Returns a Flowable that emits the items emitted by the source Publisher shifted forward in time by a specified delay . Error notifications from the source Publisher are not delayed . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / delay . s . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator doesn t interfere with the backpressure behavior which is determined by the source { @code Publisher } . < / 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 > delay ( long delay , TimeUnit unit , Scheduler scheduler ) { return delay ( delay , unit , scheduler , false ) ; }


Input: Returns a Flowable that delays the subscription to and emissions from the source Publisher via another Publisher on a per - item basis . <p > <img width = 640 height = 450 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / delay . oo . png alt = > <p > <em > Note : < / em > the resulting Publisher will immediately propagate any { @code onError } notification from the source Publisher . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator doesn t interfere with the backpressure behavior which is determined by the source { @code Publisher } . All of the other { @code Publisher } s supplied by the functions are consumed in an unbounded manner ( i . e . no backpressure applied to them ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code delay } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U , V > Flowable < T > delay ( Publisher < U > subscriptionIndicator , Function < ? super T , ? extends Publisher < V > > itemDelayIndicator ) { return delaySubscription ( subscriptionIndicator ) . delay ( itemDelayIndicator ) ; }


Input: Returns a Flowable that reverses the effect of { @link #materialize materialize } by transforming the { @link Notification } objects emitted by the source Publisher into the items or notifications they represent . <p > <img width = 640 height = 335 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / dematerialize . png alt = > <p > When the upstream signals an { @link Notification#createOnError ( Throwable ) onError } or { @link Notification#createOnComplete () onComplete } item the returned Flowable cancels the flow and terminates with that type of terminal event : <pre > <code > Flowable . just ( createOnNext ( 1 ) createOnComplete () createOnNext ( 2 )) . doOnCancel (( ) - &gt ; System . out . println ( Cancelled! )) ; . dematerialize () . test () . assertResult ( 1 ) ; < / code > < / pre > If the upstream signals { @code onError } or { @code onComplete } directly the flow is terminated with the same event . <pre > <code > Flowable . just ( createOnNext ( 1 ) createOnNext ( 2 )) . dematerialize () . test () . assertResult ( 1 2 ) ; < / code > < / pre > If this behavior is not desired the completion can be suppressed by applying { @link #concatWith ( Publisher ) } with a { @link #never () } source . <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 dematerialize } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ Deprecated @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public final < T2 > Flowable < T2 > dematerialize ( ) { return RxJavaPlugins . onAssembly ( new FlowableDematerialize ( this , Functions . identity ( ) ) ) ; }


Input: Returns a Flowable that reverses the effect of { @link #materialize materialize } by transforming the { @link Notification } objects extracted from the source items via a selector function into their respective { @code Subscriber } signal types . <p > <img width = 640 height = 335 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / dematerialize . png alt = > <p > The intended use of the { @code selector } function is to perform a type - safe identity mapping ( see example ) on a source that is already of type { @code Notification<T > } . The Java language doesn t allow limiting instance methods to a certain generic argument shape therefore a function is used to ensure the conversion remains type safe . <p > When the upstream signals an { @link Notification#createOnError ( Throwable ) onError } or { @link Notification#createOnComplete () onComplete } item the returned Flowable cancels of the flow and terminates with that type of terminal event : <pre > <code > Flowable . just ( createOnNext ( 1 ) createOnComplete () createOnNext ( 2 )) . doOnCancel (( ) - &gt ; System . out . println ( Canceled! )) ; . dematerialize ( notification - &gt ; notification ) . test () . assertResult ( 1 ) ; < / code > < / pre > If the upstream signals { @code onError } or { @code onComplete } directly the flow is terminated with the same event . <pre > <code > Flowable . just ( createOnNext ( 1 ) createOnNext ( 2 )) . dematerialize ( notification - &gt ; notification ) . test () . assertResult ( 1 2 ) ; < / code > < / pre > If this behavior is not desired the completion can be suppressed by applying { @link #concatWith ( Publisher ) } with a { @link #never () } source . <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 dematerialize } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ Experimental @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) public final < R > Flowable < R > dematerialize ( Function < ? super T , Notification < R > > selector ) { ObjectHelper . requireNonNull ( selector , "selector is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableDematerialize < T , R > ( this , selector ) ) ; }


Input: Returns a Flowable that emits all items emitted by the source Publisher that are distinct based on { @link Object#equals ( Object ) } comparison . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / distinct . png alt = > <p > It is recommended the elements class { @code T } in the flow overrides the default { @code Object . equals () } and { @link Object#hashCode () } to provide a meaningful comparison between items as the default Java implementation only considers reference equivalence . <p > By default { @code distinct () } uses an internal { @link java . util . HashSet } per Subscriber to remember previously seen items and uses { @link java . util . Set#add ( Object ) } returning { @code false } as the indicator for duplicates . <p > Note that this internal { @code HashSet } may grow unbounded as items won t be removed from it by the operator . Therefore using very long or infinite upstream ( with very distinct elements ) may lead to { @code OutOfMemoryError } . <p > Customizing the retention policy can happen only by providing a custom { @link java . util . Collection } implementation to the { @link #distinct ( Function Callable ) } overload . <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 distinct } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > distinct ( ) { return distinct ( ( Function ) Functions . identity ( ) , Functions . < T > createHashSet ( ) ) ; }


Input: Returns a Flowable that emits all items emitted by the source Publisher that are distinct according to a key selector function and based on { @link Object#equals ( Object ) } comparison of the objects returned by the key selector function . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / distinct . key . png alt = > <p > It is recommended the keys class { @code K } overrides the default { @code Object . equals () } and { @link Object#hashCode () } to provide a meaningful comparison between the key objects as the default Java implementation only considers reference equivalence . <p > By default { @code distinct () } uses an internal { @link java . util . HashSet } per Subscriber to remember previously seen keys and uses { @link java . util . Set#add ( Object ) } returning { @code false } as the indicator for duplicates . <p > Note that this internal { @code HashSet } may grow unbounded as keys won t be removed from it by the operator . Therefore using very long or infinite upstream ( with very distinct keys ) may lead to { @code OutOfMemoryError } . <p > Customizing the retention policy can happen only by providing a custom { @link java . util . Collection } implementation to the { @link #distinct ( Function Callable ) } overload . <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 distinct } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < K > Flowable < T > distinct ( Function < ? super T , K > keySelector ) { return distinct ( keySelector , Functions . < K > createHashSet ( ) ) ; }


Input: Returns a Flowable that emits all items emitted by the source Publisher that are distinct according to a key selector function and based on { @link Object#equals ( Object ) } comparison of the objects returned by the key selector function . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / distinct . key . png alt = > <p > It is recommended the keys class { @code K } overrides the default { @code Object . equals () } and { @link Object#hashCode () } to provide a meaningful comparison between the key objects as the default Java implementation only considers reference equivalence . <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 distinct } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < K > Flowable < T > distinct ( Function < ? super T , K > keySelector , Callable < ? extends Collection < ? super K > > collectionSupplier ) { ObjectHelper . requireNonNull ( keySelector , "keySelector is null" ) ; ObjectHelper . requireNonNull ( collectionSupplier , "collectionSupplier is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableDistinct < T , K > ( this , keySelector , collectionSupplier ) ) ; }


Input: Returns a Flowable that emits all items emitted by the source Publisher that are distinct from their immediate predecessors based on { @link Object#equals ( Object ) } comparison . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / distinctUntilChanged . png alt = > <p > It is recommended the elements class { @code T } in the flow overrides the default { @code Object . equals () } to provide a meaningful comparison between items as the default Java implementation only considers reference equivalence . Alternatively use the { @link #distinctUntilChanged ( BiPredicate ) } overload and provide a comparison function in case the class { @code T } can t be overridden with custom { @code equals () } or the comparison itself should happen on different terms or properties of the class { @code T } . <p > Note that the operator always retains the latest item from upstream regardless of the comparison result and uses it in the next comparison with the next upstream item . <p > Note that if element type { @code T } in the flow is mutable the comparison of the previous and current item may yield unexpected results if the items are mutated externally . Common cases are mutable { @code CharSequence } s or { @code List } s where the objects will actually have the same references when they are modified and { @code distinctUntilChanged } will evaluate subsequent items as same . To avoid such situation it is recommended that mutable data is converted to an immutable one for example using { @code map ( CharSequence :: toString ) } or { @code map ( list - > Collections . unmodifiableList ( new ArrayList< > ( list ))) } . <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 distinctUntilChanged } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > distinctUntilChanged ( ) { return distinctUntilChanged ( Functions . identity ( ) ) ; }


Input: Returns a Flowable that emits all items emitted by the source Publisher that are distinct from their immediate predecessors according to a key selector function and based on { @link Object#equals ( Object ) } comparison of those objects returned by the key selector function . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / distinctUntilChanged . key . png alt = > <p > It is recommended the keys class { @code K } overrides the default { @code Object . equals () } to provide a meaningful comparison between the key objects as the default Java implementation only considers reference equivalence . Alternatively use the { @link #distinctUntilChanged ( BiPredicate ) } overload and provide a comparison function in case the class { @code K } can t be overridden with custom { @code equals () } or the comparison itself should happen on different terms or properties of the item class { @code T } ( for which the keys can be derived via a similar selector ) . <p > Note that the operator always retains the latest key from upstream regardless of the comparison result and uses it in the next comparison with the next key derived from the next upstream item . <p > Note that if element type { @code T } in the flow is mutable the comparison of the previous and current item may yield unexpected results if the items are mutated externally . Common cases are mutable { @code CharSequence } s or { @code List } s where the objects will actually have the same references when they are modified and { @code distinctUntilChanged } will evaluate subsequent items as same . To avoid such situation it is recommended that mutable data is converted to an immutable one for example using { @code map ( CharSequence :: toString ) } or { @code map ( list - > Collections . unmodifiableList ( new ArrayList< > ( list ))) } . <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 distinctUntilChanged } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < K > Flowable < T > distinctUntilChanged ( Function < ? super T , K > keySelector ) { ObjectHelper . requireNonNull ( keySelector , "keySelector is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableDistinctUntilChanged < T , K > ( this , keySelector , ObjectHelper . equalsPredicate ( ) ) ) ; }


Input: Returns a Flowable that emits all items emitted by the source Publisher that are distinct from their immediate predecessors when compared with each other via the provided comparator function . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / distinctUntilChanged . png alt = > <p > Note that the operator always retains the latest item from upstream regardless of the comparison result and uses it in the next comparison with the next upstream item . <p > Note that if element type { @code T } in the flow is mutable the comparison of the previous and current item may yield unexpected results if the items are mutated externally . Common cases are mutable { @code CharSequence } s or { @code List } s where the objects will actually have the same references when they are modified and { @code distinctUntilChanged } will evaluate subsequent items as same . To avoid such situation it is recommended that mutable data is converted to an immutable one for example using { @code map ( CharSequence :: toString ) } or { @code map ( list - > Collections . unmodifiableList ( new ArrayList< > ( list ))) } . <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 distinctUntilChanged } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > distinctUntilChanged ( BiPredicate < ? super T , ? super T > comparer ) { ObjectHelper . requireNonNull ( comparer , "comparer is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableDistinctUntilChanged < T , T > ( this , Functions . < T > identity ( ) , comparer ) ) ; }


Input: Calls the specified action after this Flowable signals onError or onCompleted or gets canceled by the downstream . <p > In case of a race between a terminal event and a cancellation the provided { [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > doFinally ( Action onFinally ) { ObjectHelper . requireNonNull ( onFinally , "onFinally is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableDoFinally < T > ( this , onFinally ) ) ; }


Input: Calls the specified consumer with the current item after this item has been emitted to the downstream . <p > Note that the { [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > doAfterNext ( Consumer < ? super T > onAfterNext ) { ObjectHelper . requireNonNull ( onAfterNext , "onAfterNext is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableDoAfterNext < T > ( this , onAfterNext ) ) ; }


Input: Registers an { @link Action } to be called when this Publisher invokes either { @link Subscriber#onComplete onComplete } or { @link Subscriber#onError onError } . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / finallyDo . 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 doAfterTerminate } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > doAfterTerminate ( Action onAfterTerminate ) { return doOnEach ( Functions . emptyConsumer ( ) , Functions . emptyConsumer ( ) , Functions . EMPTY_ACTION , onAfterTerminate ) ; }


Input: Calls the cancel { @code Action } if the downstream cancels the sequence . <p > The action is shared between subscriptions and thus may be called concurrently from multiple threads ; the action must be thread - safe . <p > If the action throws a runtime exception that exception is rethrown by the { @code onCancel () } call sometimes as a { @code CompositeException } if there were multiple exceptions along the way . <p > Note that terminal events trigger the action unless the { @code Publisher } is subscribed to via { @code unsafeSubscribe () } . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnUnsubscribe . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > { @code doOnCancel } does not interact with backpressure requests or value delivery ; backpressure behavior is preserved between its upstream and its downstream . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code doOnCancel } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > doOnCancel ( Action onCancel ) { return doOnLifecycle ( Functions . emptyConsumer ( ) , Functions . EMPTY_LONG_CONSUMER , onCancel ) ; }


Input: Modifies the source Publisher so that it invokes an action when it calls { @code onComplete } . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnComplete . 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 doOnComplete } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > doOnComplete ( Action onComplete ) { return doOnEach ( Functions . emptyConsumer ( ) , Functions . emptyConsumer ( ) , onComplete , Functions . EMPTY_ACTION ) ; }


Input: Calls the appropriate onXXX consumer ( shared between all subscribers ) whenever a signal with the same type passes through before forwarding them to downstream . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnEach . 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 doOnEach } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) private Flowable < T > doOnEach ( Consumer < ? super T > onNext , Consumer < ? super Throwable > onError , Action onComplete , Action onAfterTerminate ) { ObjectHelper . requireNonNull ( onNext , "onNext is null" ) ; ObjectHelper . requireNonNull ( onError , "onError is null" ) ; ObjectHelper . requireNonNull ( onComplete , "onComplete is null" ) ; ObjectHelper . requireNonNull ( onAfterTerminate , "onAfterTerminate is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableDoOnEach < T > ( this , onNext , onError , onComplete , onAfterTerminate ) ) ; }


Input: Modifies the source Publisher so that it invokes an action for each item it emits . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnEach . 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 doOnEach } 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 > doOnEach ( final Consumer < ? super Notification < T > > onNotification ) { ObjectHelper . requireNonNull ( onNotification , "onNotification is null" ) ; return doOnEach ( Functions . notificationOnNext ( onNotification ) , Functions . notificationOnError ( onNotification ) , Functions . notificationOnComplete ( onNotification ) , Functions . EMPTY_ACTION ) ; }


Input: Modifies the source Publisher so that it notifies a Subscriber for each item and terminal event it emits . <p > In case the { @code onError } of the supplied Subscriber throws the downstream will receive a composite exception containing the original exception and the exception thrown by { @code onError } . If either the { @code onNext } or the { @code onComplete } method of the supplied Subscriber throws the downstream will be terminated and will receive this thrown exception . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnEach . o . 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 doOnEach } 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 > doOnEach ( final Subscriber < ? super T > subscriber ) { ObjectHelper . requireNonNull ( subscriber , "subscriber is null" ) ; return doOnEach ( FlowableInternalHelper . subscriberOnNext ( subscriber ) , FlowableInternalHelper . subscriberOnError ( subscriber ) , FlowableInternalHelper . subscriberOnComplete ( subscriber ) , Functions . EMPTY_ACTION ) ; }


Input: Modifies the source Publisher so that it invokes an action if it calls { @code onError } . <p > In case the { @code onError } action throws the downstream will receive a composite exception containing the original exception and the exception thrown by { @code onError } . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnError . 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 doOnError } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > doOnError ( Consumer < ? super Throwable > onError ) { return doOnEach ( Functions . emptyConsumer ( ) , onError , Functions . EMPTY_ACTION , Functions . EMPTY_ACTION ) ; }


Input: Modifies the source Publisher so that it invokes an action when it calls { @code onNext } . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnNext . 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 doOnNext } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > doOnNext ( Consumer < ? super T > onNext ) { return doOnEach ( onNext , Functions . emptyConsumer ( ) , Functions . EMPTY_ACTION , Functions . EMPTY_ACTION ) ; }


Input: Modifies the source { @code Publisher } so that it invokes the given action when it receives a request for more items . <p > <b > Note : < / b > This operator is for tracing the internal behavior of back - pressure request patterns and generally intended for debugging use . <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 doOnRequest } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > doOnRequest ( LongConsumer onRequest ) { return doOnLifecycle ( Functions . emptyConsumer ( ) , onRequest , Functions . EMPTY_ACTION ) ; }


Input: Modifies the source { @code Publisher } so that it invokes the given action when it is subscribed from its subscribers . Each subscription will result in an invocation of the given action except when the source { @code Publisher } is reference counted in which case the source { @code Publisher } will invoke the given action for the first subscription . <p > <img width = 640 height = 390 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnSubscribe . 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 doOnSubscribe } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > doOnSubscribe ( Consumer < ? super Subscription > onSubscribe ) { return doOnLifecycle ( onSubscribe , Functions . EMPTY_LONG_CONSUMER , Functions . EMPTY_ACTION ) ; }


Input: Modifies the source Publisher so that it invokes an action when it calls { @code onComplete } or { @code onError } . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnTerminate . png alt = > <p > This differs from { @code doAfterTerminate } in that this happens <em > before< / em > the { @code onComplete } or { @code onError } notification . <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 doOnTerminate } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > doOnTerminate ( final Action onTerminate ) { return doOnEach ( Functions . emptyConsumer ( ) , Functions . actionConsumer ( onTerminate ) , onTerminate , Functions . EMPTY_ACTION ) ; }


Input: Returns a Maybe that emits the single item at a specified index in a sequence of emissions from this Flowable or completes if this Flowable sequence has fewer elements than index . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / elementAt . 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 applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code elementAt } 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 > elementAt ( long index ) { if ( index < 0 ) { throw new IndexOutOfBoundsException ( "index >= 0 required but it was " + index ) ; } return RxJavaPlugins . onAssembly ( new FlowableElementAtMaybe < T > ( this , index ) ) ; }


Input: Returns a Single that emits the item found at a specified index in a sequence of emissions from this Flowable or signals a { @link NoSuchElementException } if this Flowable has fewer elements than index . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / elementAtOrDefault . 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 applied to it ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code elementAtOrError } 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 > elementAtOrError ( long index ) { if ( index < 0 ) { throw new IndexOutOfBoundsException ( "index >= 0 required but it was " + index ) ; } return RxJavaPlugins . onAssembly ( new FlowableElementAtSingle < T > ( this , index , null ) ) ; }


Input: Filters items emitted by a Publisher by only emitting those that satisfy a specified predicate . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / filter . 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 filter } 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 > filter ( Predicate < ? super T > predicate ) { ObjectHelper . requireNonNull ( predicate , "predicate is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableFilter < T > ( this , predicate ) ) ; }


Input: Returns a Maybe that emits only the very first item emitted by this Flowable or completes if this Flowable is empty . <p > <img width = 640 height = 237 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / firstElement . m . 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 firstElement } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . SPECIAL ) // take may trigger UNBOUNDED_IN @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > firstElement ( ) { return elementAt ( 0 ) ; }


Input: Returns a Single that emits only the very first item emitted by this Flowable or a default item if this Flowable completes without emitting anything . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / first . s . 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 first } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . SPECIAL ) // take may trigger UNBOUNDED_IN @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > first ( T defaultItem ) { return elementAt ( 0 , defaultItem ) ; }


Input: Returns a Single that emits only the very first item emitted by this Flowable or signals a { @link NoSuchElementException } if this Flowable is empty . <p > <img width = 640 height = 237 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / firstOrError . 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 firstOrError } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . SPECIAL ) // take may trigger UNBOUNDED_IN @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > firstOrError ( ) { return elementAtOrError ( 0 ) ; }


Input: Returns a Flowable that emits items based on applying a function that you supply to each item emitted by the source Publisher where that function returns a Publisher and then merging those resulting Publishers and emitting the results of this merger while limiting the maximum number of concurrent subscriptions to these Publishers . <! -- <p > -- > <! -- <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / flatMap . png alt = > -- > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream . The upstream Flowable is consumed in a bounded manner ( up to { @code maxConcurrency } outstanding request amount for items ) . The inner { @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 flatMap } 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 > flatMap ( Function < ? super T , ? extends Publisher < ? extends R > > mapper , boolean delayErrors , int maxConcurrency , int bufferSize ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; ObjectHelper . verifyPositive ( maxConcurrency , "maxConcurrency" ) ; ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; if ( this instanceof ScalarCallable ) { @ SuppressWarnings ( "unchecked" ) T v = ( ( ScalarCallable < T > ) this ) . call ( ) ; if ( v == null ) { return empty ( ) ; } return FlowableScalarXMap . scalarXMap ( v , mapper ) ; } return RxJavaPlugins . onAssembly ( new FlowableFlatMap < T , R > ( this , mapper , delayErrors , maxConcurrency , bufferSize ) ) ; }


Input: Returns a Flowable that applies a function to each item emitted or notification raised by the source Publisher and then flattens the Publishers returned from these functions and emits the resulting items . <p > <img width = 640 height = 410 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / mergeMap . nce . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream . The upstream Flowable is consumed in a bounded manner ( up to { @link #bufferSize () } outstanding request amount for items ) . The inner { @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 flatMap } 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 > flatMap ( Function < ? super T , ? extends Publisher < ? extends R > > onNextMapper , Function < ? super Throwable , ? extends Publisher < ? extends R > > onErrorMapper , Callable < ? extends Publisher < ? extends R > > onCompleteSupplier ) { ObjectHelper . requireNonNull ( onNextMapper , "onNextMapper is null" ) ; ObjectHelper . requireNonNull ( onErrorMapper , "onErrorMapper is null" ) ; ObjectHelper . requireNonNull ( onCompleteSupplier , "onCompleteSupplier is null" ) ; return merge ( new FlowableMapNotification < T , Publisher < ? extends R > > ( this , onNextMapper , onErrorMapper , onCompleteSupplier ) ) ; }


Input: Returns a Flowable that emits the results of a specified function to the pair of values emitted by the source Publisher and a specified collection Publisher while limiting the maximum number of concurrent subscriptions to these Publishers . <! -- <p > -- > <! -- <img width = 640 height = 390 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / mergeMap . r . png alt = > -- > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream . The upstream Flowable is consumed in a bounded manner ( up to { @code maxConcurrency } outstanding request amount for items ) . The inner { @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 flatMap } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U , R > Flowable < R > flatMap ( final Function < ? super T , ? extends Publisher < ? extends U > > mapper , final BiFunction < ? super T , ? super U , ? extends R > combiner , boolean delayErrors , int maxConcurrency , int bufferSize ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; ObjectHelper . requireNonNull ( combiner , "combiner is null" ) ; ObjectHelper . verifyPositive ( maxConcurrency , "maxConcurrency" ) ; ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return flatMap ( FlowableInternalHelper . flatMapWithCombiner ( mapper , combiner ) , delayErrors , maxConcurrency , bufferSize ) ; }