Input: Maps each element of the upstream Observable into CompletableSources subscribes to them one at a time in order and waits until the upstream and all CompletableSources complete . <p > <img width = 640 height = 505 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / concatMapCompletable . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Completable concatMapCompletable ( Function < ? super T , ? extends CompletableSource > mapper ) { return concatMapCompletable ( mapper , 2 ) ; }


Input: Maps each element of the upstream Observable into CompletableSources subscribes to them one at a time in order and waits until the upstream and all CompletableSources complete . <p > <img width = 640 height = 505 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / concatMapCompletable . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code concatMapCompletable } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > <p > History : 2 . 1 . 6 - experimental @param mapper a function that when applied to an item emitted by the source ObservableSource returns a CompletableSource [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Completable concatMapCompletable ( Function < ? super T , ? extends CompletableSource > mapper , int capacityHint ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; ObjectHelper . verifyPositive ( capacityHint , "capacityHint" ) ; return RxJavaPlugins . onAssembly ( new ObservableConcatMapCompletable < T > ( this , mapper , ErrorMode . IMMEDIATE , capacityHint ) ) ; }


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


Input: Maps the upstream items into { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) 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 ObservableConcatMapCompletable < T > ( this , mapper , tillTheEnd ? ErrorMode . END : ErrorMode . BOUNDARY , prefetch ) ) ; }


Input: Returns an Observable that concatenate each item emitted by the source ObservableSource with the values in an Iterable corresponding to that item that is generated by a selector . <p > <img width = 640 height = 275 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / concatMapIterable . o . png alt = > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U > Observable < U > concatMapIterable ( final Function < ? super T , ? extends Iterable < ? extends U > > mapper ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableFlattenIterable < T , U > ( this , mapper ) ) ; }


Input: Returns an Observable that concatenate each item emitted by the source ObservableSource with the values in an Iterable corresponding to that item that is generated by a selector . <p > <img width = 640 height = 275 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / concatMapIterable . o . png alt = > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U > Observable < U > concatMapIterable ( final Function < ? super T , ? extends Iterable < ? extends U > > mapper , int prefetch ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; ObjectHelper . verifyPositive ( prefetch , "prefetch" ) ; return concatMap ( ObservableInternalHelper . flatMapIntoIterable ( mapper ) , prefetch ) ; }


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


Input: Maps the upstream items into { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > concatMapMaybe ( Function < ? super T , ? extends MaybeSource < ? extends R > > mapper , int prefetch ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; ObjectHelper . verifyPositive ( prefetch , "prefetch" ) ; return RxJavaPlugins . onAssembly ( new ObservableConcatMapMaybe < T , R > ( this , mapper , ErrorMode . IMMEDIATE , prefetch ) ) ; }


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


Input: Maps the upstream items into { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > concatMapMaybeDelayError ( Function < ? super T , ? extends MaybeSource < ? extends R > > mapper , boolean tillTheEnd , int prefetch ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; ObjectHelper . verifyPositive ( prefetch , "prefetch" ) ; return RxJavaPlugins . onAssembly ( new ObservableConcatMapMaybe < T , R > ( this , mapper , tillTheEnd ? ErrorMode . END : ErrorMode . BOUNDARY , prefetch ) ) ; }


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


Input: Maps the upstream items into { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < 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 ObservableConcatMapSingle < T , R > ( this , mapper , ErrorMode . IMMEDIATE , prefetch ) ) ; }


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


Input: Maps the upstream items into { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > concatMapSingleDelayError ( Function < ? super T , ? extends SingleSource < ? extends R > > mapper , boolean tillTheEnd , int prefetch ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; ObjectHelper . verifyPositive ( prefetch , "prefetch" ) ; return RxJavaPlugins . onAssembly ( new ObservableConcatMapSingle < T , R > ( this , mapper , tillTheEnd ? ErrorMode . END : ErrorMode . BOUNDARY , prefetch ) ) ; }


Input: Returns an Observable that emits the items emitted from the current ObservableSource then the next one after the other without interleaving them . <p > <img width = 640 height = 380 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / concat . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code concatWith } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > concatWith ( ObservableSource < ? extends T > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return concat ( this , other ) ; }


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


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


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


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


Input: Returns an Observable that mirrors the source ObservableSource except that it drops items emitted by the source ObservableSource 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 ObservableSource } sequence which if takes too long a newer item may arrive from the upstream causing the generated sequence 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 > Scheduler : < / b > < / dt > <dd > This version of { @code debounce } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U > Observable < T > debounce ( Function < ? super T , ? extends ObservableSource < U > > debounceSelector ) { ObjectHelper . requireNonNull ( debounceSelector , "debounceSelector is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableDebounce < T , U > ( this , debounceSelector ) ) ; }


Input: Returns an Observable that mirrors the source ObservableSource except that it drops items emitted by the source ObservableSource that are followed by newer items before a timeout value expires . The timer resets on each emission . <p > <em > Note : < / em > If items keep being emitted by the source ObservableSource faster than the timeout then no items will be emitted by the resulting ObservableSource . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / debounce . png alt = > <p > Delivery of the item after the grace period happens on the { @code computation } { @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 > Scheduler : < / b > < / dt > <dd > { @code debounce } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Observable < T > debounce ( long timeout , TimeUnit unit ) { return debounce ( timeout , unit , Schedulers . computation ( ) ) ; }


Input: Returns an Observable that mirrors the source ObservableSource except that it drops items emitted by the source ObservableSource 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 ObservableSource faster than the timeout then no items will be emitted by the resulting ObservableSource . <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 > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Observable < T > debounce ( long timeout , TimeUnit unit , Scheduler scheduler ) { ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableDebounceTimed < T > ( this , timeout , unit , scheduler ) ) ; }


Input: Returns an Observable that emits the items emitted by the source ObservableSource or a specified default item if the source ObservableSource is empty . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / defaultIfEmpty . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code defaultIfEmpty } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > defaultIfEmpty ( T defaultItem ) { ObjectHelper . requireNonNull ( defaultItem , "defaultItem is null" ) ; return switchIfEmpty ( just ( defaultItem ) ) ; }


Input: Returns an Observable that delays the emissions of the source ObservableSource via another ObservableSource on a per - item basis . <p > <img width = 640 height = 450 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / delay . o . png alt = > <p > <em > Note : < / em > the resulting ObservableSource will immediately propagate any { @code onError } notification from the source ObservableSource . <dl > <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 @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U > Observable < T > delay ( final Function < ? super T , ? extends ObservableSource < U > > itemDelay ) { ObjectHelper . requireNonNull ( itemDelay , "itemDelay is null" ) ; return flatMap ( ObservableInternalHelper . itemDelay ( itemDelay ) ) ; }


Input: Returns an Observable that emits the items emitted by the source ObservableSource shifted forward in time by a specified delay . Error notifications from the source ObservableSource 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 > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Observable < T > delay ( long delay , TimeUnit unit , Scheduler scheduler ) { return delay ( delay , unit , scheduler , false ) ; }


Input: Returns an Observable that emits the items emitted by the source ObservableSource 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 . s . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Observable < T > delay ( long delay , TimeUnit unit , Scheduler scheduler , boolean delayError ) { ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableDelay < T > ( this , delay , unit , scheduler , delayError ) ) ; }


