Input: Returns a { @link ConnectableObservable } that shares a single subscription to the source ObservableSource and that replays a maximum of { @code bufferSize } items that are emitted within 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 . nts . 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 ConnectableObservable < T > replay ( final int bufferSize , final long time , final TimeUnit unit , final Scheduler scheduler ) { ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return ObservableReplay . create ( this , time , unit , scheduler , bufferSize ) ; }


Input: Returns a { @link ConnectableObservable } that shares a single subscription to the source ObservableSource and 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 . ns . 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 ConnectableObservable < T > replay ( final int bufferSize , final Scheduler scheduler ) { ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return ObservableReplay . observeOn ( replay ( bufferSize ) , scheduler ) ; }


Input: Returns a { @link ConnectableObservable } that shares a single subscription to the source ObservableSource that will replay all of its items and notifications to any future { @link Observer } on the given { @link Scheduler } . 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 > <img width = 640 height = 445 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / replay . o . 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 ConnectableObservable < T > replay ( final Scheduler scheduler ) { ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return ObservableReplay . observeOn ( replay ( ) , scheduler ) ; }


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


Input: Returns an Observable that mirrors the source ObservableSource resubscribing to it if it calls { @code onError } and the predicate returns true for that specific exception and retry count . <p > <img width = 640 height = 235 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / retry . o . ne . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code retry } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > retry ( BiPredicate < ? super Integer , ? super Throwable > predicate ) { ObjectHelper . requireNonNull ( predicate , "predicate is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableRetryBiPredicate < T > ( this , predicate ) ) ; }


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


Input: Retries at most times or until the predicate returns false whichever happens first . <p > <img width = 640 height = 269 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / retry . o . nfe . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > retry ( long times , Predicate < ? super Throwable > predicate ) { if ( times < 0 ) { throw new IllegalArgumentException ( "times >= 0 required but it was " + times ) ; } ObjectHelper . requireNonNull ( predicate , "predicate is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableRetryPredicate < T > ( this , times , predicate ) ) ; }


Input: Retries the current Observable if the predicate returns true . <p > <img width = 640 height = 248 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / retry . o . e . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code retry } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > retry ( Predicate < ? super Throwable > predicate ) { return retry ( Long . MAX_VALUE , predicate ) ; }


Input: Returns an Observable that emits the same values as the source ObservableSource with the exception of an { @code onError } . An { @code onError } notification from the source will result in the emission of a { @link Throwable } item to the ObservableSource provided as an argument to the { @code notificationHandler } function . If that ObservableSource calls { @code onComplete } or { @code onError } then { @code retry } 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 / retryWhen . f . png alt = > <p > Example : [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > retryWhen ( final Function < ? super Observable < Throwable > , ? extends ObservableSource < ? > > handler ) { ObjectHelper . requireNonNull ( handler , "handler is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableRetryWhen < T > ( this , handler ) ) ; }


Input: Returns an Observable that emits the most recently emitted item ( if any ) emitted by the source ObservableSource within periodic time intervals . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / sample . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code sample } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Observable < T > sample ( long period , TimeUnit unit ) { return sample ( period , unit , Schedulers . computation ( ) ) ; }


Input: Returns an Observable that emits the most recently emitted item ( if any ) emitted by the source ObservableSource within periodic time intervals where the intervals are defined on a particular Scheduler . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / sample . s . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Observable < T > sample ( long period , TimeUnit unit , Scheduler scheduler ) { ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableSampleTimed < T > ( this , period , unit , scheduler , false ) ) ; }


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


Input: Returns an Observable 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 source ObservableSource emitting the result of each of these iterations . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / scan . png alt = > <p > This sort of function is sometimes called an accumulator . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code scan } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > scan ( BiFunction < T , T , T > accumulator ) { ObjectHelper . requireNonNull ( accumulator , "accumulator is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableScan < T > ( this , accumulator ) ) ; }


Input: Returns an Observable that applies a specified accumulator function to the first item emitted by a source ObservableSource and a seed value 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 source ObservableSource emitting the result of each of these iterations . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / scanSeed . png alt = > <p > This sort of function is sometimes called an accumulator . <p > Note that the ObservableSource that results from this method will emit { @code initialValue } as its first emitted item . <p > Note that the { @code initialValue } 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 = ... Observable . defer (( ) - &gt ; source . scan ( new ArrayList&lt ; &gt ; () ( list item ) - &gt ; list . add ( item ))) ; [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > scan ( final R initialValue , BiFunction < R , ? super T , R > accumulator ) { ObjectHelper . requireNonNull ( initialValue , "initialValue is null" ) ; return scanWith ( Functions . justCallable ( initialValue ) , accumulator ) ; }


Input: Returns an Observable that applies a specified accumulator function to the first item emitted by a source ObservableSource and a seed value 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 source ObservableSource emitting the result of each of these iterations . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / scanSeed . png alt = > <p > This sort of function is sometimes called an accumulator . <p > Note that the ObservableSource that results from this method will emit the value returned by the { @code seedSupplier } as its first item . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code scanWith } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > scanWith ( Callable < R > seedSupplier , BiFunction < R , ? super T , R > accumulator ) { ObjectHelper . requireNonNull ( seedSupplier , "seedSupplier is null" ) ; ObjectHelper . requireNonNull ( accumulator , "accumulator is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableScanSeed < T , R > ( this , seedSupplier , accumulator ) ) ; }


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

  Scheduler :

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

 [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > serialize ( ) { return RxJavaPlugins . onAssembly ( new ObservableSerialized < T > ( this ) ) ; }


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


Input: Returns a Single that emits the single item emitted by this Observable if this Observable emits only a single item or a default item if the source ObservableSource emits no items . If the source ObservableSource emits more than one item an { @code IllegalArgumentException } is signalled instead . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / single . 2 . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code single } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > single ( T defaultItem ) { ObjectHelper . requireNonNull ( defaultItem , "defaultItem is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableSingleSingle < T > ( this , defaultItem ) ) ; }


Input: Returns a Single that emits the single item emitted by this Observable if this Observable emits only a single item otherwise if this Observable completes without emitting any items or emits more than one item a { @link NoSuchElementException } or { @code IllegalArgumentException } will be signalled respectively . <p > <img width = 640 height = 228 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / singleOrError . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code singleOrError } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > singleOrError ( ) { return RxJavaPlugins . onAssembly ( new ObservableSingleSingle < T > ( this , null ) ) ; }


Input: Returns an Observable that skips the first { @code count } items emitted by the source ObservableSource and emits the remainder . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / skip . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code skip } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > skip ( long count ) { if ( count <= 0 ) { return RxJavaPlugins . onAssembly ( this ) ; } return RxJavaPlugins . onAssembly ( new ObservableSkip < T > ( this , count ) ) ; }


Input: Returns an Observable that skips values emitted by the source ObservableSource before a specified time window elapses . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / skip . t . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code skip } does not operate on any particular scheduler but uses the current time from the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Observable < T > skip ( long time , TimeUnit unit ) { return skipUntil ( timer ( time , unit ) ) ; }


Input: Returns an Observable that skips values emitted by the source ObservableSource before a specified time window on a specified { @link Scheduler } elapses . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / skip . ts . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use for the timed skipping< / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Observable < T > skip ( long time , TimeUnit unit , Scheduler scheduler ) { return skipUntil ( timer ( time , unit , scheduler ) ) ; }


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


Input: Returns an Observable that drops items emitted by the source ObservableSource during a specified time window before the source completes . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / skipLast . t . png alt = > <p > Note : this action will cache the latest items arriving in the specified time window . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code skipLast } does not operate on any particular scheduler but uses the current time from the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . TRAMPOLINE ) public final Observable < T > skipLast ( long time , TimeUnit unit ) { return skipLast ( time , unit , Schedulers . trampoline ( ) , false , bufferSize ( ) ) ; }


Input: Returns an Observable that drops items emitted by the source ObservableSource during a specified time window ( defined on a specified scheduler ) before the source completes . <p > <img width = 640 height = 340 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / skipLast . ts . png alt = > <p > Note : this action will cache the latest items arriving in the specified time window . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use for tracking the current time< / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Observable < T > skipLast ( long time , TimeUnit unit , Scheduler scheduler ) { return skipLast ( time , unit , scheduler , false , bufferSize ( ) ) ; }


Input: Returns an Observable that drops items emitted by the source ObservableSource during a specified time window ( defined on a specified scheduler ) before the source completes . <p > <img width = 640 height = 340 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / skipLast . ts . png alt = > <p > Note : this action will cache the latest items arriving in the specified time window . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Observable < T > skipLast ( long time , TimeUnit unit , Scheduler scheduler , boolean delayError , int bufferSize ) { ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; // the internal buffer holds pairs of (timestamp, value) so double the default buffer size int s = bufferSize << 1 ; return RxJavaPlugins . onAssembly ( new ObservableSkipLastTimed < T > ( this , time , unit , scheduler , s , delayError ) ) ; }


Input: Returns an Observable that skips items emitted by the source ObservableSource until a second ObservableSource emits an item . <p > <img width = 640 height = 375 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / skipUntil . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code skipUntil } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U > Observable < T > skipUntil ( ObservableSource < U > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableSkipUntil < T , U > ( this , other ) ) ; }


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


Input: Returns an Observable that emits the events emitted by source ObservableSource in a sorted order . Each item emitted by the ObservableSource must implement { @link Comparable } with respect to all other items in the sequence . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / sorted . png alt = > <p > If any item emitted by this Observable does not implement { @link Comparable } with respect to all other items emitted by this Observable no items will be emitted and the sequence is terminated with a { @link ClassCastException } . [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > sorted ( ) { return toList ( ) . toObservable ( ) . map ( Functions . listSorter ( Functions . < T > naturalComparator ( ) ) ) . flatMapIterable ( Functions . < List < T > > identity ( ) ) ; }


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


Input: Returns an Observable that emits the items in a specified { @link Iterable } before it begins to emit items emitted by the source ObservableSource . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / startWith . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code startWith } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ SuppressWarnings ( "unchecked" ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > startWith ( Iterable < ? extends T > items ) { return concatArray ( fromIterable ( items ) , this ) ; }


Input: Returns an Observable that emits the items in a specified { @link ObservableSource } before it begins to emit items emitted by the source ObservableSource . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / startWith . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code startWith } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ SuppressWarnings ( "unchecked" ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > startWith ( ObservableSource < ? extends T > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return concatArray ( other , this ) ; }


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


Input: Returns an Observable that emits the specified items before it begins to emit items emitted by the source ObservableSource . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / startWithArray . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code startWithArray } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ SuppressWarnings ( "unchecked" ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > startWithArray ( T ... items ) { Observable < T > fromArray = fromArray ( items ) ; if ( fromArray == empty ( ) ) { return RxJavaPlugins . onAssembly ( this ) ; } return concatArray ( fromArray , this ) ; }


Input: Subscribes to an ObservableSource and provides a callback to handle the items it emits . <p > If the Observable emits an error it is wrapped into an { @link io . reactivex . exceptions . OnErrorNotImplementedException OnErrorNotImplementedException } and routed to the RxJavaPlugins . onError handler . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code subscribe } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Disposable subscribe ( Consumer < ? super T > onNext ) { return subscribe ( onNext , Functions . ON_ERROR_MISSING , Functions . EMPTY_ACTION , Functions . emptyConsumer ( ) ) ; }


Input: Subscribes to an ObservableSource and provides callbacks to handle the items it emits and any error notification it issues . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code subscribe } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Disposable subscribe ( Consumer < ? super T > onNext , Consumer < ? super Throwable > onError ) { return subscribe ( onNext , onError , Functions . EMPTY_ACTION , Functions . emptyConsumer ( ) ) ; }


Input: Subscribes to an ObservableSource and provides callbacks to handle the items it emits and any error or completion notification it issues . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code subscribe } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Disposable subscribe ( Consumer < ? super T > onNext , Consumer < ? super Throwable > onError , Action onComplete , Consumer < ? super Disposable > onSubscribe ) { ObjectHelper . requireNonNull ( onNext , "onNext is null" ) ; ObjectHelper . requireNonNull ( onError , "onError is null" ) ; ObjectHelper . requireNonNull ( onComplete , "onComplete is null" ) ; ObjectHelper . requireNonNull ( onSubscribe , "onSubscribe is null" ) ; LambdaObserver < T > ls = new LambdaObserver < T > ( onNext , onError , onComplete , onSubscribe ) ; subscribe ( ls ) ; return ls ; }


Input: Asynchronously subscribes Observers to this ObservableSource on the specified { @link Scheduler } . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / subscribeOn . 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 > subscribeOn ( Scheduler scheduler ) { ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableSubscribeOn < T > ( this , scheduler ) ) ; }


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