Input: Returns an Observable that delays the subscription to and emissions from the source ObservableSource via another ObservableSource 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 ObservableSource will immediately propagate any { @code onError } notification from the source ObservableSource . <dl > <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 @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U , V > Observable < T > delay ( ObservableSource < U > subscriptionDelay , Function < ? super T , ? extends ObservableSource < V > > itemDelay ) { return delaySubscription ( subscriptionDelay ) . delay ( itemDelay ) ; }


Input: Returns an Observable that delays the subscription to this Observable until the other Observable emits an element or completes normally . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / delaySubscription . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This method does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U > Observable < T > delaySubscription ( ObservableSource < U > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableDelaySubscriptionOther < T , U > ( this , other ) ) ; }


Input: Returns an Observable that delays the subscription to the source ObservableSource by a given amount of time both waiting and subscribing on a given Scheduler . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / delaySubscription . s . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Observable < T > delaySubscription ( long delay , TimeUnit unit , Scheduler scheduler ) { return delaySubscription ( timer ( delay , unit , scheduler ) ) ; }


Input: Returns an Observable that reverses the effect of { @link #materialize materialize } by transforming the { @link Notification } objects emitted by the source ObservableSource 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 Observable disposes of the flow and terminates with that type of terminal event : <pre > <code > Observable . just ( createOnNext ( 1 ) createOnComplete () createOnNext ( 2 )) . doOnDispose (( ) - &gt ; System . out . println ( Disposed! )) ; . 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 > Observable . 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 ( ObservableSource ) } with a { @link #never () } source . <dl > <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 ) @ Deprecated @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public final < T2 > Observable < T2 > dematerialize ( ) { return RxJavaPlugins . onAssembly ( new ObservableDematerialize ( this , Functions . identity ( ) ) ) ; }


Input: Returns an Observable 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 Observer } 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 Observable disposes of the flow and terminates with that type of terminal event : <pre > <code > Observable . just ( createOnNext ( 1 ) createOnComplete () createOnNext ( 2 )) . doOnDispose (( ) - &gt ; System . out . println ( Disposed! )) ; . 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 > Observable . 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 ( ObservableSource ) } with a { @link #never () } source . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code dematerialize } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ Experimental @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > dematerialize ( Function < ? super T , Notification < R > > selector ) { ObjectHelper . requireNonNull ( selector , "selector is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableDematerialize < T , R > ( this , selector ) ) ; }


Input: Returns an Observable that emits all items emitted by the source ObservableSource 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 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 Observer 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 > Scheduler : < / b > < / dt > <dd > { @code distinct } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > distinct ( ) { return distinct ( Functions . identity ( ) , Functions . createHashSet ( ) ) ; }


Input: Returns an Observable that emits all items emitted by the source ObservableSource 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 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 Observer 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 > Scheduler : < / b > < / dt > <dd > { @code distinct } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < K > Observable < T > distinct ( Function < ? super T , K > keySelector ) { return distinct ( keySelector , Functions . createHashSet ( ) ) ; }


Input: Returns an Observable that emits all items emitted by the source ObservableSource 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 meaningful comparison between the key objects as the default Java implementation only considers reference equivalence . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code distinct } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < K > Observable < 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 ObservableDistinct < T , K > ( this , keySelector , collectionSupplier ) ) ; }


Input: Returns an Observable that emits all items emitted by the source ObservableSource 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 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 > Scheduler : < / b > < / dt > <dd > { @code distinctUntilChanged } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > distinctUntilChanged ( ) { return distinctUntilChanged ( Functions . identity ( ) ) ; }