Input: Returns a new ObservableSource by applying a function that you supply to each item emitted by the source ObservableSource that returns an ObservableSource and then emitting the items emitted by the most recently emitted of these ObservableSources . <p > The resulting ObservableSource completes if both the upstream ObservableSource and the last inner ObservableSource if any complete . If the upstream ObservableSource signals an onError the inner ObservableSource is disposed and the error delivered in - sequence . <p > <img width = 640 height = 350 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / switchMap . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code switchMap } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > switchMap ( Function < ? super T , ? extends ObservableSource < ? extends R > > mapper , int bufferSize ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; 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 ObservableSwitchMap < T , R > ( this , mapper , bufferSize , false ) ) ; }


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


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


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


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


Input: Returns a new ObservableSource by applying a function that you supply to each item emitted by the source ObservableSource that returns a SingleSource and then emitting the item emitted by the most recently emitted of these SingleSources . <p > The resulting ObservableSource completes if both the upstream ObservableSource and the last inner SingleSource if any complete . If the upstream ObservableSource signals an onError the inner SingleSource is disposed and the error delivered in - sequence . <p > <img width = 640 height = 531 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / switchMapSingle . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) @ NonNull public final < R > Observable < R > switchMapSingle ( @ NonNull Function < ? super T , ? extends SingleSource < ? extends R > > mapper ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableSwitchMapSingle < T , R > ( this , mapper , false ) ) ; }


Input: Returns a new ObservableSource by applying a function that you supply to each item emitted by the source ObservableSource that returns a SingleSource and then emitting the item emitted by the most recently emitted of these SingleSources and delays any error until all SingleSources terminate . <p > The resulting ObservableSource completes if both the upstream ObservableSource and the last inner SingleSource if any complete . If the upstream ObservableSource signals an onError the termination of the last inner SingleSource will emit that error as is or wrapped into a CompositeException along with the other possible errors the former inner SingleSources signalled . <p > <img width = 640 height = 467 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / switchMapSingleDelayError . o . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) @ NonNull public final < R > Observable < R > switchMapSingleDelayError ( @ NonNull Function < ? super T , ? extends SingleSource < ? extends R > > mapper ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableSwitchMapSingle < T , R > ( this , mapper , true ) ) ; }


Input: Returns a new ObservableSource by applying a function that you supply to each item emitted by the source ObservableSource that returns an ObservableSource and then emitting the items emitted by the most recently emitted of these ObservableSources and delays any error until all ObservableSources terminate . <p > The resulting ObservableSource completes if both the upstream ObservableSource and the last inner ObservableSource if any complete . If the upstream ObservableSource signals an onError the termination of the last inner ObservableSource will emit that error as is or wrapped into a CompositeException along with the other possible errors the former inner ObservableSources signalled . <p > <img width = 640 height = 350 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / switchMap . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code switchMapDelayError } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Observable < R > switchMapDelayError ( Function < ? super T , ? extends ObservableSource < ? extends R > > mapper ) { return switchMapDelayError ( mapper , bufferSize ( ) ) ; }


Input: Returns an Observable that emits only the first { @code count } items emitted by the source ObservableSource . If the source emits fewer than { @code count } items then all of its items are emitted . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / take . png alt = > <p > This method returns an ObservableSource that will invoke a subscribing { @link Observer } s { @link Observer#onNext onNext } function a maximum of { @code count } times before invoking { @link Observer#onComplete onComplete } . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code take } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > take ( long count ) { if ( count < 0 ) { throw new IllegalArgumentException ( "count >= 0 required but it was " + count ) ; } return RxJavaPlugins . onAssembly ( new ObservableTake < T > ( this , count ) ) ; }


Input: Returns an Observable that emits those items emitted by source ObservableSource before a specified time runs out . <p > If time runs out before the { @code Observable } completes normally the { @code onComplete } event will be signaled on the default { @code computation } { @link Scheduler } . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / take . t . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code take } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > take ( long time , TimeUnit unit ) { return takeUntil ( timer ( time , unit ) ) ; }


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


Input: Returns an Observable that emits at most the last { @code count } items emitted by the source ObservableSource . If the source emits fewer than { @code count } items then all of its items are emitted . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / takeLast . n . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code takeLast } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > takeLast ( int count ) { if ( count < 0 ) { throw new IndexOutOfBoundsException ( "count >= 0 required but it was " + count ) ; } else if ( count == 0 ) { return RxJavaPlugins . onAssembly ( new ObservableIgnoreElements < T > ( this ) ) ; } else if ( count == 1 ) { return RxJavaPlugins . onAssembly ( new ObservableTakeLastOne < T > ( this ) ) ; } return RxJavaPlugins . onAssembly ( new ObservableTakeLast < T > ( this , count ) ) ; }


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


Input: Returns an Observable that emits the items emitted by the source Observable until a second ObservableSource emits an item . <p > <img width = 640 height = 380 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / takeUntil . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code takeUntil } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U > Observable < T > takeUntil ( ObservableSource < U > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableTakeUntil < T , U > ( this , other ) ) ; }


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


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