Input: Returns an Observable that emits all items emitted by the source ObservableSource 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 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 > Scheduler : < / b > < / dt > <dd > { @code distinctUntilChanged } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < K > Observable < T > distinctUntilChanged ( Function < ? super T , K > keySelector ) { ObjectHelper . requireNonNull ( keySelector , "keySelector is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableDistinctUntilChanged < T , K > ( this , keySelector , ObjectHelper . equalsPredicate ( ) ) ) ; }


Input: Returns an Observable that emits all items emitted by the source ObservableSource 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 > Scheduler : < / b > < / dt > <dd > { @code distinctUntilChanged } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > distinctUntilChanged ( BiPredicate < ? super T , ? super T > comparer ) { ObjectHelper . requireNonNull ( comparer , "comparer is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableDistinctUntilChanged < T , T > ( this , Functions . < T > identity ( ) , comparer ) ) ; }


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


Input: Registers an { @link Action } to be called when this ObservableSource invokes either { @link Observer#onComplete onComplete } or { @link Observer#onError onError } . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doAfterTerminate . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code doAfterTerminate } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > doAfterTerminate ( Action onFinally ) { ObjectHelper . requireNonNull ( onFinally , "onFinally is null" ) ; return doOnEach ( Functions . emptyConsumer ( ) , Functions . emptyConsumer ( ) , Functions . EMPTY_ACTION , onFinally ) ; }


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


Input: Calls the dispose { @code Action } if the downstream disposes 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 dispose () } call sometimes as a { @code CompositeException } if there were multiple exceptions along the way . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnDispose . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code doOnDispose } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > doOnDispose ( Action onDispose ) { return doOnLifecycle ( Functions . emptyConsumer ( ) , onDispose ) ; }


Input: Modifies the source ObservableSource so that it invokes an action when it calls { @code onComplete } . <p > <img width = 640 height = 358 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnComplete . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code doOnComplete } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < 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 > Scheduler : < / b > < / dt > <dd > { @code doOnEach } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) private Observable < 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 ObservableDoOnEach < T > ( this , onNext , onError , onComplete , onAfterTerminate ) ) ; }


Input: Modifies the source ObservableSource 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 > Scheduler : < / b > < / dt > <dd > { @code doOnEach } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < 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 ObservableSource so that it notifies an Observer for each item and terminal event it emits . <p > In case the { @code onError } of the supplied observer 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 observer 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 > Scheduler : < / b > < / dt > <dd > { @code doOnEach } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > doOnEach ( final Observer < ? super T > observer ) { ObjectHelper . requireNonNull ( observer , "observer is null" ) ; return doOnEach ( ObservableInternalHelper . observerOnNext ( observer ) , ObservableInternalHelper . observerOnError ( observer ) , ObservableInternalHelper . observerOnComplete ( observer ) , Functions . EMPTY_ACTION ) ; }


Input: Modifies the source ObservableSource 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 = 355 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnError . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code doOnError } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > doOnError ( Consumer < ? super Throwable > onError ) { return doOnEach ( Functions . emptyConsumer ( ) , onError , Functions . EMPTY_ACTION , Functions . EMPTY_ACTION ) ; }


Input: Calls the appropriate onXXX method ( shared between all Observer ) for the lifecycle events of the sequence ( subscription disposal ) . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnLifecycle . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code doOnLifecycle } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > doOnLifecycle ( final Consumer < ? super Disposable > onSubscribe , final Action onDispose ) { ObjectHelper . requireNonNull ( onSubscribe , "onSubscribe is null" ) ; ObjectHelper . requireNonNull ( onDispose , "onDispose is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableDoOnLifecycle < T > ( this , onSubscribe , onDispose ) ) ; }


Input: Modifies the source ObservableSource so that it invokes an action when it calls { @code onNext } . <p > <img width = 640 height = 360 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnNext . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code doOnNext } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > doOnNext ( Consumer < ? super T > onNext ) { return doOnEach ( onNext , Functions . emptyConsumer ( ) , Functions . EMPTY_ACTION , Functions . EMPTY_ACTION ) ; }


Input: Modifies the source { @code ObservableSource } 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 ObservableSource } is reference counted in which case the source { @code ObservableSource } 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 > Scheduler : < / b > < / dt > <dd > { @code doOnSubscribe } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > doOnSubscribe ( Consumer < ? super Disposable > onSubscribe ) { return doOnLifecycle ( onSubscribe , Functions . EMPTY_ACTION ) ; }


Input: Modifies the source ObservableSource so that it invokes an action when it calls { @code onComplete } or { @code onError } . <p > <img width = 640 height = 327 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnTerminate . o . 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 > Scheduler : < / b > < / dt > <dd > { @code doOnTerminate } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > doOnTerminate ( final Action onTerminate ) { ObjectHelper . requireNonNull ( onTerminate , "onTerminate is null" ) ; 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 Observable or completes if this Observable signals fewer elements than index . <p > <img width = 640 height = 363 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / elementAt . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code elementAt } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ 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 ObservableElementAtMaybe < T > ( this , index ) ) ; }


Input: Returns a Single that emits the item found at a specified index in a sequence of emissions from this Observable or a default item if that index is out of range . <p > <img width = 640 height = 353 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / elementAtDefault . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code elementAt } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > elementAt ( long index , T defaultItem ) { if ( index < 0 ) { throw new IndexOutOfBoundsException ( "index >= 0 required but it was " + index ) ; } ObjectHelper . requireNonNull ( defaultItem , "defaultItem is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableElementAtSingle < T > ( this , index , defaultItem ) ) ; }


Input: Returns a Single that emits the item found at a specified index in a sequence of emissions from this Observable or signals a { @link NoSuchElementException } if this Observable signals fewer elements than index . <p > <img width = 640 height = 362 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / elementAtOrError . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code elementAtOrError } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ 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 ObservableElementAtSingle < T > ( this , index , null ) ) ; }


Input: Filters items emitted by an ObservableSource 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 > Scheduler : < / b > < / dt > <dd > { @code filter } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > filter ( Predicate < ? super T > predicate ) { ObjectHelper . requireNonNull ( predicate , "predicate is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableFilter < T > ( this , predicate ) ) ; }


Input: Returns a Single that emits only the very first item emitted by the source ObservableSource or a default item if the source ObservableSource completes without emitting any items . <p > <img width = 640 height = 286 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / first . s . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code first } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > first ( T defaultItem ) { return elementAt ( 0L , defaultItem ) ; }


Input: Returns an Observable that emits items based on applying a function that you supply to each item emitted by the source ObservableSource where that function returns an ObservableSource and then merging those resulting ObservableSources and emitting the results of this merger . <p > <img width = 640 height = 356 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / flatMapDelayError . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code flatMap } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > flatMap ( Function < ? super T , ? extends ObservableSource < ? extends R > > mapper , boolean delayErrors ) { return flatMap ( mapper , delayErrors , Integer . MAX_VALUE ) ; }


Input: Returns an Observable that emits items based on applying a function that you supply to each item emitted by the source ObservableSource where that function returns an ObservableSource and then merging those resulting ObservableSources and emitting the results of this merger while limiting the maximum number of concurrent subscriptions to these ObservableSources . <p > <img width = 640 height = 441 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / flatMapMaxConcurrency . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code flatMap } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > flatMap ( Function < ? super T , ? extends ObservableSource < ? 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 ObservableScalarXMap . scalarXMap ( v , mapper ) ; } return RxJavaPlugins . onAssembly ( new ObservableFlatMap < T , R > ( this , mapper , delayErrors , maxConcurrency , bufferSize ) ) ; }


Input: Returns an Observable that applies a function to each item emitted or notification raised by the source ObservableSource and then flattens the ObservableSources 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 > Scheduler : < / b > < / dt > <dd > { @code flatMap } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > flatMap ( Function < ? super T , ? extends ObservableSource < ? extends R > > onNextMapper , Function < ? super Throwable , ? extends ObservableSource < ? extends R > > onErrorMapper , Callable < ? extends ObservableSource < ? extends R > > onCompleteSupplier ) { ObjectHelper . requireNonNull ( onNextMapper , "onNextMapper is null" ) ; ObjectHelper . requireNonNull ( onErrorMapper , "onErrorMapper is null" ) ; ObjectHelper . requireNonNull ( onCompleteSupplier , "onCompleteSupplier is null" ) ; return merge ( new ObservableMapNotification < T , R > ( this , onNextMapper , onErrorMapper , onCompleteSupplier ) ) ; }


Input: Returns an Observable that emits the results of a specified function to the pair of values emitted by the source ObservableSource and a specified collection ObservableSource . <p > <img width = 640 height = 390 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / mergeMap . r . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code flatMap } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U , R > Observable < R > flatMap ( Function < ? super T , ? extends ObservableSource < ? extends U > > mapper , BiFunction < ? super T , ? super U , ? extends R > resultSelector ) { return flatMap ( mapper , resultSelector , false , bufferSize ( ) , bufferSize ( ) ) ; }


Input: Maps each element of the upstream Observable into CompletableSources subscribes to them and waits until the upstream and all CompletableSources complete . <p > <img width = 640 height = 424 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / flatMapCompletable . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Completable flatMapCompletable ( Function < ? super T , ? extends CompletableSource > mapper ) { return flatMapCompletable ( mapper , false ) ; }


Input: Returns an Observable that emits the results of applying a function to the pair of values from the source ObservableSource and an Iterable corresponding to that item that is generated by a selector . <p > <img width = 640 height = 410 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / flatMapIterable . o . r . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code flatMapIterable } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U , V > Observable < V > flatMapIterable ( final Function < ? super T , ? extends Iterable < ? extends U > > mapper , BiFunction < ? super T , ? super U , ? extends V > resultSelector ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; ObjectHelper . requireNonNull ( resultSelector , "resultSelector is null" ) ; return flatMap ( ObservableInternalHelper . flatMapIntoIterable ( mapper ) , resultSelector , false , bufferSize ( ) , bufferSize ( ) ) ; }


Input: Maps each element of the upstream Observable into MaybeSources subscribes to all of them and merges their onSuccess values in no particular order into a single Observable sequence . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / flatMapMaybe . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > flatMapMaybe ( Function < ? super T , ? extends MaybeSource < ? extends R > > mapper ) { return flatMapMaybe ( mapper , false ) ; }


Input: Maps each element of the upstream Observable into MaybeSources subscribes to them and merges their onSuccess values in no particular order into a single Observable sequence optionally delaying all errors . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / flatMapMaybe . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > flatMapMaybe ( Function < ? super T , ? extends MaybeSource < ? extends R > > mapper , boolean delayErrors ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableFlatMapMaybe < T , R > ( this , mapper , delayErrors ) ) ; }