Input: Returns an Observable that emits only the first item emitted by the source ObservableSource during sequential time windows of a specified duration where the windows are managed by a specified Scheduler . <p > This differs from { @link #throttleLast } in that this only tracks passage of time whereas { @link #throttleLast } ticks at scheduled intervals . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / throttleFirst . 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 > throttleFirst ( long skipDuration , TimeUnit unit , Scheduler scheduler ) { ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableThrottleFirstTimed < T > ( this , skipDuration , unit , scheduler ) ) ; }


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


Input: Returns an Observable that emits only the last item emitted by the source ObservableSource during sequential time windows of a specified duration where the duration is governed by a specified Scheduler . <p > This differs from { @link #throttleFirst } in that this ticks along at a scheduled interval whereas { @link #throttleFirst } does not tick it just tracks passage of time . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / throttleLast . 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 > throttleLast ( long intervalDuration , TimeUnit unit , Scheduler scheduler ) { return sample ( intervalDuration , unit , scheduler ) ; }


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 ( alias to { @link #debounce ( long TimeUnit Scheduler ) } ) . <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 = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / throttleWithTimeout . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code throttleWithTimeout } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Observable < T > throttleWithTimeout ( long timeout , TimeUnit unit ) { return debounce ( timeout , unit ) ; }


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 ( Alias to { @link #debounce ( long TimeUnit Scheduler ) } ) . <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 = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / throttleWithTimeout . 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 > throttleWithTimeout ( long timeout , TimeUnit unit , Scheduler scheduler ) { return debounce ( timeout , unit , scheduler ) ; }


Input: Returns an Observable that emits records of the time interval between consecutive items emitted by the source ObservableSource . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / timeInterval . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code timeInterval } does not operate on any particular scheduler but uses the current time from the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < Timed < T > > timeInterval ( ) { return timeInterval ( TimeUnit . MILLISECONDS , Schedulers . computation ( ) ) ; }


Input: Returns an Observable that emits records of the time interval between consecutive items emitted by the source ObservableSource where this interval is computed on a specified Scheduler . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / timeInterval . s . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > The operator does not operate on any particular scheduler but uses the current time from the specified { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) // Supplied scheduler is only used for creating timestamps. public final Observable < Timed < T > > timeInterval ( TimeUnit unit , Scheduler scheduler ) { ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableTimeInterval < T > ( this , unit , scheduler ) ) ; }


Input: Returns an Observable that mirrors the source ObservableSource but notifies observers of a { @code TimeoutException } if an item emitted by the source ObservableSource doesn t arrive within a window of time after the emission of the previous item where that period of time is measured by an ObservableSource that is a function of the previous item . <p > <img width = 640 height = 400 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / timeout3 . png alt = > <p > Note : The arrival of the first source item is never timed out . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code timeout } operates by default on the { @code immediate } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < V > Observable < T > timeout ( Function < ? super T , ? extends ObservableSource < V > > itemTimeoutIndicator ) { return timeout0 ( null , itemTimeoutIndicator , null ) ; }


Input: Returns an Observable that mirrors the source ObservableSource but that switches to a fallback ObservableSource if an item emitted by the source ObservableSource doesn t arrive within a window of time after the emission of the previous item where that period of time is measured by an ObservableSource that is a function of the previous item . <p > <img width = 640 height = 400 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / timeout4 . png alt = > <p > Note : The arrival of the first source item is never timed out . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code timeout } operates by default on the { @code immediate } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < V > Observable < T > timeout ( Function < ? super T , ? extends ObservableSource < V > > itemTimeoutIndicator , ObservableSource < ? extends T > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return timeout0 ( null , itemTimeoutIndicator , other ) ; }


Input: Returns an Observable that mirrors the source ObservableSource but applies a timeout policy for each emitted item . If the next item isn t emitted within the specified timeout duration starting from its predecessor the resulting ObservableSource terminates and notifies observers of a { @code TimeoutException } . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / timeout . 1 . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code timeout } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Observable < T > timeout ( long timeout , TimeUnit timeUnit ) { return timeout0 ( timeout , timeUnit , null , Schedulers . computation ( ) ) ; }


Input: Returns an Observable that mirrors the source ObservableSource but applies a timeout policy for each emitted item . If the next item isn t emitted within the specified timeout duration starting from its predecessor the source ObservableSource is disposed and resulting ObservableSource begins instead to mirror a fallback ObservableSource . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / timeout . 2 . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code timeout } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Observable < T > timeout ( long timeout , TimeUnit timeUnit , ObservableSource < ? extends T > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return timeout0 ( timeout , timeUnit , other , Schedulers . computation ( ) ) ; }


Input: Returns an Observable that mirrors the source ObservableSource but applies a timeout policy for each emitted item using a specified Scheduler . If the next item isn t emitted within the specified timeout duration starting from its predecessor the source ObservableSource is disposed and resulting ObservableSource begins instead to mirror a fallback ObservableSource . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / timeout . 2s . 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 > timeout ( long timeout , TimeUnit timeUnit , Scheduler scheduler , ObservableSource < ? extends T > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return timeout0 ( timeout , timeUnit , other , scheduler ) ; }


Input: Returns an Observable that mirrors the source ObservableSource but applies a timeout policy for each emitted item where this policy is governed on a specified Scheduler . If the next item isn t emitted within the specified timeout duration starting from its predecessor the resulting ObservableSource terminates and notifies observers of a { @code TimeoutException } . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / timeout . 1s . 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 > timeout ( long timeout , TimeUnit timeUnit , Scheduler scheduler ) { return timeout0 ( timeout , timeUnit , null , scheduler ) ; }


Input: Returns an Observable that emits each item emitted by the source ObservableSource wrapped in a { @link Timed } object whose timestamps are provided by a specified Scheduler . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / timestamp . s . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This operator does not operate on any particular scheduler but uses the current time from the specified { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) // Supplied scheduler is only used for creating timestamps. public final Observable < Timed < T > > timestamp ( Scheduler scheduler ) { return timestamp ( TimeUnit . MILLISECONDS , scheduler ) ; }


Input: Returns an Observable that emits each item emitted by the source ObservableSource wrapped in a { @link Timed } object whose timestamps are provided by a specified Scheduler . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / timestamp . s . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This operator does not operate on any particular scheduler but uses the current time from the specified { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) // Supplied scheduler is only used for creating timestamps. public final Observable < Timed < T > > timestamp ( final TimeUnit unit , final Scheduler scheduler ) { ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return map ( Functions . < T > timestampWith ( unit , scheduler ) ) ; }


Input: Returns a Single that emits a single item a list composed of all the items emitted by the finite source ObservableSource . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / toList . 2 . png alt = > <p > Normally an ObservableSource that returns multiple items will do so by invoking its { @link Observer } s { @link Observer#onNext onNext } method for each such item . You can change this behavior instructing the ObservableSource to compose a list of all of these items and then to invoke the Observer s { @code onNext } function once passing it the entire list by calling the ObservableSource s { @code toList } method prior to calling its { @link #subscribe } method . <p > Note that this operator requires the upstream to signal { @code onComplete } for the accumulated list to be emitted . Sources that are infinite and never complete will never emit anything through this operator and an infinite source may lead to a fatal { @code OutOfMemoryError } . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code toList } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < List < T > > toList ( final int capacityHint ) { ObjectHelper . verifyPositive ( capacityHint , "capacityHint" ) ; return RxJavaPlugins . onAssembly ( new ObservableToListSingle < T , List < T > > ( this , capacityHint ) ) ; }


Input: Returns a Single that emits a single item a list composed of all the items emitted by the finite source ObservableSource . <p > <img width = 640 height = 365 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / toList . o . c . png alt = > <p > Normally an ObservableSource that returns multiple items will do so by invoking its { @link Observer } s { @link Observer#onNext onNext } method for each such item . You can change this behavior instructing the ObservableSource to compose a list of all of these items and then to invoke the Observer s { @code onNext } function once passing it the entire list by calling the ObservableSource s { @code toList } method prior to calling its { @link #subscribe } method . <p > Note that this operator requires the upstream to signal { @code onComplete } for the accumulated collection to be emitted . Sources that are infinite and never complete will never emit anything through this operator and an infinite source may lead to a fatal { @code OutOfMemoryError } . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code toList } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U extends Collection < ? super T > > Single < U > toList ( Callable < U > collectionSupplier ) { ObjectHelper . requireNonNull ( collectionSupplier , "collectionSupplier is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableToListSingle < T , U > ( this , collectionSupplier ) ) ; }


Input: Returns a Single that emits a single HashMap that contains an ArrayList of items emitted by the finite source ObservableSource keyed by a specified { @code keySelector } function . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / toMultiMap . 2 . png alt = > <p > Note that this operator requires the upstream to signal { @code onComplete } for the accumulated map to be emitted . Sources that are infinite and never complete will never emit anything through this operator and an infinite source may lead to a fatal { @code OutOfMemoryError } . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code toMultimap } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < K > Single < Map < K , Collection < T > > > toMultimap ( Function < ? super T , ? extends K > keySelector ) { @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) Function < ? super T , ? extends T > valueSelector = ( Function ) Functions . identity ( ) ; Callable < Map < K , Collection < T > > > mapSupplier = HashMapSupplier . asCallable ( ) ; Function < K , List < T > > collectionFactory = ArrayListSupplier . asFunction ( ) ; return toMultimap ( keySelector , valueSelector , mapSupplier , collectionFactory ) ; }


Input:
Converts the current Observable into a Flowable by applying the specified backpressure strategy .
 Marble diagrams for the various backpressure strategies are as follows :

 { @link BackpressureStrategy#BUFFER }

 { @link BackpressureStrategy#DROP }

 { @link BackpressureStrategy#LATEST }

 { @link BackpressureStrategy#ERROR }

 { @link BackpressureStrategy#MISSING }

  Backpressure :

 The operator applies the chosen backpressure strategy of { @link BackpressureStrategy } enum .

  Scheduler :

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

 [CODESPLIT] @ BackpressureSupport ( BackpressureKind . SPECIAL ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > toFlowable ( BackpressureStrategy strategy ) { Flowable < T > f = new FlowableFromObservable < T > ( this ) ; switch ( strategy ) { case DROP : return f . onBackpressureDrop ( ) ; case LATEST : return f . onBackpressureLatest ( ) ; case MISSING : return f ; case ERROR : return RxJavaPlugins . onAssembly ( new FlowableOnBackpressureError < T > ( f ) ) ; default : return f . onBackpressureBuffer ( ) ; } }


Input: Returns a Single that emits a list that contains the items emitted by the finite source ObservableSource in a sorted order . Each item emitted by the ObservableSource must implement { @link Comparable } with respect to all other items in the sequence . [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < List < T > > toSortedList ( ) { return toSortedList ( Functions . naturalOrder ( ) ) ; }


Input: Modifies the source ObservableSource so that subscribers will dispose it on a specified { @link Scheduler } . <p > <img width = 640 height = 452 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / unsubscribeOn . o . 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 > unsubscribeOn ( Scheduler scheduler ) { ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableUnsubscribeOn < T > ( this , scheduler ) ) ; }


Input: Returns an Observable that emits windows of items it collects from the source ObservableSource . The resulting ObservableSource emits connected non - overlapping windows each containing { @code count } items . When the source ObservableSource completes or encounters an error the resulting ObservableSource emits the current window and propagates the notification from the source ObservableSource . <p > <img width = 640 height = 400 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / window3 . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code window } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < Observable < T > > window ( long count ) { return window ( count , count , bufferSize ( ) ) ; }


Input: Returns an Observable that emits windows of items it collects from the source ObservableSource . The resulting ObservableSource emits windows every { @code skip } items each containing no more than { @code count } items . When the source ObservableSource completes or encounters an error the resulting ObservableSource emits the current window and propagates the notification from the source ObservableSource . <p > <img width = 640 height = 365 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / window4 . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code window } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < Observable < T > > window ( long count , long skip , int bufferSize ) { ObjectHelper . verifyPositive ( count , "count" ) ; ObjectHelper . verifyPositive ( skip , "skip" ) ; ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return RxJavaPlugins . onAssembly ( new ObservableWindow < T > ( this , count , skip , bufferSize ) ) ; }


Input: Returns an Observable that emits windows of items it collects from the source ObservableSource . The resulting ObservableSource starts a new window periodically as determined by the { @code timeskip } argument . It emits each window after a fixed timespan specified by the { @code timespan } argument . When the source ObservableSource completes or ObservableSource completes or encounters an error the resulting ObservableSource emits the current window and propagates the notification from the source ObservableSource . <p > <img width = 640 height = 335 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / window7 . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code window } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Observable < Observable < T > > window ( long timespan , long timeskip , TimeUnit unit ) { return window ( timespan , timeskip , unit , Schedulers . computation ( ) , bufferSize ( ) ) ; }


Input: Returns an Observable that emits windows of items it collects from the source ObservableSource . The resulting ObservableSource starts a new window periodically as determined by the { @code timeskip } argument . It emits each window after a fixed timespan specified by the { @code timespan } argument . When the source ObservableSource completes or ObservableSource completes or encounters an error the resulting ObservableSource emits the current window and propagates the notification from the source ObservableSource . <p > <img width = 640 height = 335 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / window7 . 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 < Observable < T > > window ( long timespan , long timeskip , TimeUnit unit , Scheduler scheduler , int bufferSize ) { ObjectHelper . verifyPositive ( timespan , "timespan" ) ; ObjectHelper . verifyPositive ( timeskip , "timeskip" ) ; ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; ObjectHelper . requireNonNull ( unit , "unit is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableWindowTimed < T > ( this , timespan , timeskip , unit , scheduler , Long . MAX_VALUE , bufferSize , false ) ) ; }


Input: Returns an Observable that emits windows of items it collects from the source ObservableSource . The resulting ObservableSource emits connected non - overlapping windows each of a fixed duration specified by the { @code timespan } argument . When the source ObservableSource completes or encounters an error the resulting ObservableSource emits the current window and propagates the notification from the source ObservableSource . <p > <img width = 640 height = 375 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / window5 . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code window } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Observable < Observable < T > > window ( long timespan , TimeUnit unit ) { return window ( timespan , unit , Schedulers . computation ( ) , Long . MAX_VALUE , false ) ; }


Input: Returns an Observable that emits windows of items it collects from the source ObservableSource . The resulting ObservableSource emits connected non - overlapping windows each of a fixed duration specified by the { @code timespan } argument or a maximum size specified by the { @code count } argument ( whichever is reached first ) . When the source ObservableSource completes or encounters an error the resulting ObservableSource emits the current window and propagates the notification from the source ObservableSource . <p > <img width = 640 height = 370 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / window6 . 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 < Observable < T > > window ( long timespan , TimeUnit unit , Scheduler scheduler , long count ) { return window ( timespan , unit , scheduler , count , false ) ; }


Input: Returns an Observable that emits windows of items it collects from the source ObservableSource . The resulting ObservableSource emits connected non - overlapping windows each of a fixed duration specified by the { @code timespan } argument or a maximum size specified by the { @code count } argument ( whichever is reached first ) . When the source ObservableSource completes or encounters an error the resulting ObservableSource emits the current window and propagates the notification from the source ObservableSource . <p > <img width = 640 height = 370 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / window6 . 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 < Observable < T > > window ( long timespan , TimeUnit unit , Scheduler scheduler , long count , boolean restart , int bufferSize ) { ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . verifyPositive ( count , "count" ) ; return RxJavaPlugins . onAssembly ( new ObservableWindowTimed < T > ( this , timespan , timespan , unit , scheduler , count , bufferSize , restart ) ) ; }


Input: Returns an Observable that emits non - overlapping windows of items it collects from the source ObservableSource where the boundary of each window is determined by the items emitted from a specified boundary - governing ObservableSource . <p > <img width = 640 height = 475 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / window8 . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code window } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < B > Observable < Observable < T > > window ( ObservableSource < B > boundary ) { return window ( boundary , bufferSize ( ) ) ; }


Input: Returns an Observable that emits windows of items it collects from the source ObservableSource . The resulting ObservableSource emits windows that contain those items emitted by the source ObservableSource between the time when the { @code openingIndicator } ObservableSource emits an item and when the ObservableSource returned by { @code closingIndicator } emits an item . <p > <img width = 640 height = 550 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / window2 . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code window } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U , V > Observable < Observable < T > > window ( ObservableSource < U > openingIndicator , Function < ? super U , ? extends ObservableSource < V > > closingIndicator ) { return window ( openingIndicator , closingIndicator , bufferSize ( ) ) ; }


Input: Returns an Observable that emits windows of items it collects from the source ObservableSource . The resulting ObservableSource emits windows that contain those items emitted by the source ObservableSource between the time when the { @code openingIndicator } ObservableSource emits an item and when the ObservableSource returned by { @code closingIndicator } emits an item . <p > <img width = 640 height = 550 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / window2 . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code window } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U , V > Observable < Observable < T > > window ( ObservableSource < U > openingIndicator , Function < ? super U , ? extends ObservableSource < V > > closingIndicator , int bufferSize ) { ObjectHelper . requireNonNull ( openingIndicator , "openingIndicator is null" ) ; ObjectHelper . requireNonNull ( closingIndicator , "closingIndicator is null" ) ; ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return RxJavaPlugins . onAssembly ( new ObservableWindowBoundarySelector < T , U , V > ( this , openingIndicator , closingIndicator , bufferSize ) ) ; }


Input: Returns an Observable that emits windows of items it collects from the source ObservableSource . The resulting ObservableSource emits connected non - overlapping windows . It emits the current window and opens a new one whenever the ObservableSource produced by the specified { @code closingIndicator } emits an item . <p > <img width = 640 height = 455 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / window1 . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code window } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < B > Observable < Observable < T > > window ( Callable < ? extends ObservableSource < B > > boundary , int bufferSize ) { ObjectHelper . requireNonNull ( boundary , "boundary is null" ) ; ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return RxJavaPlugins . onAssembly ( new ObservableWindowBoundarySupplier < T , B > ( this , boundary , bufferSize ) ) ; }


Input: Returns an Observable that emits items that are the result of applying a specified function to pairs of values one each from the source ObservableSource and a specified Iterable sequence . <p > <img width = 640 height = 380 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / zip . i . png alt = > <p > Note that the { @code other } Iterable is evaluated as items are observed from the source ObservableSource ; it is not pre - consumed . This allows you to zip infinite streams on either side . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code zipWith } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U , R > Observable < R > zipWith ( Iterable < U > other , BiFunction < ? super T , ? super U , ? extends R > zipper ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; ObjectHelper . requireNonNull ( zipper , "zipper is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableZipIterable < T , U , R > ( this , other , zipper ) ) ; }


Input:
Returns an Observable that emits items that are the result of applying a specified function to pairs of values one each from the source ObservableSource and another specified ObservableSource .

 The operator subscribes to its sources in order they are specified and completes eagerly if one of the sources is shorter than the rest while disposing the other sources . Therefore it is possible those other sources will never be able to run to completion ( and thus not calling { @code doOnComplete () } ) . This can also happen if the sources are exactly the same length ; if source A completes and B has been consumed and is about to complete the operator detects A won t be sending further values and it will dispose B immediately . For example :
  range ( 1 5 ) . doOnComplete ( action1 ) . zipWith ( range ( 6 5 ) . doOnComplete ( action2 ) ( a b ) - &gt ; a + b )
 { @code action1 } will be called but { @code action2 } won t .
 To work around this termination property use { @link #doOnDispose ( Action ) } as well or use { @code using () } to do cleanup in case of completion or a dispose () call .

  Scheduler :

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

 [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final  Observable < R > zipWith ( ObservableSource < ? extends U > other , BiFunction < ? super T , ? super U , ? extends R > zipper ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return zip ( this , other , zipper ) ; }


Input: TODO fuse back to Observable [CODESPLIT] @ Override protected void subscribeActual ( MaybeObserver < ? super T > observer ) { source . subscribe ( new LastObserver < T > ( observer ) ) ; }


Input: Returns an { [CODESPLIT] @ NonNull @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public Observable < T > refCount ( ) { return RxJavaPlugins . onAssembly ( new ObservableRefCount < T > ( this ) ) ; }


Input: Connects to the upstream { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > refCount ( int subscriberCount ) { return refCount ( subscriberCount , 0 , TimeUnit . NANOSECONDS , Schedulers . trampoline ( ) ) ; }


Input: Connects to the upstream { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Observable < T > refCount ( long timeout , TimeUnit unit , Scheduler scheduler ) { return refCount ( 1 , timeout , unit , scheduler ) ; }


Input: Connects to the upstream { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Observable < T > refCount ( int subscriberCount , long timeout , TimeUnit unit , Scheduler scheduler ) { ObjectHelper . verifyPositive ( subscriberCount , "subscriberCount" ) ; ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableRefCount < T > ( this , subscriberCount , timeout , unit , scheduler ) ) ; }


Input: Returns an Observable that automatically connects ( at most once ) to this ConnectableObservable when the specified number of Subscribers subscribe to it and calls the specified callback with the Subscription associated with the established connection . <p > <img width = 640 height = 348 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / autoConnect . o . png alt = > <p > The connection happens after the given number of subscriptions and happens at most once during the lifetime of the returned Observable . If this ConnectableObservable terminates the connection is never renewed no matter how Observers come and go . Use { @link #refCount () } to renew a connection or dispose an active connection when all { @code Observer } s have disposed their { @code Disposable } s . [CODESPLIT] @ NonNull public Observable < T > autoConnect ( int numberOfSubscribers , @ NonNull Consumer < ? super Disposable > connection ) { if ( numberOfSubscribers <= 0 ) { this . connect ( connection ) ; return RxJavaPlugins . onAssembly ( this ) ; } return RxJavaPlugins . onAssembly ( new ObservableAutoConnect < T > ( this , numberOfSubscribers , connection ) ) ; }


Input: Validates the number of subscribers and returns true if their number matches the parallelism level of this ParallelFlowable . [CODESPLIT] protected final boolean validate ( @ NonNull Subscriber < ? > [ ] subscribers ) { int p = parallelism ( ) ; if ( subscribers . length != p ) { Throwable iae = new IllegalArgumentException ( "parallelism = " + p + ", subscribers = " + subscribers . length ) ; for ( Subscriber < ? > s : subscribers ) { EmptySubscription . error ( iae , s ) ; } return false ; } return true ; }


Input: Take a Publisher and prepare to consume it on multiple rails ( number of CPUs ) in a round - robin fashion . [CODESPLIT] @ CheckReturnValue public static < T > ParallelFlowable < T > from ( @ NonNull Publisher < ? extends T > source ) { return from ( source , Runtime . getRuntime ( ) . availableProcessors ( ) , Flowable . bufferSize ( ) ) ; }


Input: Take a Publisher and prepare to consume it on parallelism number of rails in a round - robin fashion . [CODESPLIT] @ CheckReturnValue public static < T > ParallelFlowable < T > from ( @ NonNull Publisher < ? extends T > source , int parallelism ) { return from ( source , parallelism , Flowable . bufferSize ( ) ) ; }


Input: Take a Publisher and prepare to consume it on parallelism number of rails possibly ordered and round - robin fashion and use custom prefetch amount and queue for dealing with the source Publisher s values . [CODESPLIT] @ CheckReturnValue @ NonNull public static < T > ParallelFlowable < T > from ( @ NonNull Publisher < ? extends T > source , int parallelism , int prefetch ) { ObjectHelper . requireNonNull ( source , "source" ) ; ObjectHelper . verifyPositive ( parallelism , "parallelism" ) ; ObjectHelper . verifyPositive ( prefetch , "prefetch" ) ; return RxJavaPlugins . onAssembly ( new ParallelFromPublisher < T > ( source , parallelism , prefetch ) ) ; }


Input: Calls the specified converter function during assembly time and returns its resulting value . <p > This allows fluent conversion to any other type . <p > History : 2 . 1 . 7 - experimental [CODESPLIT] @ CheckReturnValue @ NonNull public final < R > R as ( @ NonNull ParallelFlowableConverter < T , R > converter ) { return ObjectHelper . requireNonNull ( converter , "converter is null" ) . apply ( this ) ; }


Input: Maps the source values on each rail to another value . <p > Note that the same mapper function may be called from multiple threads concurrently . [CODESPLIT] @ CheckReturnValue @ NonNull public final < R > ParallelFlowable < R > map ( @ NonNull Function < ? super T , ? extends R > mapper ) { ObjectHelper . requireNonNull ( mapper , "mapper" ) ; return RxJavaPlugins . onAssembly ( new ParallelMap < T , R > ( this , mapper ) ) ; }


Input: Maps the source values on each rail to another value and handles errors based on the given { [CODESPLIT] @ CheckReturnValue @ NonNull public final < R > ParallelFlowable < R > map ( @ NonNull Function < ? super T , ? extends R > mapper , @ NonNull ParallelFailureHandling errorHandler ) { ObjectHelper . requireNonNull ( mapper , "mapper" ) ; ObjectHelper . requireNonNull ( errorHandler , "errorHandler is null" ) ; return RxJavaPlugins . onAssembly ( new ParallelMapTry < T , R > ( this , mapper , errorHandler ) ) ; }


Input: Filters the source values on each rail . <p > Note that the same predicate may be called from multiple threads concurrently . [CODESPLIT] @ CheckReturnValue public final ParallelFlowable < T > filter ( @ NonNull Predicate < ? super T > predicate ) { ObjectHelper . requireNonNull ( predicate , "predicate" ) ; return RxJavaPlugins . onAssembly ( new ParallelFilter < T > ( this , predicate ) ) ; }


Input: Filters the source values on each rail and handles errors based on the given { [CODESPLIT] @ CheckReturnValue public final ParallelFlowable < T > filter ( @ NonNull Predicate < ? super T > predicate , @ NonNull ParallelFailureHandling errorHandler ) { ObjectHelper . requireNonNull ( predicate , "predicate" ) ; ObjectHelper . requireNonNull ( errorHandler , "errorHandler is null" ) ; return RxJavaPlugins . onAssembly ( new ParallelFilterTry < T > ( this , predicate , errorHandler ) ) ; }


Input: Specifies where each rail will observe its incoming values with no work - stealing and default prefetch amount . <p > This operator uses the default prefetch size returned by { @code Flowable . bufferSize () } . <p > The operator will call { @code Scheduler . createWorker () } as many times as this ParallelFlowable s parallelism level is . <p > No assumptions are made about the Scheduler s parallelism level if the Scheduler s parallelism level is lower than the ParallelFlowable s some rails may end up on the same thread / worker . <p > This operator doesn t require the Scheduler to be trampolining as it does its own built - in trampolining logic . [CODESPLIT] @ CheckReturnValue @ NonNull public final ParallelFlowable < T > runOn ( @ NonNull Scheduler scheduler ) { return runOn ( scheduler , Flowable . bufferSize ( ) ) ; }


Input: Specifies where each rail will observe its incoming values with possibly work - stealing and a given prefetch amount . <p > This operator uses the default prefetch size returned by { @code Flowable . bufferSize () } . <p > The operator will call { @code Scheduler . createWorker () } as many times as this ParallelFlowable s parallelism level is . <p > No assumptions are made about the Scheduler s parallelism level if the Scheduler s parallelism level is lower than the ParallelFlowable s some rails may end up on the same thread / worker . <p > This operator doesn t require the Scheduler to be trampolining as it does its own built - in trampolining logic . [CODESPLIT] @ CheckReturnValue @ NonNull public final ParallelFlowable < T > runOn ( @ NonNull Scheduler scheduler , int prefetch ) { ObjectHelper . requireNonNull ( scheduler , "scheduler" ) ; ObjectHelper . verifyPositive ( prefetch , "prefetch" ) ; return RxJavaPlugins . onAssembly ( new ParallelRunOn < T > ( this , scheduler , prefetch ) ) ; }


Input: Reduces all values within a rail and across rails with a reducer function into a single sequential value . <p > Note that the same reducer function may be called from multiple threads concurrently . [CODESPLIT] @ CheckReturnValue @ NonNull public final Flowable < T > reduce ( @ NonNull BiFunction < T , T , T > reducer ) { ObjectHelper . requireNonNull ( reducer , "reducer" ) ; return RxJavaPlugins . onAssembly ( new ParallelReduceFull < T > ( this , reducer ) ) ; }


Input: Reduces all values within a rail to a single value ( with a possibly different type ) via a reducer function that is initialized on each rail from an initialSupplier value . <p > Note that the same mapper function may be called from multiple threads concurrently . [CODESPLIT] @ CheckReturnValue @ NonNull public final < R > ParallelFlowable < R > reduce ( @ NonNull Callable < R > initialSupplier , @ NonNull BiFunction < R , ? super T , R > reducer ) { ObjectHelper . requireNonNull ( initialSupplier , "initialSupplier" ) ; ObjectHelper . requireNonNull ( reducer , "reducer" ) ; return RxJavaPlugins . onAssembly ( new ParallelReduce < T , R > ( this , initialSupplier , reducer ) ) ; }


Input: Merges the values from each rail in a round - robin or same - order fashion and exposes it as a regular Publisher sequence running with a default prefetch value for the rails . <p > This operator uses the default prefetch size returned by { [CODESPLIT] @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) @ CheckReturnValue public final Flowable < T > sequential ( ) { return sequential ( Flowable . bufferSize ( ) ) ; }


Input: Merges the values from each rail in a round - robin or same - order fashion and exposes it as a regular Publisher sequence running with a give prefetch value for the rails . <img width = 640 height = 602 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / parallelflowable . sequential . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) @ CheckReturnValue @ NonNull public final Flowable < T > sequential ( int prefetch ) { ObjectHelper . verifyPositive ( prefetch , "prefetch" ) ; return RxJavaPlugins . onAssembly ( new ParallelJoin < T > ( this , prefetch , false ) ) ; }


Input: Merges the values from each rail in a round - robin or same - order fashion and exposes it as a regular Flowable sequence running with a default prefetch value for the rails and delaying errors from all rails till all terminate . <p > This operator uses the default prefetch size returned by { [CODESPLIT] @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) @ CheckReturnValue @ NonNull public final Flowable < T > sequentialDelayError ( ) { return sequentialDelayError ( Flowable . bufferSize ( ) ) ; }


Input: Merges the values from each rail in a round - robin or same - order fashion and exposes it as a regular Publisher sequence running with a give prefetch value for the rails and delaying errors from all rails till all terminate . <img width = 640 height = 602 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / parallelflowable . sequential . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) @ CheckReturnValue @ NonNull public final Flowable < T > sequentialDelayError ( int prefetch ) { ObjectHelper . verifyPositive ( prefetch , "prefetch" ) ; return RxJavaPlugins . onAssembly ( new ParallelJoin < T > ( this , prefetch , true ) ) ; }


Input: Sorts the rails of this ParallelFlowable and returns a Publisher that sequentially picks the smallest next value from the rails . <p > This operator requires a finite source ParallelFlowable . [CODESPLIT] @ CheckReturnValue @ NonNull public final Flowable < T > sorted ( @ NonNull Comparator < ? super T > comparator ) { return sorted ( comparator , 16 ) ; }


Input: Sorts the rails according to the comparator and returns a full sorted list as a Publisher . <p > This operator requires a finite source ParallelFlowable . [CODESPLIT] @ CheckReturnValue @ NonNull public final Flowable < List < T > > toSortedList ( @ NonNull Comparator < ? super T > comparator ) { return toSortedList ( comparator , 16 ) ; }