Input: Maps each element of the upstream Observable into SingleSources subscribes to all of them and merges their onSuccess values in no particular order into a single Observable sequence . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / flatMapSingle . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > flatMapSingle ( Function < ? super T , ? extends SingleSource < ? extends R > > mapper ) { return flatMapSingle ( mapper , false ) ; }


Input: Maps each element of the upstream Observable into SingleSources subscribes to them and merges their onSuccess values in no particular order into a single Observable sequence optionally delaying all errors . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / flatMapSingle . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > flatMapSingle ( Function < ? super T , ? extends SingleSource < ? extends R > > mapper , boolean delayErrors ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableFlatMapSingle < T , R > ( this , mapper , delayErrors ) ) ; }


Input: Subscribes to the { @link ObservableSource } and receives notifications for each element and the terminal events until the onNext Predicate returns false . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code forEachWhile } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Disposable forEachWhile ( final Predicate < ? super T > onNext , Consumer < ? super Throwable > onError , final Action onComplete ) { ObjectHelper . requireNonNull ( onNext , "onNext is null" ) ; ObjectHelper . requireNonNull ( onError , "onError is null" ) ; ObjectHelper . requireNonNull ( onComplete , "onComplete is null" ) ; ForEachWhileObserver < T > o = new ForEachWhileObserver < T > ( onNext , onError , onComplete ) ; subscribe ( o ) ; return o ; }


Input: Groups the items emitted by an { @code ObservableSource } according to a specified criterion and emits these grouped items as { @link GroupedObservable } s . The emitted { @code GroupedObservableSource } allows only a single { @link Observer } during its lifetime and if this { @code Observer } calls dispose () before the source terminates the next emission by the source having the same key will trigger a new { @code GroupedObservableSource } emission . <p > <img width = 640 height = 360 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / groupBy . png alt = > <p > <em > Note : < / em > A { @link GroupedObservable } will cache the items it is to emit until such time as it is subscribed to . For this reason in order to avoid memory leaks you should not simply ignore those { @code GroupedObservableSource } s that do not concern you . Instead you can signal to them that they may discard their buffers by applying an operator like { @link #ignoreElements } to them . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code groupBy } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < K > Observable < GroupedObservable < K , T > > groupBy ( Function < ? super T , ? extends K > keySelector ) { return groupBy ( keySelector , ( Function ) Functions . identity ( ) , false , bufferSize ( ) ) ; }


Input: Groups the items emitted by an { @code ObservableSource } according to a specified criterion and emits these grouped items as { @link GroupedObservable } s . The emitted { @code GroupedObservableSource } allows only a single { @link Observer } during its lifetime and if this { @code Observer } calls dispose () before the source terminates the next emission by the source having the same key will trigger a new { @code GroupedObservableSource } emission . <p > <img width = 640 height = 360 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / groupBy . png alt = > <p > <em > Note : < / em > A { @link GroupedObservable } will cache the items it is to emit until such time as it is subscribed to . For this reason in order to avoid memory leaks you should not simply ignore those { @code GroupedObservableSource } s that do not concern you . Instead you can signal to them that they may discard their buffers by applying an operator like { @link #ignoreElements } to them . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code groupBy } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < K , V > Observable < GroupedObservable < K , V > > groupBy ( Function < ? super T , ? extends K > keySelector , Function < ? super T , ? extends V > valueSelector ) { return groupBy ( keySelector , valueSelector , false , bufferSize ( ) ) ; }


Input: Groups the items emitted by an { @code ObservableSource } according to a specified criterion and emits these grouped items as { @link GroupedObservable } s . The emitted { @code GroupedObservableSource } allows only a single { @link Observer } during its lifetime and if this { @code Observer } calls dispose () before the source terminates the next emission by the source having the same key will trigger a new { @code GroupedObservableSource } emission . <p > <img width = 640 height = 360 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / groupBy . png alt = > <p > <em > Note : < / em > A { @link GroupedObservable } will cache the items it is to emit until such time as it is subscribed to . For this reason in order to avoid memory leaks you should not simply ignore those { @code GroupedObservableSource } s that do not concern you . Instead you can signal to them that they may discard their buffers by applying an operator like { @link #ignoreElements } to them . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code groupBy } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < K , V > Observable < GroupedObservable < K , V > > groupBy ( Function < ? super T , ? extends K > keySelector , Function < ? super T , ? extends V > valueSelector , boolean delayError , int bufferSize ) { ObjectHelper . requireNonNull ( keySelector , "keySelector is null" ) ; ObjectHelper . requireNonNull ( valueSelector , "valueSelector is null" ) ; ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return RxJavaPlugins . onAssembly ( new ObservableGroupBy < T , K , V > ( this , keySelector , valueSelector , bufferSize , delayError ) ) ; }


Input: Hides the identity of this Observable and its Disposable . <p > Allows hiding extra features such as { @link io . reactivex . subjects . Subject } s { @link Observer } methods or preventing certain identity - based optimizations ( fusion ) . <p > <img width = 640 height = 283 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / hide . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code hide } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > @return the new Observable instance [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > hide ( ) { return RxJavaPlugins . onAssembly ( new ObservableHide < T > ( this ) ) ; }


Input: Ignores all items emitted by the source ObservableSource and only calls { @code onComplete } or { @code onError } . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / ignoreElements . 2 . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code ignoreElements } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Completable ignoreElements ( ) { return RxJavaPlugins . onAssembly ( new ObservableIgnoreElementsCompletable < T > ( this ) ) ; }


Input: Returns a Single that emits { @code true } if the source ObservableSource is empty otherwise { @code false } . <p > In Rx . Net this is negated as the { @code any } Observer but we renamed this in RxJava to better match Java naming idioms . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / isEmpty . 2 . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code isEmpty } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < Boolean > isEmpty ( ) { return all ( Functions . alwaysFalse ( ) ) ; }


Input: Correlates the items emitted by two ObservableSources based on overlapping durations . <p > There are no guarantees in what order the items get combined when multiple items from one or both source ObservableSources overlap . <p > <img width = 640 height = 380 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / join_ . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code join } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < TRight , TLeftEnd , TRightEnd , R > Observable < R > join ( ObservableSource < ? extends TRight > other , Function < ? super T , ? extends ObservableSource < TLeftEnd > > leftEnd , Function < ? super TRight , ? extends ObservableSource < TRightEnd > > rightEnd , BiFunction < ? super T , ? super TRight , ? extends R > resultSelector ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; ObjectHelper . requireNonNull ( leftEnd , "leftEnd is null" ) ; ObjectHelper . requireNonNull ( rightEnd , "rightEnd is null" ) ; ObjectHelper . requireNonNull ( resultSelector , "resultSelector is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableJoin < T , TRight , TLeftEnd , TRightEnd , R > ( this , other , leftEnd , rightEnd , resultSelector ) ) ; }


Input: Returns a Maybe that emits the last item emitted by this Observable or completes if this Observable is empty . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / lastElement . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code lastElement } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > lastElement ( ) { return RxJavaPlugins . onAssembly ( new ObservableLastMaybe < T > ( this ) ) ; }


Input: Returns a Single that emits only the last item emitted by this Observable or a default item if this Observable completes without emitting any items . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / last . 2 . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code last } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > last ( T defaultItem ) { ObjectHelper . requireNonNull ( defaultItem , "defaultItem is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableLastSingle < T > ( this , defaultItem ) ) ; }


Input: Returns a Single that emits only the last item emitted by this Observable or signals a { @link NoSuchElementException } if this Observable is empty . <p > <img width = 640 height = 236 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / lastOrError . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code lastOrError } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > lastOrError ( ) { return RxJavaPlugins . onAssembly ( new ObservableLastSingle < T > ( this , null ) ) ; }


Input: Returns an Observable that applies a specified function to each item emitted by the source ObservableSource and emits the results of these function applications . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / map . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code map } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > map ( Function < ? super T , ? extends R > mapper ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableMap < T , R > ( this , mapper ) ) ; }


Input: Returns an Observable that represents all of the emissions <em > and< / em > notifications from the source ObservableSource into emissions marked with their original types within { @link Notification } objects . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / materialize . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code materialize } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < Notification < T > > materialize ( ) { return RxJavaPlugins . onAssembly ( new ObservableMaterialize < T > ( this ) ) ; }


Input: Flattens this and another ObservableSource into a single ObservableSource without any transformation . <p > <img width = 640 height = 380 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / merge . png alt = > <p > You can combine items emitted by multiple ObservableSources so that they appear as a single ObservableSource by using the { @code mergeWith } method . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code mergeWith } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > mergeWith ( ObservableSource < ? extends T > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return merge ( this , other ) ; }


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


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


Input: Relays the items of this Observable and completes only when the other CompletableSource completes as well . <p > <img width = 640 height = 380 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / merge . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > mergeWith ( @ NonNull CompletableSource other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableMergeWithCompletable < T > ( this , other ) ) ; }


Input: Modifies an ObservableSource to perform its emissions and notifications on a specified { @link Scheduler } asynchronously with an unbounded buffer with { @link Flowable#bufferSize () } island size . [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Observable < T > observeOn ( Scheduler scheduler ) { return observeOn ( scheduler , false , bufferSize ( ) ) ; }


Input: Modifies an ObservableSource to perform its emissions and notifications on a specified { @link Scheduler } asynchronously with an unbounded buffer of configurable island size and optionally delays onError notifications . <p > <img width = 640 height = 308 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / observeOn . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > <p > Island size indicates how large chunks the unbounded buffer allocates to store the excess elements waiting to be consumed on the other side of the asynchronous boundary . Values below 16 are not recommended in performance sensitive scenarios . [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Observable < T > observeOn ( Scheduler scheduler , boolean delayError , int bufferSize ) { ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return RxJavaPlugins . onAssembly ( new ObservableObserveOn < T > ( this , scheduler , delayError , bufferSize ) ) ; }


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


Input: Instructs an ObservableSource to pass control to another ObservableSource rather than invoking { @link Observer#onError onError } if it encounters an error . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / onErrorResumeNext . png alt = > <p > By default when an ObservableSource encounters an error that prevents it from emitting the expected item to its { @link Observer } the ObservableSource invokes its Observer s { @code onError } method and then quits without invoking any more of its Observer s methods . The { @code onErrorResumeNext } method changes this behavior . If you pass another ObservableSource ( { @code resumeSequence } ) to an ObservableSource s { @code onErrorResumeNext } method if the original ObservableSource encounters an error instead of invoking its Observer s { @code onError } method it will instead relinquish control to { @code resumeSequence } which will invoke the Observer s { @link Observer#onNext onNext } method if it is able to do so . In such a case because no ObservableSource necessarily invokes { @code onError } the Observer may never know that an error happened . <p > You can use this to prevent errors from propagating or to supply fallback data should errors be encountered . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code onErrorResumeNext } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > onErrorResumeNext ( final ObservableSource < ? extends T > next ) { ObjectHelper . requireNonNull ( next , "next is null" ) ; return onErrorResumeNext ( Functions . justFunction ( next ) ) ; }


Input: Instructs an ObservableSource to emit an item ( returned by a specified function ) rather than invoking { @link Observer#onError onError } if it encounters an error . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / onErrorReturn . o . png alt = > <p > By default when an ObservableSource encounters an error that prevents it from emitting the expected item to its { @link Observer } the ObservableSource invokes its Observer s { @code onError } method and then quits without invoking any more of its Observer s methods . The { @code onErrorReturn } method changes this behavior . If you pass a function ( { @code resumeFunction } ) to an ObservableSource s { @code onErrorReturn } method if the original ObservableSource encounters an error instead of invoking its Observer s { @code onError } method it will instead emit the return value of { @code resumeFunction } . <p > You can use this to prevent errors from propagating or to supply fallback data should errors be encountered . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code onErrorReturn } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > onErrorReturn ( Function < ? super Throwable , ? extends T > valueSupplier ) { ObjectHelper . requireNonNull ( valueSupplier , "valueSupplier is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableOnErrorReturn < T > ( this , valueSupplier ) ) ; }


Input: Instructs an ObservableSource to pass control to another ObservableSource rather than invoking { @link Observer#onError onError } if it encounters an { @link java . lang . Exception } . <p > This differs from { @link #onErrorResumeNext } in that this one does not handle { @link java . lang . Throwable } or { @link java . lang . Error } but lets those continue through . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / onExceptionResumeNextViaObservableSource . png alt = > <p > By default when an ObservableSource encounters an exception that prevents it from emitting the expected item to its { @link Observer } the ObservableSource invokes its Observer s { @code onError } method and then quits without invoking any more of its Observer s methods . The { @code onExceptionResumeNext } method changes this behavior . If you pass another ObservableSource ( { @code resumeSequence } ) to an ObservableSource s { @code onExceptionResumeNext } method if the original ObservableSource encounters an exception instead of invoking its Observer s { @code onError } method it will instead relinquish control to { @code resumeSequence } which will invoke the Observer s { @link Observer#onNext onNext } method if it is able to do so . In such a case because no ObservableSource necessarily invokes { @code onError } the Observer may never know that an exception happened . <p > You can use this to prevent exceptions from propagating or to supply fallback data should exceptions be encountered . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code onExceptionResumeNext } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > onExceptionResumeNext ( final ObservableSource < ? extends T > next ) { ObjectHelper . requireNonNull ( next , "next is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableOnErrorNext < T > ( this , Functions . justFunction ( next ) , true ) ) ; }


Input: Nulls out references to the upstream producer and downstream Observer if the sequence is terminated or downstream calls dispose () . <p > <img width = 640 height = 246 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / onTerminateDetach . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > onTerminateDetach ( ) { return RxJavaPlugins . onAssembly ( new ObservableDetach < T > ( this ) ) ; }


Input: Returns an Observable that emits the results of invoking a specified selector on items emitted by a { @link ConnectableObservable } that shares a single subscription to the underlying sequence . <p > <img width = 640 height = 647 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / publishFunction . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code publish } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > publish ( Function < ? super Observable < T > , ? extends ObservableSource < R > > selector ) { ObjectHelper . requireNonNull ( selector , "selector is null" ) ; return RxJavaPlugins . onAssembly ( new ObservablePublishSelector < T , R > ( this , selector ) ) ; }


Input: Returns a Maybe that applies a specified accumulator function to the first item emitted by a source ObservableSource then feeds the result of that function along with the second item emitted by the source ObservableSource into the same function and so on until all items have been emitted by the finite source ObservableSource and emits the final result from the final call to your function as its sole item . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / reduce . 2 . png alt = > <p > This technique which is called reduce here is sometimes called aggregate fold accumulate compress or inject in other programming contexts . Groovy for instance has an { @code inject } method that does a similar operation on lists . <p > Note that this operator requires the upstream to signal { @code onComplete } for the accumulator object to be emitted . Sources that are infinite and never complete will never emit anything through this operator and an infinite source may lead to a fatal { @code OutOfMemoryError } . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code reduce } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > reduce ( BiFunction < T , T , T > reducer ) { ObjectHelper . requireNonNull ( reducer , "reducer is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableReduceMaybe < T > ( this , reducer ) ) ; }


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


Input: Returns a Single that applies a specified accumulator function to the first item emitted by a source ObservableSource and a seed value derived from calling a specified seedSupplier then feeds the result of that function along with the second item emitted by an ObservableSource into the same function and so on until all items have been emitted by the finite source ObservableSource emitting the final result from the final call to your function as its sole item . <p > <img width = 640 height = 325 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / reduceWith . o . png alt = > <p > This technique which is called reduce here is sometimes called aggregate fold accumulate compress or inject in other programming contexts . Groovy for instance has an { @code inject } method that does a similar operation on lists . <p > Note that this operator requires the upstream to signal { @code onComplete } for the accumulator object to be emitted . Sources that are infinite and never complete will never emit anything through this operator and an infinite source may lead to a fatal { @code OutOfMemoryError } . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code reduceWith } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Single < R > reduceWith ( Callable < R > seedSupplier , BiFunction < R , ? super T , R > reducer ) { ObjectHelper . requireNonNull ( seedSupplier , "seedSupplier is null" ) ; ObjectHelper . requireNonNull ( reducer , "reducer is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableReduceWithSingle < T , R > ( this , seedSupplier , reducer ) ) ; }


Input: Returns an Observable that repeats the sequence of items emitted by the source ObservableSource indefinitely . <p > <img width = 640 height = 287 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / repeatInf . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code repeat } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > repeat ( ) { return repeat ( Long . MAX_VALUE ) ; }


Input: Returns an Observable that repeats the sequence of items emitted by the source ObservableSource at most { @code count } times . <p > <img width = 640 height = 336 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / repeatCount . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code repeat } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > repeat ( long times ) { if ( times < 0 ) { throw new IllegalArgumentException ( "times >= 0 required but it was " + times ) ; } if ( times == 0 ) { return empty ( ) ; } return RxJavaPlugins . onAssembly ( new ObservableRepeat < T > ( this , times ) ) ; }


Input: Returns an Observable that repeats the sequence of items emitted by the source ObservableSource until the provided stop function returns true . <p > <img width = 640 height = 262 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / repeatUntil . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code repeatUntil } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > repeatUntil ( BooleanSupplier stop ) { ObjectHelper . requireNonNull ( stop , "stop is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableRepeatUntil < T > ( this , stop ) ) ; }


Input: Returns an Observable that emits the same values as the source ObservableSource with the exception of an { @code onComplete } . An { @code onComplete } notification from the source will result in the emission of a { @code void } item to the ObservableSource provided as an argument to the { @code notificationHandler } function . If that ObservableSource calls { @code onComplete } or { @code onError } then { @code repeatWhen } will call { @code onComplete } or { @code onError } on the child subscription . Otherwise this ObservableSource will resubscribe to the source ObservableSource . <p > <img width = 640 height = 430 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / repeatWhen . f . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code repeatWhen } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > repeatWhen ( final Function < ? super Observable < Object > , ? extends ObservableSource < ? > > handler ) { ObjectHelper . requireNonNull ( handler , "handler is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableRepeatWhen < T > ( this , handler ) ) ; }


Input: Returns an Observable that emits items that are the results of invoking a specified selector on the items emitted by a { @link ConnectableObservable } that shares a single subscription to the source ObservableSource . <p > <img width = 640 height = 449 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / replay . o . f . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code replay } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > replay ( Function < ? super Observable < T > , ? extends ObservableSource < R > > selector ) { ObjectHelper . requireNonNull ( selector , "selector is null" ) ; return ObservableReplay . multicastSelector ( ObservableInternalHelper . replayCallable ( this ) , selector ) ; }


Input: Returns an Observable that emits items that are the results of invoking a specified selector on items emitted by a { @link ConnectableObservable } that shares a single subscription to the source ObservableSource replaying no more than { @code bufferSize } items that were emitted within a specified time window . <p > Note that due to concurrency requirements { @code replay ( bufferSize ) } may hold strong references to more than { @code bufferSize } source emissions . <p > <img width = 640 height = 350 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / replay . o . fnt . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code replay } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final < R > Observable < R > replay ( Function < ? super Observable < T > , ? extends ObservableSource < R > > selector , int bufferSize , long time , TimeUnit unit ) { return replay ( selector , bufferSize , time , unit , Schedulers . computation ( ) ) ; }


Input: Returns an Observable that emits items that are the results of invoking a specified selector on items emitted by a { @link ConnectableObservable } that shares a single subscription to the source ObservableSource . <p > <img width = 640 height = 406 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / replay . o . fs . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final < R > Observable < R > replay ( final Function < ? super Observable < T > , ? extends ObservableSource < R > > selector , final Scheduler scheduler ) { ObjectHelper . requireNonNull ( selector , "selector is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return ObservableReplay . multicastSelector ( ObservableInternalHelper . replayCallable ( this ) , ObservableInternalHelper . replayFunction ( selector , scheduler ) ) ; }


Input: Returns a { @link ConnectableObservable } that shares a single subscription to the source ObservableSource that replays at most { @code bufferSize } items emitted by that ObservableSource . A Connectable ObservableSource resembles an ordinary ObservableSource except that it does not begin emitting items when it is subscribed to but only when its { @code connect } method is called . <p > Note that due to concurrency requirements { @code replay ( bufferSize ) } may hold strong references to more than { @code bufferSize } source emissions . <p > <img width = 640 height = 445 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / replay . o . n . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code replay } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final ConnectableObservable < T > replay ( final int bufferSize ) { ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return ObservableReplay . create ( this , bufferSize ) ; }


Input: Returns a { @link ConnectableObservable } that shares a single subscription to the source ObservableSource and replays at most { @code bufferSize } items that were emitted during a specified time window . A Connectable ObservableSource resembles an ordinary ObservableSource except that it does not begin emitting items when it is subscribed to but only when its { @code connect } method is called . <p > Note that due to concurrency requirements { @code replay ( bufferSize ) } may hold strong references to more than { @code bufferSize } source emissions . <p > <img width = 640 height = 445 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / replay . o . nt . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code replay } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final ConnectableObservable < T > replay ( int bufferSize , long time , TimeUnit unit ) { return replay ( bufferSize , time , unit , Schedulers . computation ( ) ) ; }