signature:
public class Single { /** * < strong > This method requires advanced knowledge about building operators , please consider
 * other standard composition methods first ; < / strong >
 * Returns a { @ code Single } which , when subscribed to , invokes the { @ link SingleOperator # apply ( SingleObserver ) apply ( SingleObserver ) } method
 * of the provided { @ link SingleOperator } for each individual downstream { @ link Single } and allows the
 * insertion of a custom operator by accessing the downstream ' s { @ link SingleObserver } during this subscription phase
 * and providing a new { @ code SingleObserver } , containing the custom operator ' s intended business logic , that will be
 * used in the subscription process going further upstream .
 * Generally , such a new { @ code SingleObserver } will wrap the downstream ' s { @ code SingleObserver } and forwards the
 * { @ code onSuccess } and { @ code onError } events from the upstream directly or according to the
 * emission pattern the custom operator ' s business logic requires . In addition , such operator can intercept the
 * flow control calls of { @ code dispose } and { @ code isDisposed } that would have traveled upstream and perform
 * additional actions depending on the same business logic requirements .
 * Example :
 * < pre > < code >
 * / / Step 1 : Create the consumer type that will be returned by the SingleOperator . apply ( ) :
 * public final class CustomSingleObserver & lt ; T & gt ; implements SingleObserver & lt ; T & gt ; , Disposable {
 * / / The downstream ' s SingleObserver that will receive the onXXX events
 * final SingleObserver & lt ; ? super String & gt ; downstream ;
 * / / The connection to the upstream source that will call this class ' onXXX methods
 * Disposable upstream ;
 * / / The constructor takes the downstream subscriber and usually any other parameters
 * public CustomSingleObserver ( SingleObserver & lt ; ? super String & gt ; downstream ) {
 * this . downstream = downstream ;
 * / / In the subscription phase , the upstream sends a Disposable to this class
 * / / and subsequently this class has to send a Disposable to the downstream .
 * / / Note that relaying the upstream ' s Disposable directly is not allowed in RxJava
 * & # 64 ; Override
 * public void onSubscribe ( Disposable d ) {
 * if ( upstream ! = null ) {
 * d . dispose ( ) ;
 * } else {
 * upstream = d ;
 * downstream . onSubscribe ( this ) ;
 * / / The upstream calls this with the next item and the implementation ' s
 * / / responsibility is to emit an item to the downstream based on the intended
 * / / business logic , or if it can ' t do so for the particular item ,
 * / / request more from the upstream
 * & # 64 ; Override
 * public void onSuccess ( T item ) {
 * String str = item . toString ( ) ;
 * if ( str . length ( ) & lt ; 2 ) {
 * downstream . onSuccess ( str ) ;
 * } else {
 * / / Single is usually expected to produce one of the onXXX events
 * downstream . onError ( new NoSuchElementException ( ) ) ;
 * / / Some operators may handle the upstream ' s error while others
 * / / could just forward it to the downstream .
 * & # 64 ; Override
 * public void onError ( Throwable throwable ) {
 * downstream . onError ( throwable ) ;
 * / / Some operators may use their own resources which should be cleaned up if
 * / / the downstream disposes the flow before it completed . Operators without
 * / / resources can simply forward the dispose to the upstream .
 * / / In some cases , a disposed flag may be set by this method so that other parts
 * / / of this class may detect the dispose and stop sending events
 * / / to the downstream .
 * & # 64 ; Override
 * public void dispose ( ) {
 * upstream . dispose ( ) ;
 * / / Some operators may simply forward the call to the upstream while others
 * / / can return the disposed flag set in dispose ( ) .
 * & # 64 ; Override
 * public boolean isDisposed ( ) {
 * return upstream . isDisposed ( ) ;
 * / / Step 2 : Create a class that implements the SingleOperator interface and
 * / / returns the custom consumer type from above in its apply ( ) method .
 * / / Such class may define additional parameters to be submitted to
 * / / the custom consumer type .
 * final class CustomSingleOperator & lt ; T & gt ; implements SingleOperator & lt ; String & gt ; {
 * & # 64 ; Override
 * public SingleObserver & lt ; ? super String & gt ; apply ( SingleObserver & lt ; ? super T & gt ; upstream ) {
 * return new CustomSingleObserver & lt ; T & gt ; ( upstream ) ;
 * / / Step 3 : Apply the custom operator via lift ( ) in a flow by creating an instance of it
 * / / or reusing an existing one .
 * Single . just ( 5)
 * . lift ( new CustomSingleOperator & lt ; Integer & gt ; ( ) )
 * . test ( )
 * . assertResult ( " 5 " ) ;
 * Single . just ( 15)
 * . lift ( new CustomSingleOperator & lt ; Integer & gt ; ( ) )
 * . test ( )
 * . assertFailure ( NoSuchElementException . class ) ;
 * < / code > < / pre >
 * Creating custom operators can be complicated and it is recommended one consults the
 * < a href = " https : / / github . com / ReactiveX / RxJava / wiki / Writing - operators - for - 2.0 " > RxJava wiki : Writing operators < / a > page about
 * the tools , requirements , rules , considerations and pitfalls of implementing them .
 * Note that implementing custom operators via this { @ code lift ( ) } method adds slightly more overhead by requiring
 * an additional allocation and indirection per assembled flows . Instead , extending the abstract { @ code Single }
 * class and creating a { @ link SingleTransformer } with it is recommended .
 * Note also that it is not possible to stop the subscription phase in { @ code lift ( ) } as the { @ code apply ( ) } method
 * requires a non - null { @ code SingleObserver } instance to be returned , which is then unconditionally subscribed to
 * the upstream { @ code Single } . For example , if the operator decided there is no reason to subscribe to the
 * upstream source because of some optimization possibility or a failure to prepare the operator , it still has to
 * return a { @ code SingleObserver } that should immediately dispose the upstream ' s { @ code Disposable } in its
 * { @ code onSubscribe } method . Again , using a { @ code SingleTransformer } and extending the { @ code Single } is
 * a better option as { @ link # subscribeActual } can decide to not subscribe to its upstream after all .
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code lift } does not operate by default on a particular { @ link Scheduler } , however , the
 * { @ link SingleOperator } may use a { @ code Scheduler } to support its own asynchronous behavior . < / dd >
 * < / dl >
 * @ param < R > the output value type
 * @ param lift the { @ link SingleOperator } that receives the downstream ' s { @ code SingleObserver } and should return
 * a { @ code SingleObserver } with custom behavior to be used as the consumer for the current
 * { @ code Single } .
 * @ return the new Single instance
 * @ see < a href = " https : / / github . com / ReactiveX / RxJava / wiki / Writing - operators - for - 2.0 " > RxJava wiki : Writing operators < / a >
 * @ see # compose ( SingleTransformer ) */
@ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Single < R > lift ( final SingleOperator < ? extends R , ? super T > lift ) { } }

implementation: ObjectHelper . requireNonNull ( lift , "lift is null" ) ; return RxJavaPlugins . onAssembly ( new SingleLift < T , R > ( this , lift ) ) ;


signature:
public class Single { /** * Returns a Single that applies a specified function to the item emitted by the source Single and
 * emits the result of this function application .
 * < img width = " 640 " height = " 305 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Single . map . png " alt = " " >
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code map } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param < R > the result value type
 * @ param mapper
 * a function to apply to the item emitted by the Single
 * @ return a Single that emits the item from the source Single , transformed by the specified function
 * @ see < a href = " http : / / reactivex . io / documentation / operators / map . html " > ReactiveX operators documentation : Map < / a > */
@ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Single < R > map ( Function < ? super T , ? extends R > mapper ) { } }

implementation: ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; return RxJavaPlugins . onAssembly ( new SingleMap < T , R > ( this , mapper ) ) ;


signature:
public class Single { /** * Maps the signal types of this Single into a { @ link Notification } of the same kind
 * and emits it as a single success value to downstream .
 * < img width = " 640 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / materialize . png " alt = " " >
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code materialize } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ return the new Single instance
 * @ since 2.2.4 - experimental
 * @ see # dematerialize ( Function ) */
@ Experimental @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < Notification < T > > materialize ( ) { } }

implementation: return RxJavaPlugins . onAssembly ( new SingleMaterialize < T > ( this ) ) ;


signature:
public class Single { /** * Signals true if the current Single signals a success value that is Object - equals with the value
 * provided .
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code contains } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param value the value to compare against the success value of this Single
 * @ return the new Single instance
 * @ since 2.0 */
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < Boolean > contains ( Object value ) { } }

implementation: return contains ( value , ObjectHelper . equalsPredicate ( ) ) ;


signature:
public class Single { /** * Flattens this and another Single into a single Flowable , without any transformation .
 * < img width = " 640 " height = " 415 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Single . mergeWith . png " alt = " " >
 * You can combine items emitted by multiple Singles so that they appear as a single Flowable , by using
 * the { @ code mergeWith } method .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The returned { @ code Flowable } honors the backpressure of the downstream consumer . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code mergeWith } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param other
 * a SingleSource to be merged
 * @ return that emits all of the items emitted by the source Singles
 * @ see < a href = " http : / / reactivex . io / documentation / operators / merge . html " > ReactiveX operators documentation : Merge < / a > */
@ BackpressureSupport ( BackpressureKind . FULL ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > mergeWith ( SingleSource < ? extends T > other ) { } }

implementation: return merge ( this , other ) ;


signature:
public class Single { /** * Modifies a Single to emit its item ( or notify of its error ) on a specified { @ link Scheduler } ,
 * asynchronously .
 * < img width = " 640 " height = " 305 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Single . observeOn . png " alt = " " >
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > you specify which { @ link Scheduler } this operator will use . < / dd >
 * < / dl >
 * @ param scheduler
 * the { @ link Scheduler } to notify subscribers on
 * @ return the source Single modified so that its subscribers are notified on the specified
 * { @ link Scheduler }
 * @ throws NullPointerException if scheduler is null
 * @ see < a href = " http : / / reactivex . io / documentation / operators / observeon . html " > ReactiveX operators documentation : ObserveOn < / a >
 * @ see < a href = " http : / / www . grahamlea . com / 2014/07 / rxjava - threading - examples / " > RxJava Threading Examples < / a >
 * @ see # subscribeOn */
@ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Single < T > observeOn ( final Scheduler scheduler ) { } }

implementation: ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new SingleObserveOn < T > ( this , scheduler ) ) ;


signature:
public class Single { /** * Instructs a Single to emit an item ( returned by a specified function ) rather than invoking
 * { @ link SingleObserver # onError onError } if it encounters an error .
 * < img width = " 640 " height = " 451 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Single . onErrorReturn . png " alt = " " >
 * By default , when a Single encounters an error that prevents it from emitting the expected item to its
 * subscriber , the Single invokes its subscriber ' s { @ link SingleObserver # onError } method , and then quits
 * without invoking any more of its subscriber ' s methods . The { @ code onErrorReturn } method changes this
 * behavior . If you pass a function ( { @ code resumeFunction } ) to a Single ' s { @ code onErrorReturn } method , if
 * the original Single encounters an error , instead of invoking its subscriber ' s
 * { @ link SingleObserver # onError } method , it will instead emit the return value of { @ code resumeFunction } .
 * You can use this to prevent errors from propagating or to supply fallback data should errors be
 * encountered .
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code onErrorReturn } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param resumeFunction
 * a function that returns an item that the new Single will emit if the source Single encounters
 * an error
 * @ return the original Single with appropriately modified behavior
 * @ see < a href = " http : / / reactivex . io / documentation / operators / catch . html " > ReactiveX operators documentation : Catch < / a > */
@ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > onErrorReturn ( final Function < Throwable , ? extends T > resumeFunction ) { } }

implementation: ObjectHelper . requireNonNull ( resumeFunction , "resumeFunction is null" ) ; return RxJavaPlugins . onAssembly ( new SingleOnErrorReturn < T > ( this , resumeFunction , null ) ) ;


signature:
public class Single { /** * Nulls out references to the upstream producer and downstream SingleObserver if
 * the sequence is terminated or downstream calls dispose ( ) .
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code onTerminateDetach } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * < p > History : 2.1.5 - experimental
 * @ return a Single which nulls out references to the upstream producer and downstream SingleObserver if
 * the sequence is terminated or downstream calls dispose ( )
 * @ since 2.2 */
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > onTerminateDetach ( ) { } }

implementation: return RxJavaPlugins . onAssembly ( new SingleDetach < T > ( this ) ) ;


signature:
public class Single { /** * Repeatedly re - subscribes to the current Single and emits each success value .
 * < img width = " 640 " height = " 457 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Single . repeat . png " alt = " " >
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The returned { @ code Flowable } honors the backpressure of the downstream consumer . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code repeat } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ return the new Flowable instance
 * @ since 2.0 */
@ BackpressureSupport ( BackpressureKind . FULL ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > repeat ( ) { } }

implementation: return toFlowable ( ) . repeat ( ) ;


signature:
public class Single { /** * Repeatedly re - subscribes to the current Single indefinitely if it fails with an onError .
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code retry } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ return the new Single instance
 * @ since 2.0 */
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > retry ( ) { } }

implementation: return toSingle ( toFlowable ( ) . retry ( ) ) ;


signature:
public class Single { /** * Re - subscribe to the current Single if the given predicate returns true when the Single fails
 * with an onError .
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code retry } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param predicate the predicate called with the resubscription count and the failure Throwable
 * and should return true if a resubscription should happen
 * @ return the new Single instance
 * @ since 2.0 */
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > retry ( BiPredicate < ? super Integer , ? super Throwable > predicate ) { } }

implementation: return toSingle ( toFlowable ( ) . retry ( predicate ) ) ;


signature:
public class Single { /** * Repeatedly re - subscribe at most times or until the predicate returns false , whichever happens first
 * if it fails with an onError .
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code retry } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * < p > History : 2.1.8 - experimental
 * @ param times the number of times to resubscribe if the current Single fails
 * @ param predicate the predicate called with the failure Throwable
 * and should return true if a resubscription should happen
 * @ return the new Single instance
 * @ since 2.2 */
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > retry ( long times , Predicate < ? super Throwable > predicate ) { } }

implementation: return toSingle ( toFlowable ( ) . retry ( times , predicate ) ) ;


signature:
public class Single { /** * Re - subscribes to the current Single if and when the Publisher returned by the handler
 * function signals a value .
 * If the Publisher signals an onComplete , the resulting Single will signal a NoSuchElementException .
 * Note that the inner { @ code Publisher } returned by the handler function should signal
 * either { @ code onNext } , { @ code onError } or { @ code onComplete } in response to the received
 * { @ code Throwable } to indicate the operator should retry or terminate . If the upstream to
 * the operator is asynchronous , signalling onNext followed by onComplete immediately may
 * result in the sequence to be completed immediately . Similarly , if this inner
 * { @ code Publisher } signals { @ code onError } or { @ code onComplete } while the upstream is
 * active , the sequence is terminated with the same signal immediately .
 * The following example demonstrates how to retry an asynchronous source with a delay :
 * < pre > < code >
 * Single . timer ( 1 , TimeUnit . SECONDS )
 * . doOnSubscribe ( s - & gt ; System . out . println ( " subscribing " ) )
 * . map ( v - & gt ; { throw new RuntimeException ( ) ; } )
 * . retryWhen ( errors - & gt ; {
 * AtomicInteger counter = new AtomicInteger ( ) ;
 * return errors
 * . takeWhile ( e - & gt ; counter . getAndIncrement ( ) ! = 3)
 * . flatMap ( e - & gt ; {
 * System . out . println ( " delay retry by " + counter . get ( ) + " second ( s ) " ) ;
 * return Flowable . timer ( counter . get ( ) , TimeUnit . SECONDS ) ;
 * . blockingGet ( ) ;
 * < / code > < / pre >
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code retryWhen } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param handler the function that receives a Flowable of the error the Single emits and should
 * return a Publisher that should signal a normal value ( in response to the
 * throwable the Flowable emits ) to trigger a resubscription or signal an error to
 * be the output of the resulting Single
 * @ return the new Single instance */
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > retryWhen ( Function < ? super Flowable < Throwable > , ? extends Publisher < ? > > handler ) { } }

implementation: return toSingle ( toFlowable ( ) . retryWhen ( handler ) ) ;


signature:
public class Single { /** * Subscribes to a Single and provides a callback to handle the item it emits .
 * If the Single 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 >
 * @ param onSuccess
 * the { @ code Consumer < T > } you have designed to accept the emission from the Single
 * @ return a { @ link Disposable } reference can request the { @ link Single } stop work .
 * @ throws NullPointerException
 * if { @ code onSuccess } is null
 * @ see < a href = " http : / / reactivex . io / documentation / operators / subscribe . html " > ReactiveX operators documentation : Subscribe < / a > */
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Disposable subscribe ( Consumer < ? super T > onSuccess ) { } }

implementation: return subscribe ( onSuccess , Functions . ON_ERROR_MISSING ) ;


signature:
public class Single { /** * Subscribes to a Single and provides callbacks to handle the item it emits or 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 >
 * @ param onSuccess
 * the { @ code Consumer < T > } you have designed to accept the emission from the Single
 * @ param onError
 * the { @ code Consumer < Throwable > } you have designed to accept any error notification from the
 * Single
 * @ return a { @ link Disposable } reference can request the { @ link Single } stop work .
 * @ see < a href = " http : / / reactivex . io / documentation / operators / subscribe . html " > ReactiveX operators documentation : Subscribe < / a >
 * @ throws NullPointerException
 * if { @ code onSuccess } is null , or
 * if { @ code onError } is null */
@ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final Disposable subscribe ( final Consumer < ? super T > onSuccess , final Consumer < ? super Throwable > onError ) { } }

implementation: ObjectHelper . requireNonNull ( onSuccess , "onSuccess is null" ) ; ObjectHelper . requireNonNull ( onError , "onError is null" ) ; ConsumerSingleObserver < T > observer = new ConsumerSingleObserver < T > ( onSuccess , onError ) ; subscribe ( observer ) ; return observer ;


signature:
public class Single { /** * Subscribes a given SingleObserver ( subclass ) to this Single and returns the given
 * SingleObserver as is .
 * < p > Usage example :
 * < pre > < code >
 * Single & lt ; Integer & gt ; source = Single . just ( 1 ) ;
 * CompositeDisposable composite = new CompositeDisposable ( ) ;
 * DisposableSingleObserver & lt ; Integer & gt ; ds = new DisposableSingleObserver & lt ; & gt ; ( ) {
 * composite . add ( source . subscribeWith ( ds ) ) ;
 * < / code > < / pre >
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code subscribeWith } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param < E > the type of the SingleObserver to use and return
 * @ param observer the SingleObserver ( subclass ) to use and return , not null
 * @ return the input { @ code observer }
 * @ throws NullPointerException if { @ code observer } is null
 * @ since 2.0 */
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < E extends SingleObserver < ? super T > > E subscribeWith ( E observer ) { } }

implementation: subscribe ( observer ) ; return observer ;


signature:
public class Single { /** * Asynchronously subscribes subscribers to this Single on the specified { @ link Scheduler } .
 * < img width = " 640 " height = " 305 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Single . subscribeOn . png " alt = " " >
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > You specify which { @ link Scheduler } this operator will use . < / dd >
 * < / dl >
 * @ param scheduler
 * the { @ link Scheduler } to perform subscription actions on
 * @ return the source Single modified so that its subscriptions happen on the specified { @ link Scheduler }
 * @ see < a href = " http : / / reactivex . io / documentation / operators / subscribeon . html " > ReactiveX operators documentation : SubscribeOn < / a >
 * @ see < a href = " http : / / www . grahamlea . com / 2014/07 / rxjava - threading - examples / " > RxJava Threading Examples < / a >
 * @ see # observeOn */
@ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Single < T > subscribeOn ( final Scheduler scheduler ) { } }

implementation: ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new SingleSubscribeOn < T > ( this , scheduler ) ) ;


signature:
public class Single { /** * Returns a Single that emits the item emitted by the source Single until a Completable terminates . Upon
 * termination of { @ code other } , this will emit a { @ link CancellationException } rather than go to
 * { @ link SingleObserver # onSuccess ( Object ) } .
 * < 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 >
 * @ param other
 * the Completable whose termination will cause { @ code takeUntil } to emit the item from the source
 * Single
 * @ return a Single that emits the item emitted by the source Single until such time as { @ code other } terminates .
 * @ see < a href = " http : / / reactivex . io / documentation / operators / takeuntil . html " > ReactiveX operators documentation : TakeUntil < / a > */
@ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > takeUntil ( final CompletableSource other ) { } }

implementation: ObjectHelper . requireNonNull ( other , "other is null" ) ; return takeUntil ( new CompletableToFlowable < T > ( other ) ) ;


signature:
public class Single { /** * Signals a TimeoutException if the current Single doesn ' t signal a success value within the
 * specified timeout window .
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code timeout } signals the TimeoutException on the { @ code computation } { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param timeout the timeout amount
 * @ param unit the time unit
 * @ return the new Single instance
 * @ since 2.0 */
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Single < T > timeout ( long timeout , TimeUnit unit ) { } }

implementation: return timeout0 ( timeout , unit , Schedulers . computation ( ) , null ) ;


signature:
public class Single { /** * Signals a TimeoutException if the current Single doesn ' t signal a success value within the
 * specified timeout window .
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code timeout } signals the TimeoutException on the { @ link Scheduler } you specify . < / dd >
 * < / dl >
 * @ param timeout the timeout amount
 * @ param unit the time unit
 * @ param scheduler the target scheduler where the timeout is awaited and the TimeoutException
 * signalled
 * @ return the new Single instance
 * @ since 2.0 */
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Single < T > timeout ( long timeout , TimeUnit unit , Scheduler scheduler ) { } }

implementation: return timeout0 ( timeout , unit , scheduler , null ) ;


signature:
public class Single { /** * Returns a { @ link Completable } that discards result of the { @ link Single }
 * and calls { @ code onComplete } when this source { @ link Single } calls
 * { @ code onSuccess } . Error terminal event is propagated .
 * < img width = " 640 " height = " 436 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Single . toCompletable . png " alt = " " >
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code toCompletable } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ return a { @ link Completable } that calls { @ code onComplete } on it ' s subscriber when the source { @ link Single }
 * calls { @ code onSuccess } .
 * @ since 2.0
 * @ deprecated see { @ link # ignoreElement ( ) } instead , will be removed in 3.0 */
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) @ Deprecated public final Completable toCompletable ( ) { } }

implementation: return RxJavaPlugins . onAssembly ( new CompletableFromSingle < T > ( this ) ) ;


signature:
public class Single { /** * Returns a { @ link Future } representing the single value emitted by this { @ code Single } .
 * < img width = " 640 " height = " 467 " src = " https : / / github . com / ReactiveX / RxJava / wiki / images / rx - operators / Single . toFuture . png " alt = " " >
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code toFuture } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ return a { @ link Future } that expects a single item to be emitted by this { @ code Single }
 * @ see < a href = " http : / / reactivex . io / documentation / operators / to . html " > ReactiveX documentation : To < / a > */
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Future < T > toFuture ( ) { } }

implementation: return subscribeWith ( new FutureSingleObserver < T > ( ) ) ;


signature:
public class Single { /** * Returns a Single which makes sure when a SingleObserver disposes the Disposable ,
 * that call is propagated up on the specified scheduler .
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code unsubscribeOn } calls dispose ( ) of the upstream on the { @ link Scheduler } you specify . < / dd >
 * < / dl >
 * < p > History : 2.0.9 - experimental
 * @ param scheduler the target scheduler where to execute the disposal
 * @ return the new Single instance
 * @ throws NullPointerException if scheduler is null
 * @ since 2.2 */
@ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Single < T > unsubscribeOn ( final Scheduler scheduler ) { } }

implementation: ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new SingleUnsubscribeOn < T > ( this , scheduler ) ) ;


signature:
public class Single { /** * Returns a Single that emits the result of applying a specified function to the pair of items emitted by
 * the source Single and another specified Single .
 * < img width = " 640 " height = " 380 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Single . zip . png " alt = " " >
 * < dl >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code zipWith } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param < U >
 * the type of items emitted by the { @ code other } Single
 * @ param < R >
 * the type of items emitted by the resulting Single
 * @ param other
 * the other SingleSource
 * @ param zipper
 * a function that combines the pairs of items from the two SingleSources to generate the items to
 * be emitted by the resulting Single
 * @ return a Single that pairs up values from the source Single and the { @ code other } SingleSource
 * and emits the results of { @ code zipFunction } applied to these pairs
 * @ see < a href = " http : / / reactivex . io / documentation / operators / zip . html " > ReactiveX operators documentation : Zip < / a > */
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U , R > Single < R > zipWith ( SingleSource < U > other , BiFunction < ? super T , ? super U , ? extends R > zipper ) { } }

implementation: return zip ( this , other , zipper ) ;


signature:
public class MulticastProcessor { /** * Constructs a fresh instance with the default Flowable . bufferSize ( ) prefetch
 * amount and no refCount - behavior .
 * @ param < T > the input and output value type
 * @ return the new MulticastProcessor instance */
@ CheckReturnValue @ NonNull public static < T > MulticastProcessor < T > create ( ) { } }

implementation: return new MulticastProcessor < T > ( bufferSize ( ) , false ) ;


signature:
public class MulticastProcessor { /** * Constructs a fresh instance with the default Flowable . bufferSize ( ) prefetch
 * amount and the optional refCount - behavior .
 * @ param < T > the input and output value type
 * @ param refCount if true and if all Subscribers have canceled , the upstream
 * is cancelled
 * @ return the new MulticastProcessor instance */
@ CheckReturnValue @ NonNull public static < T > MulticastProcessor < T > create ( boolean refCount ) { } }

implementation: return new MulticastProcessor < T > ( bufferSize ( ) , refCount ) ;


signature:
public class MulticastProcessor { /** * Initializes this Processor by setting an upstream Subscription that
 * ignores request amounts , uses a fixed buffer
 * and allows using the onXXX and offer methods
 * afterwards . */
public void start ( ) { } }

implementation: if ( SubscriptionHelper . setOnce ( upstream , EmptySubscription . INSTANCE ) ) { queue = new SpscArrayQueue < T > ( bufferSize ) ; }


signature:
public class MulticastProcessor { /** * Initializes this Processor by setting an upstream Subscription that
 * ignores request amounts , uses an unbounded buffer
 * and allows using the onXXX and offer methods
 * afterwards . */
public void startUnbounded ( ) { } }

implementation: if ( SubscriptionHelper . setOnce ( upstream , EmptySubscription . INSTANCE ) ) { queue = new SpscLinkedArrayQueue < T > ( bufferSize ) ; }


signature:
public class MulticastProcessor { /** * Tries to offer an item into the internal queue and returns false
 * if the queue is full .
 * @ param t the item to offer , not null
 * @ return true if successful , false if the queue is full */
public boolean offer ( T t ) { } }

implementation: if ( once . get ( ) ) { return false ; } ObjectHelper . requireNonNull ( t , "offer called with null. Null values are generally not allowed in 2.x operators and sources." ) ; if ( fusionMode == QueueSubscription . NONE ) { if ( queue . offer ( t ) ) { drain ( ) ; return true ; } } return false ;


signature:
public class SpscLinkedArrayQueue { /** * { @ inheritDoc }
 * This implementation is correct for single producer thread use only . */
@ Override public boolean offer ( final T e ) { } }

implementation:
if ( null == e ) { throw new NullPointerException ( "Null is not a valid element" ) ; } // local load of field to avoid repeated loads after volatile reads
final AtomicReferenceArray < Object > buffer = producerBuffer ; final long index = lpProducerIndex ( ) ; final int mask = producerMask ; final int offset = calcWrappedOffset ( index , mask ) ; if ( index < producerLookAhead ) { return writeToQueue ( buffer , e , index , offset ) ; } else { final int lookAheadStep = producerLookAheadStep ; // go around the buffer or resize if full ( unless we hit max capacity )
int lookAheadElementOffset = calcWrappedOffset ( index + lookAheadStep , mask ) ; if ( null == lvElement ( buffer , lookAheadElementOffset ) ) { // LoadLoad
producerLookAhead = index + lookAheadStep - 1 ; // joy , there ' s plenty of room
return writeToQueue ( buffer , e , index , offset ) ; } else if ( null == lvElement ( buffer , calcWrappedOffset ( index + 1 , mask ) ) ) { // buffer is not full
return writeToQueue ( buffer , e , index , offset ) ; } else { resize ( buffer , index , offset , e , mask ) ; // add a buffer and link old to new
return true ; } }


signature:
public class SpscLinkedArrayQueue { /** * { @ inheritDoc }
 * This implementation is correct for single consumer thread use only . */
@ Nullable @ SuppressWarnings ( "unchecked" ) @ Override public T poll ( ) { } }

implementation:
// local load of field to avoid repeated loads after volatile reads
final AtomicReferenceArray < Object > buffer = consumerBuffer ; final long index = lpConsumerIndex ( ) ; final int mask = consumerMask ; final int offset = calcWrappedOffset ( index , mask ) ; final Object e = lvElement ( buffer , offset ) ; // LoadLoad
boolean isNextBuffer = e == HAS_NEXT ; if ( null != e && ! isNextBuffer ) { soElement ( buffer , offset , null ) ; // StoreStore
soConsumerIndex ( index + 1 ) ; // this ensures correctness on 32bit platforms
return ( T ) e ; } else if ( isNextBuffer ) { return newBufferPoll ( lvNextBufferAndUnlink ( buffer , mask + 1 ) , index , mask ) ; } return null ;


signature:
public class SpscLinkedArrayQueue { /** * Offer two elements at the same time .
 * < p > Don ' t use the regular offer ( ) with this at all !
 * @ param first the first value , not null
 * @ param second the second value , not null
 * @ return true if the queue accepted the two new values */
@ Override public boolean offer ( T first , T second ) { } }

implementation:
final AtomicReferenceArray < Object > buffer = producerBuffer ; final long p = lvProducerIndex ( ) ; final int m = producerMask ; int pi = calcWrappedOffset ( p + 2 , m ) ; if ( null == lvElement ( buffer , pi ) ) { pi = calcWrappedOffset ( p , m ) ; soElement ( buffer , pi + 1 , second ) ; soElement ( buffer , pi , first ) ; soProducerIndex ( p + 2 ) ; } else { final int capacity = buffer . length ( ) ; final AtomicReferenceArray < Object > newBuffer = new AtomicReferenceArray < Object > ( capacity ) ; producerBuffer = newBuffer ; pi = calcWrappedOffset ( p , m ) ; soElement ( newBuffer , pi + 1 , second ) ; // StoreStore
soElement ( newBuffer , pi , first ) ; soNext ( buffer , newBuffer ) ; soElement ( buffer , pi , HAS_NEXT ) ; // new buffer is visible after element is
soProducerIndex ( p + 2 ) ; // this ensures correctness on 32bit platforms
} return true ;


signature:
public class SerialDisposable { /** * Returns the currently contained Disposable or null if this container is empty .
 * @ return the current Disposable , may be null */
@ Nullable public Disposable get ( ) { } }

implementation: Disposable d = resource . get ( ) ; if ( d == DisposableHelper . DISPOSED ) { return Disposables . disposed ( ) ; } return d ;


signature:
public class ObservablePublish { /** * Creates a OperatorPublish instance to publish values of the given source observable .
 * @ param < T > the source value type
 * @ param source the source observable
 * @ return the connectable observable */
public static < T > ConnectableObservable < T > create ( ObservableSource < T > source ) { } }

implementation:
// the current connection to source needs to be shared between the operator and its onSubscribe call
final AtomicReference < PublishObserver < T > > curr = new AtomicReference < PublishObserver < T > > ( ) ; ObservableSource < T > onSubscribe = new PublishSource < T > ( curr ) ; return RxJavaPlugins . onAssembly ( new ObservablePublish < T > ( onSubscribe , source , curr ) ) ;


signature:
public class DeferredScalarDisposable { /** * Complete the target with a single value or indicate there is a value available in
 * fusion mode .
 * @ param value the value to signal , not null ( not verified ) */
public final void complete ( T value ) { } }

implementation: int state = get ( ) ; if ( ( state & ( FUSED_READY | FUSED_CONSUMED | TERMINATED | DISPOSED ) ) != 0 ) { return ; } Observer < ? super T > a = downstream ; if ( state == FUSED_EMPTY ) { this . value = value ; lazySet ( FUSED_READY ) ; a . onNext ( null ) ; } else { lazySet ( TERMINATED ) ; a . onNext ( value ) ; } if ( get ( ) != DISPOSED ) { a . onComplete ( ) ; }


signature:
public class DeferredScalarDisposable { /** * Complete the target with an error signal .
 * @ param t the Throwable to signal , not null ( not verified ) */
public final void error ( Throwable t ) { } }

implementation: int state = get ( ) ; if ( ( state & ( FUSED_READY | FUSED_CONSUMED | TERMINATED | DISPOSED ) ) != 0 ) { RxJavaPlugins . onError ( t ) ; return ; } lazySet ( TERMINATED ) ; downstream . onError ( t ) ;


signature:
public class DeferredScalarDisposable { /** * Complete the target without any value . */
public final void complete ( ) { } }

implementation: int state = get ( ) ; if ( ( state & ( FUSED_READY | FUSED_CONSUMED | TERMINATED | DISPOSED ) ) != 0 ) { return ; } lazySet ( TERMINATED ) ; downstream . onComplete ( ) ;


signature:
public class Flowable { /** * Returns a Flowable that emits the items emitted by each of the Publishers emitted by the source
 * Publisher , one after the other , without interleaving them .
 * < img width = " 640 " height = " 380 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / concat . png " alt = " " >
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator honors backpressure from downstream . Both the outer and inner { @ code Publisher }
 * sources are expected to honor backpressure as well . If the outer violates this , a
 * { @ code MissingBackpressureException } is signaled . If any of the inner { @ code Publisher } s violates
 * this , it < em > may < / em > throw an { @ code IllegalStateException } when an inner { @ code Publisher } completes . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code concat } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param < T > the common element base type
 * @ param sources
 * a Publisher that emits Publishers
 * @ param prefetch
 * the number of Publishers to prefetch from the sources sequence .
 * @ return a Flowable that emits items all of the items emitted by the Publishers emitted by
 * { @ code Publishers } , one after the other , without interleaving them
 * @ see < a href = " http : / / reactivex . io / documentation / operators / concat . html " > ReactiveX operators documentation : Concat < / a > */
@ SuppressWarnings ( { } }

implementation: "unchecked" , "rawtypes" } ) @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > concat ( Publisher < ? extends Publisher < ? extends T > > sources , int prefetch ) { return fromPublisher ( sources ) . concatMap ( ( Function ) Functions . identity ( ) , prefetch ) ;


signature:
public class Flowable { /** * Concatenates a variable number of Publisher sources .
 * Note : named this way because of overload conflict with concat ( Publisher & lt ; Publisher & gt ; ) .
 * < img width = " 640 " height = " 380 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / concat . png " alt = " " >
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator honors backpressure from downstream . The { @ code Publisher }
 * sources are expected to honor backpressure as well .
 * If any of the source { @ code Publisher } s violate this , it < em > may < / em > throw an
 * { @ code IllegalStateException } when the source { @ code Publisher } completes . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code concatArray } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param sources the array of sources
 * @ param < T > the common base value type
 * @ return the new Publisher instance
 * @ throws NullPointerException if sources is null */
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > concatArray ( Publisher < ? extends T > ... sources ) { } }

implementation: if ( sources . length == 0 ) { return empty ( ) ; } else if ( sources . length == 1 ) { return fromPublisher ( sources [ 0 ] ) ; } return RxJavaPlugins . onAssembly ( new FlowableConcatArray < T > ( sources , false ) ) ;


signature:
public class Flowable { /** * Concatenates an array of Publishers eagerly into a single stream of values .
 * < img width = " 640 " height = " 406 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Flowable . concatArrayEager . nn . png " alt = " " >
 * Eager concatenation means that once a subscriber subscribes , this operator subscribes to all of the
 * source Publishers . The operator buffers the values emitted by these Publishers and then drains them
 * in order , each one after the previous one completes .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator honors backpressure from downstream . The { @ code Publisher }
 * sources are expected to honor backpressure as well .
 * If any of the source { @ code Publisher } s violate this , the operator will signal a
 * { @ code MissingBackpressureException } . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > This method does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param < T > the value type
 * @ param sources an array of Publishers that need to be eagerly concatenated
 * @ param maxConcurrency the maximum number of concurrent subscriptions at a time , Integer . MAX _ VALUE
 * is interpreted as an indication to subscribe to all sources at once
 * @ param prefetch the number of elements to prefetch from each Publisher source
 * @ return the new Publisher instance with the specified concatenation behavior
 * @ since 2.0 */
@ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) @ SuppressWarnings ( { } }

implementation: "rawtypes" , "unchecked" } ) public static < T > Flowable < T > concatArrayEager ( int maxConcurrency , int prefetch , Publisher < ? extends T > ... sources ) { ObjectHelper . requireNonNull ( sources , "sources is null" ) ; ObjectHelper . verifyPositive ( maxConcurrency , "maxConcurrency" ) ; ObjectHelper . verifyPositive ( prefetch , "prefetch" ) ; return RxJavaPlugins . onAssembly ( new FlowableConcatMapEager ( new FlowableFromArray ( sources ) , Functions . identity ( ) , maxConcurrency , prefetch , ErrorMode . IMMEDIATE ) ) ;


signature:
public class Flowable { /** * Concatenates an array of { @ link Publisher } s eagerly into a single stream of values
 * and delaying any errors until all sources terminate .
 * < img width = " 640 " height = " 359 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Flowable . concatArrayEagerDelayError . nn . png " alt = " " >
 * Eager concatenation means that once a subscriber subscribes , this operator subscribes to all of the
 * source { @ code Publisher } s . The operator buffers the values emitted by these { @ code Publisher } s
 * and then drains them in order , each one after the previous one completes .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator honors backpressure from downstream . The { @ code Publisher }
 * sources are expected to honor backpressure as well .
 * If any of the source { @ code Publisher } s violate this , the operator will signal a
 * { @ code MissingBackpressureException } . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > This method does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param < T > the value type
 * @ param sources an array of { @ code Publisher } s that need to be eagerly concatenated
 * @ param maxConcurrency the maximum number of concurrent subscriptions at a time , Integer . MAX _ VALUE
 * is interpreted as indication to subscribe to all sources at once
 * @ param prefetch the number of elements to prefetch from each { @ code Publisher } source
 * @ return the new Flowable instance with the specified concatenation behavior
 * @ since 2.2.1 - experimental */
@ SuppressWarnings ( { } }

implementation: "rawtypes" , "unchecked" } ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) @ BackpressureSupport ( BackpressureKind . FULL ) public static < T > Flowable < T > concatArrayEagerDelayError ( int maxConcurrency , int prefetch , Publisher < ? extends T > ... sources ) { return fromArray ( sources ) . concatMapEagerDelayError ( ( Function ) Functions . identity ( ) , maxConcurrency , prefetch , true ) ;


signature:
public class Flowable { /** * Concatenates the Publisher sequence of Publishers into a single sequence by subscribing to each inner Publisher ,
 * one after the other , one at a time and delays any errors till the all inner and the outer Publishers terminate .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > { @ code concatDelayError } fully supports backpressure . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code concatDelayError } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param < T > the common element base type
 * @ param sources the Publisher sequence of Publishers
 * @ return the new Publisher with the concatenating behavior */
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > concatDelayError ( Publisher < ? extends Publisher < ? extends T > > sources ) { } }

implementation: return concatDelayError ( sources , bufferSize ( ) , true ) ;


signature:
public class Flowable { /** * Concatenates the Publisher sequence of Publishers into a single sequence by subscribing to each inner Publisher ,
 * one after the other , one at a time and delays any errors till the all inner and the outer Publishers terminate .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > { @ code concatDelayError } fully supports backpressure . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code concatDelayError } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param < T > the common element base type
 * @ param sources the Publisher sequence of Publishers
 * @ param prefetch the number of elements to prefetch from the outer Publisher
 * @ param tillTheEnd if true exceptions from the outer and all inner Publishers are delayed to the end
 * if false , exception from the outer Publisher is delayed till the current Publisher terminates
 * @ return the new Publisher with the concatenating behavior */
@ SuppressWarnings ( { } }

implementation: "unchecked" , "rawtypes" } ) @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > concatDelayError ( Publisher < ? extends Publisher < ? extends T > > sources , int prefetch , boolean tillTheEnd ) { return fromPublisher ( sources ) . concatMapDelayError ( ( Function ) Functions . identity ( ) , prefetch , tillTheEnd ) ;


signature:
public class Flowable { /** * Provides an API ( via a cold Flowable ) that bridges the reactive world with the callback - style ,
 * generally non - backpressured world .
 * Example :
 * < pre > < code >
 * Flowable . & lt ; Event & gt ; create ( emitter - & gt ; {
 * Callback listener = new Callback ( ) {
 * & # 64 ; Override
 * public void onEvent ( Event e ) {
 * emitter . onNext ( e ) ;
 * if ( e . isLast ( ) ) {
 * emitter . onComplete ( ) ;
 * & # 64 ; Override
 * public void onFailure ( Exception e ) {
 * emitter . onError ( e ) ;
 * AutoCloseable c = api . someMethod ( listener ) ;
 * emitter . setCancellable ( c : : close ) ;
 * } , BackpressureStrategy . BUFFER ) ;
 * < / code > < / pre >
 * You should call the FlowableEmitter onNext , onError and onComplete methods in a serialized fashion . The
 * rest of its methods are thread - safe .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The backpressure behavior is determined by the { @ code mode } parameter . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code create } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param < T > the element type
 * @ param source the emitter that is called when a Subscriber subscribes to the returned { @ code Flowable }
 * @ param mode the backpressure mode to apply if the downstream Subscriber doesn ' t request ( fast ) enough
 * @ return the new Flowable instance
 * @ see FlowableOnSubscribe
 * @ see BackpressureStrategy
 * @ see Cancellable */
@ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . SPECIAL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > create ( FlowableOnSubscribe < T > source , BackpressureStrategy mode ) { } }

implementation: ObjectHelper . requireNonNull ( source , "source is null" ) ; ObjectHelper . requireNonNull ( mode , "mode is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableCreate < T > ( source , mode ) ) ;


signature:
public class Flowable { /** * Returns a Flowable that emits no items to the { @ link Subscriber } and immediately invokes its
 * { @ link Subscriber # onComplete onComplete } method .
 * < img width = " 640 " height = " 190 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / empty . png " alt = " " >
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > This source doesn ' t produce any elements and effectively ignores downstream backpressure . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code empty } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param < T >
 * the type of the items ( ostensibly ) emitted by the Publisher
 * @ return a Flowable that emits no items to the { @ link Subscriber } but immediately invokes the
 * { @ link Subscriber } ' s { @ link Subscriber # onComplete ( ) onComplete } method
 * @ see < a href = " http : / / reactivex . io / documentation / operators / empty - never - throw . html " > ReactiveX operators documentation : Empty < / a > */
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) @ SuppressWarnings ( "unchecked" ) public static < T > Flowable < T > empty ( ) { } }

implementation: return RxJavaPlugins . onAssembly ( ( Flowable < T > ) FlowableEmpty . INSTANCE ) ;


signature:
public class Flowable { /** * Returns a Flowable that invokes a { @ link Subscriber } ' s { @ link Subscriber # onError onError } method when the
 * Subscriber subscribes to it .
 * < img width = " 640 " height = " 190 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / error . png " alt = " " >
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > This source doesn ' t produce any elements and effectively ignores downstream backpressure . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code error } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param supplier
 * a Callable factory to return a Throwable for each individual Subscriber
 * @ param < T >
 * the type of the items ( ostensibly ) emitted by the Publisher
 * @ return a Flowable that invokes the { @ link Subscriber } ' s { @ link Subscriber # onError onError } method when
 * the Subscriber subscribes to it
 * @ see < a href = " http : / / reactivex . io / documentation / operators / empty - never - throw . html " > ReactiveX operators documentation : Throw < / a > */
@ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > error ( Callable < ? extends Throwable > supplier ) { } }

implementation: ObjectHelper . requireNonNull ( supplier , "supplier is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableError < T > ( supplier ) ) ;


signature:
public class Flowable { /** * Converts an { @ link Iterable } sequence into a Publisher that emits the items in the sequence .
 * < img width = " 640 " height = " 315 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / from . png " alt = " " >
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator honors backpressure from downstream and iterates the given { @ code iterable }
 * on demand ( i . e . , when requested ) . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code fromIterable } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param source
 * the source { @ link Iterable } sequence
 * @ param < T >
 * the type of items in the { @ link Iterable } sequence and the type of items to be emitted by the
 * resulting Publisher
 * @ return a Flowable that emits each item in the source { @ link Iterable } sequence
 * @ see < a href = " http : / / reactivex . io / documentation / operators / from . html " > ReactiveX operators documentation : From < / a > */
@ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > fromIterable ( Iterable < ? extends T > source ) { } }

implementation: ObjectHelper . requireNonNull ( source , "source is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableFromIterable < T > ( source ) ) ;


signature:
public class Flowable { /** * Returns a cold , synchronous , stateful and backpressure - aware generator of values .
 * Note that the { @ link Emitter # onNext } , { @ link Emitter # onError } and
 * { @ link Emitter # onComplete } methods provided to the function via the { @ link Emitter } instance should be called synchronously ,
 * never concurrently and only while the function body is executing . Calling them from multiple threads
 * or outside the function call is not supported and leads to an undefined behavior .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator honors downstream backpressure . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code generate } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param < S > the type of the per - Subscriber state
 * @ param < T > the generated value type
 * @ param initialState the Callable to generate the initial state for each Subscriber
 * @ param generator the Function called with the current state whenever a particular downstream Subscriber has
 * requested a value . The callback then should call { @ code onNext } , { @ code onError } or
 * { @ code onComplete } to signal a value or a terminal event and should return a ( new ) state for
 * the next invocation . Signaling multiple { @ code onNext }
 * in a call will make the operator signal { @ code IllegalStateException } .
 * @ return the new Flowable instance */
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T , S > Flowable < T > generate ( Callable < S > initialState , BiFunction < S , Emitter < T > , S > generator ) { } }

implementation: return generate ( initialState , generator , Functions . emptyConsumer ( ) ) ;


signature:
public class Flowable { /** * Returns a Flowable that emits a { @ code 0L } after the { @ code initialDelay } and ever - increasing numbers
 * after each { @ code period } of time thereafter , on a specified { @ link Scheduler } .
 * < img width = " 640 " height = " 200 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / timer . ps . png " alt = " " >
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator generates values based on time and ignores downstream backpressure which
 * may lead to { @ code MissingBackpressureException } at some point in the chain .
 * Consumers should consider applying one of the { @ code onBackpressureXXX } operators as well . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > You specify which { @ link Scheduler } this operator will use . < / dd >
 * < / dl >
 * @ param initialDelay
 * the initial delay time to wait before emitting the first value of 0L
 * @ param period
 * the period of time between emissions of the subsequent numbers
 * @ param unit
 * the time unit for both { @ code initialDelay } and { @ code period }
 * @ param scheduler
 * the Scheduler on which the waiting happens and items are emitted
 * @ return a Flowable that emits a 0L after the { @ code initialDelay } and ever - increasing numbers after
 * each { @ code period } of time thereafter , while running on the given Scheduler
 * @ see < a href = " http : / / reactivex . io / documentation / operators / interval . html " > ReactiveX operators documentation : Interval < / a >
 * @ since 1.0.12 */
@ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public static Flowable < Long > interval ( long initialDelay , long period , TimeUnit unit , Scheduler scheduler ) { } }

implementation: ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableInterval ( Math . max ( 0L , initialDelay ) , Math . max ( 0L , period ) , unit , scheduler ) ) ;


signature:
public class Flowable { /** * Returns a Flowable that emits a sequential number every specified interval of time .
 * < img width = " 640 " height = " 195 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / interval . png " alt = " " >
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator signals a { @ code MissingBackpressureException } if the downstream
 * is not ready to receive the next value . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code interval } operates by default on the { @ code computation } { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param period
 * the period size in time units ( see below )
 * @ param unit
 * time units to use for the interval size
 * @ return a Flowable that emits a sequential number each time interval
 * @ see < a href = " http : / / reactivex . io / documentation / operators / interval . html " > ReactiveX operators documentation : Interval < / a > */
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public static Flowable < Long > interval ( long period , TimeUnit unit ) { } }

implementation: return interval ( period , period , unit , Schedulers . computation ( ) ) ;


signature:
public class Flowable { /** * Returns a Flowable that emits a sequential number every specified interval of time , on a
 * specified Scheduler .
 * < img width = " 640 " height = " 200 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / interval . s . png " alt = " " >
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator generates values based on time and ignores downstream backpressure which
 * may lead to { @ code MissingBackpressureException } at some point in the chain .
 * Consumers should consider applying one of the { @ code onBackpressureXXX } operators as well . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > You specify which { @ link Scheduler } this operator will use . < / dd >
 * < / dl >
 * @ param period
 * the period size in time units ( see below )
 * @ param unit
 * time units to use for the interval size
 * @ param scheduler
 * the Scheduler to use for scheduling the items
 * @ return a Flowable that emits a sequential number each time interval
 * @ see < a href = " http : / / reactivex . io / documentation / operators / interval . html " > ReactiveX operators documentation : Interval < / a > */
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public static Flowable < Long > interval ( long period , TimeUnit unit , Scheduler scheduler ) { } }

implementation: return interval ( period , period , unit , scheduler ) ;


signature:
public class Flowable { /** * Signals a range of long values , the first after some initial delay and the rest periodically after .
 * The sequence completes immediately after the last value ( start + count - 1 ) has been reached .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator signals a { @ code MissingBackpressureException } if the downstream can ' t keep up . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code intervalRange } by default operates on the { @ link Schedulers # computation ( ) computation } { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param start that start value of the range
 * @ param count the number of values to emit in total , if zero , the operator emits an onComplete after the initial delay .
 * @ param initialDelay the initial delay before signaling the first value ( the start )
 * @ param period the period between subsequent values
 * @ param unit the unit of measure of the initialDelay and period amounts
 * @ return the new Flowable instance */
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public static Flowable < Long > intervalRange ( long start , long count , long initialDelay , long period , TimeUnit unit ) { } }

implementation: return intervalRange ( start , count , initialDelay , period , unit , Schedulers . computation ( ) ) ;


signature:
public class Flowable { /** * Signals a range of long values , the first after some initial delay and the rest periodically after .
 * The sequence completes immediately after the last value ( start + count - 1 ) has been reached .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator signals a { @ code MissingBackpressureException } if the downstream can ' t keep up . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > you provide the { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param start that start value of the range
 * @ param count the number of values to emit in total , if zero , the operator emits an onComplete after the initial delay .
 * @ param initialDelay the initial delay before signaling the first value ( the start )
 * @ param period the period between subsequent values
 * @ param unit the unit of measure of the initialDelay and period amounts
 * @ param scheduler the target scheduler where the values and terminal signals will be emitted
 * @ return the new Flowable instance */
@ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public static Flowable < Long > intervalRange ( long start , long count , long initialDelay , long period , TimeUnit unit , Scheduler scheduler ) { } }

implementation: if ( count < 0L ) { throw new IllegalArgumentException ( "count >= 0 required but it was " + count ) ; } if ( count == 0L ) { return Flowable . < Long > empty ( ) . delay ( initialDelay , unit , scheduler ) ; } long end = start + ( count - 1 ) ; if ( start > 0 && end < 0 ) { throw new IllegalArgumentException ( "Overflow! start + count is bigger than Long.MAX_VALUE" ) ; } ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableIntervalRange ( start , end , Math . max ( 0L , initialDelay ) , Math . max ( 0L , period ) , unit , scheduler ) ) ;


signature:
public class Flowable { /** * Returns a Flowable that signals the given ( constant reference ) item and then completes .
 * < img width = " 640 " height = " 310 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / just . png " alt = " " >
 * Note that the item is taken and re - emitted as is and not computed by any means by { @ code just } . Use { @ link # fromCallable ( Callable ) }
 * to generate a single item on demand ( when { @ code Subscriber } s subscribe to it ) .
 * See the multi - parameter overloads of { @ code just } to emit more than one ( constant reference ) items one after the other .
 * Use { @ link # fromArray ( Object . . . ) } to emit an arbitrary number of items that are known upfront .
 * To emit the items of an { @ link Iterable } sequence ( such as a { @ link java . util . List } ) , use { @ link # fromIterable ( Iterable ) } .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator honors backpressure from downstream . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code just } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param item
 * the item to emit
 * @ param < T >
 * the type of that item
 * @ return a Flowable that emits { @ code value } as a single item and then completes
 * @ see < a href = " http : / / reactivex . io / documentation / operators / just . html " > ReactiveX operators documentation : Just < / a >
 * @ see # just ( Object , Object )
 * @ see # fromCallable ( Callable )
 * @ see # fromArray ( Object . . . )
 * @ see # fromIterable ( Iterable ) */
@ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > just ( T item ) { } }

implementation: ObjectHelper . requireNonNull ( item , "item is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableJust < T > ( item ) ) ;


signature:
public class Flowable { /** * Flattens an Iterable of Publishers into one Publisher , without any transformation , while limiting the
 * number of concurrent subscriptions to these Publishers .
 * < img width = " 640 " height = " 380 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / merge . png " alt = " " >
 * You can combine the items emitted by multiple Publishers so that they appear as a single Publisher , by
 * using the { @ code merge } method .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator honors backpressure from downstream . The source { @ code Publisher } s are expected to honor
 * backpressure ; if violated , the operator < em > may < / em > signal { @ code MissingBackpressureException } . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code mergeArray } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < dt > < b > Error handling : < / b > < / dt >
 * < dd > If any of the source { @ code Publisher } s signal a { @ code Throwable } via { @ code onError } , the resulting
 * { @ code Flowable } terminates with that { @ code Throwable } and all other source { @ code Publisher } s are canceled .
 * If more than one { @ code Publisher } signals an error , the resulting { @ code Flowable } may terminate with the
 * first one ' s error or , depending on the concurrency of the sources , may terminate with a
 * { @ code CompositeException } containing two or more of the various error signals .
 * { @ code Throwable } s that didn ' t make into the composite will be sent ( individually ) to the global error handler via
 * { @ link RxJavaPlugins # onError ( Throwable ) } method as { @ code UndeliverableException } errors . Similarly , { @ code Throwable } s
 * signaled by source ( s ) after the returned { @ code Flowable } has been canceled or terminated with a
 * ( composite ) error will be sent to the same global error handler .
 * Use { @ link # mergeArrayDelayError ( int , int , Publisher [ ] ) } to merge sources and terminate only when all source { @ code Publisher } s
 * have completed or failed with an error .
 * < / dd >
 * < / dl >
 * @ param < T > the common element base type
 * @ param sources
 * the array of Publishers
 * @ param maxConcurrency
 * the maximum number of Publishers that may be subscribed to concurrently
 * @ param bufferSize
 * the number of items to prefetch from each inner Publisher
 * @ return a Flowable that emits items that are the result of flattening the items emitted by the
 * Publishers in the Iterable
 * @ throws IllegalArgumentException
 * if { @ code maxConcurrency } is less than or equal to 0
 * @ see < a href = " http : / / reactivex . io / documentation / operators / merge . html " > ReactiveX operators documentation : Merge < / a >
 * @ see # mergeArrayDelayError ( int , int , Publisher . . . ) */
@ SuppressWarnings ( { } }

implementation: "unchecked" , "rawtypes" } ) @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > mergeArray ( int maxConcurrency , int bufferSize , Publisher < ? extends T > ... sources ) { return fromArray ( sources ) . flatMap ( ( Function ) Functions . identity ( ) , false , maxConcurrency , bufferSize ) ;


signature:
public class Flowable { /** * Flattens four Publishers into a single Publisher , without any transformation .
 * < img width = " 640 " height = " 380 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / merge . png " alt = " " >
 * You can combine items emitted by multiple Publishers so that they appear as a single Publisher , by
 * using the { @ code merge } method .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator honors backpressure from downstream . The source { @ code Publisher } s are expected to honor
 * backpressure ; if violated , the operator < em > may < / em > signal { @ code MissingBackpressureException } . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code merge } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < dt > < b > Error handling : < / b > < / dt >
 * < dd > If any of the source { @ code Publisher } s signal a { @ code Throwable } via { @ code onError } , the resulting
 * { @ code Flowable } terminates with that { @ code Throwable } and all other source { @ code Publisher } s are canceled .
 * If more than one { @ code Publisher } signals an error , the resulting { @ code Flowable } may terminate with the
 * first one ' s error or , depending on the concurrency of the sources , may terminate with a
 * { @ code CompositeException } containing two or more of the various error signals .
 * { @ code Throwable } s that didn ' t make into the composite will be sent ( individually ) to the global error handler via
 * { @ link RxJavaPlugins # onError ( Throwable ) } method as { @ code UndeliverableException } errors . Similarly , { @ code Throwable } s
 * signaled by source ( s ) after the returned { @ code Flowable } has been canceled or terminated with a
 * ( composite ) error will be sent to the same global error handler .
 * Use { @ link # mergeDelayError ( Publisher , Publisher , Publisher , Publisher ) } to merge sources and terminate only when all source { @ code Publisher } s
 * have completed or failed with an error .
 * < / dd >
 * < / dl >
 * @ param < T > the common element base type
 * @ param source1
 * a Publisher to be merged
 * @ param source2
 * a Publisher to be merged
 * @ param source3
 * a Publisher to be merged
 * @ param source4
 * a Publisher to be merged
 * @ return a Flowable that emits all of the items emitted by the source Publishers
 * @ see < a href = " http : / / reactivex . io / documentation / operators / merge . html " > ReactiveX operators documentation : Merge < / a >
 * @ see # mergeDelayError ( Publisher , Publisher , Publisher , Publisher ) */
@ SuppressWarnings ( { } }

implementation: "unchecked" , "rawtypes" } ) @ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > merge ( Publisher < ? extends T > source1 , Publisher < ? extends T > source2 , Publisher < ? extends T > source3 , Publisher < ? extends T > source4 ) { ObjectHelper . requireNonNull ( source1 , "source1 is null" ) ; ObjectHelper . requireNonNull ( source2 , "source2 is null" ) ; ObjectHelper . requireNonNull ( source3 , "source3 is null" ) ; ObjectHelper . requireNonNull ( source4 , "source4 is null" ) ; return fromArray ( source1 , source2 , source3 , source4 ) . flatMap ( ( Function ) Functions . identity ( ) , false , 4 ) ;


signature:
public class Flowable { /** * Flattens an Iterable of Publishers into one Publisher , in a way that allows a Subscriber to receive all
 * successfully emitted items from each of the source Publishers without being interrupted by an error
 * notification from one of them .
 * This behaves like { @ link # merge ( Publisher ) } except that if any of the merged Publishers notify of an
 * error via { @ link Subscriber # onError onError } , { @ code mergeDelayError } will refrain from propagating that
 * error notification until all of the merged Publishers have finished emitting items .
 * < img width = " 640 " height = " 380 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / mergeDelayError . png " alt = " " >
 * Even if multiple merged Publishers send { @ code onError } notifications , { @ code mergeDelayError } will only
 * invoke the { @ code onError } method of its Subscribers once .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator honors backpressure from downstream . All inner { @ code Publisher } s are expected to honor
 * backpressure ; if violated , the operator < em > may < / em > signal { @ code MissingBackpressureException } . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code mergeDelayError } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param < T > the common element base type
 * @ param sources
 * the Iterable of Publishers
 * @ return a Flowable that emits items that are the result of flattening the items emitted by the
 * Publishers in the Iterable
 * @ see < a href = " http : / / reactivex . io / documentation / operators / merge . html " > ReactiveX operators documentation : Merge < / a > */
@ SuppressWarnings ( { } }

implementation: "unchecked" , "rawtypes" } ) @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > mergeDelayError ( Iterable < ? extends Publisher < ? extends T > > sources ) { return fromIterable ( sources ) . flatMap ( ( Function ) Functions . identity ( ) , true ) ;


signature:
public class Flowable { /** * Returns a Flowable that never sends any items or notifications to a { @ link Subscriber } .
 * < img width = " 640 " height = " 185 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / never . png " alt = " " >
 * This Publisher is useful primarily for testing purposes .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > This source doesn ' t produce any elements and effectively ignores downstream backpressure . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code never } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param < T >
 * the type of items ( not ) emitted by the Publisher
 * @ return a Flowable that never emits any items or sends any notifications to a { @ link Subscriber }
 * @ see < a href = " http : / / reactivex . io / documentation / operators / empty - never - throw . html " > ReactiveX operators documentation : Never < / a > */
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . PASS_THROUGH ) @ SchedulerSupport ( SchedulerSupport . NONE ) @ SuppressWarnings ( "unchecked" ) public static < T > Flowable < T > never ( ) { } }

implementation: return RxJavaPlugins . onAssembly ( ( Flowable < T > ) FlowableNever . INSTANCE ) ;


signature:
public class Flowable { /** * Returns a Flowable that emits a sequence of Integers within a specified range .
 * < img width = " 640 " height = " 195 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / range . png " alt = " " >
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator honors backpressure from downstream and signals values on - demand ( i . e . , when requested ) . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code range } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param start
 * the value of the first Integer in the sequence
 * @ param count
 * the number of sequential Integers to generate
 * @ return a Flowable that emits a range of sequential Integers
 * @ throws IllegalArgumentException
 * if { @ code count } is less than zero , or if { @ code start } + { @ code count } & minus ; 1 exceeds
 * { @ code Integer . MAX _ VALUE }
 * @ see < a href = " http : / / reactivex . io / documentation / operators / range . html " > ReactiveX operators documentation : Range < / a > */
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static Flowable < Integer > range ( int start , int count ) { } }

implementation: if ( count < 0 ) { throw new IllegalArgumentException ( "count >= 0 required but it was " + count ) ; } else if ( count == 0 ) { return empty ( ) ; } else if ( count == 1 ) { return just ( start ) ; } else if ( ( long ) start + ( count - 1 ) > Integer . MAX_VALUE ) { throw new IllegalArgumentException ( "Integer overflow" ) ; } return RxJavaPlugins . onAssembly ( new FlowableRange ( start , count ) ) ;


signature:
public class Flowable { /** * Returns a Flowable that emits a sequence of Longs within a specified range .
 * < img width = " 640 " height = " 195 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / range . png " alt = " " >
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator honors backpressure from downstream and signals values on - demand ( i . e . , when requested ) . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code rangeLong } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param start
 * the value of the first Long in the sequence
 * @ param count
 * the number of sequential Longs to generate
 * @ return a Flowable that emits a range of sequential Longs
 * @ throws IllegalArgumentException
 * if { @ code count } is less than zero , or if { @ code start } + { @ code count } & minus ; 1 exceeds
 * { @ code Long . MAX _ VALUE }
 * @ see < a href = " http : / / reactivex . io / documentation / operators / range . html " > ReactiveX operators documentation : Range < / a > */
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static Flowable < Long > rangeLong ( long start , long count ) { } }

implementation: if ( count < 0 ) { throw new IllegalArgumentException ( "count >= 0 required but it was " + count ) ; } if ( count == 0 ) { return empty ( ) ; } if ( count == 1 ) { return just ( start ) ; } long end = start + ( count - 1 ) ; if ( start > 0 && end < 0 ) { throw new IllegalArgumentException ( "Overflow! start + count is bigger than Long.MAX_VALUE" ) ; } return RxJavaPlugins . onAssembly ( new FlowableRangeLong ( start , count ) ) ;


signature:
public class Flowable { /** * Returns a Single that emits a Boolean value that indicates whether two Publisher sequences are the
 * same by comparing the items emitted by each Publisher pairwise based on the results of a specified
 * equality function .
 * < img width = " 640 " height = " 385 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / sequenceEqual . png " alt = " " >
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator honors backpressure from downstream . The source { @ code Publisher } s are expected to honor
 * backpressure ; if violated , the operator signals a { @ code MissingBackpressureException } . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code sequenceEqual } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param source1
 * the first Publisher to compare
 * @ param source2
 * the second Publisher to compare
 * @ param isEqual
 * a function used to compare items emitted by each Publisher
 * @ param < T >
 * the type of items emitted by each Publisher
 * @ return a Single that emits a Boolean value that indicates whether the two Publisher sequences
 * are the same according to the specified function
 * @ see < a href = " http : / / reactivex . io / documentation / operators / sequenceequal . html " > ReactiveX operators documentation : SequenceEqual < / a > */
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Single < Boolean > sequenceEqual ( Publisher < ? extends T > source1 , Publisher < ? extends T > source2 , BiPredicate < ? super T , ? super T > isEqual ) { } }

implementation: return sequenceEqual ( source1 , source2 , isEqual , bufferSize ( ) ) ;


signature:
public class Flowable { /** * Returns a Single that emits a Boolean value that indicates whether two Publisher sequences are the
 * same by comparing the items emitted by each Publisher pairwise based on the results of a specified
 * equality function .
 * < img width = " 640 " height = " 385 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / sequenceEqual . png " alt = " " >
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator honors backpressure from downstream . The source { @ code Publisher } s are expected to honor
 * backpressure ; if violated , the operator signals a { @ code MissingBackpressureException } . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code sequenceEqual } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param source1
 * the first Publisher to compare
 * @ param source2
 * the second Publisher to compare
 * @ param isEqual
 * a function used to compare items emitted by each Publisher
 * @ param bufferSize
 * the number of items to prefetch from the first and second source Publisher
 * @ param < T >
 * the type of items emitted by each Publisher
 * @ return a Single that emits a Boolean value that indicates whether the two Publisher sequences
 * are the same according to the specified function
 * @ see < a href = " http : / / reactivex . io / documentation / operators / sequenceequal . html " > ReactiveX operators documentation : SequenceEqual < / a > */
@ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Single < Boolean > sequenceEqual ( Publisher < ? extends T > source1 , Publisher < ? extends T > source2 , BiPredicate < ? super T , ? super T > isEqual , int bufferSize ) { } }

implementation: ObjectHelper . requireNonNull ( source1 , "source1 is null" ) ; ObjectHelper . requireNonNull ( source2 , "source2 is null" ) ; ObjectHelper . requireNonNull ( isEqual , "isEqual is null" ) ; ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return RxJavaPlugins . onAssembly ( new FlowableSequenceEqualSingle < T > ( source1 , source2 , isEqual , bufferSize ) ) ;


signature:
public class Flowable { /** * Returns a Single that emits a Boolean value that indicates whether two Publisher sequences are the
 * same by comparing the items emitted by each Publisher pairwise .
 * < img width = " 640 " height = " 385 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / sequenceEqual . png " alt = " " >
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > This operator honors downstream backpressure and expects both of its sources
 * to honor backpressure as well . If violated , the operator will emit a MissingBackpressureException . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code sequenceEqual } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param source1
 * the first Publisher to compare
 * @ param source2
 * the second Publisher to compare
 * @ param bufferSize
 * the number of items to prefetch from the first and second source Publisher
 * @ param < T >
 * the type of items emitted by each Publisher
 * @ return a Single that emits a Boolean value that indicates whether the two sequences are the same
 * @ see < a href = " http : / / reactivex . io / documentation / operators / sequenceequal . html " > ReactiveX operators documentation : SequenceEqual < / a > */
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Single < Boolean > sequenceEqual ( Publisher < ? extends T > source1 , Publisher < ? extends T > source2 , int bufferSize ) { } }

implementation: return sequenceEqual ( source1 , source2 , ObjectHelper . equalsPredicate ( ) , bufferSize ) ;


signature:
public class Flowable { /** * Converts a Publisher that emits Publishers into a Publisher that emits the items emitted by the
 * most recently emitted of those Publishers .
 * < img width = " 640 " height = " 370 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / switchDo . png " alt = " " >
 * { @ code switchOnNext } subscribes to a Publisher that emits Publishers . Each time it observes one of
 * these emitted Publishers , the Publisher returned by { @ code switchOnNext } begins emitting the items
 * emitted by that Publisher . When a new Publisher is emitted , { @ code switchOnNext } stops emitting items
 * from the earlier - emitted Publisher and begins emitting items from the new one .
 * The resulting Publisher completes if both the outer Publisher and the last inner Publisher , if any , complete .
 * If the outer Publisher signals an onError , the inner Publisher is canceled and the error delivered in - sequence .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator honors backpressure from downstream . The outer { @ code Publisher } is consumed in an
 * unbounded manner ( i . e . , without backpressure ) and the inner { @ code Publisher } s are expected to honor
 * backpressure but it is not enforced ; the operator won ' t signal a { @ code MissingBackpressureException }
 * but the violation < em > may < / em > lead to { @ code OutOfMemoryError } due to internal buffer bloat . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code switchOnNext } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param < T > the item type
 * @ param sources
 * the source Publisher that emits Publishers
 * @ param bufferSize
 * the number of items to prefetch from the inner Publishers
 * @ return a Flowable that emits the items emitted by the Publisher most recently emitted by the source
 * Publisher
 * @ see < a href = " http : / / reactivex . io / documentation / operators / switch . html " > ReactiveX operators documentation : Switch < / a > */
@ SuppressWarnings ( { } }

implementation: "unchecked" , "rawtypes" } ) @ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > switchOnNext ( Publisher < ? extends Publisher < ? extends T > > sources , int bufferSize ) { return fromPublisher ( sources ) . switchMap ( ( Function ) Functions . identity ( ) , bufferSize ) ;


signature:
public class Flowable { /** * Converts a Publisher that emits Publishers into a Publisher that emits the items emitted by the
 * most recently emitted of those Publishers and delays any exception until all Publishers terminate .
 * < img width = " 640 " height = " 370 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / switchDo . png " alt = " " >
 * { @ code switchOnNext } subscribes to a Publisher that emits Publishers . Each time it observes one of
 * these emitted Publishers , the Publisher returned by { @ code switchOnNext } begins emitting the items
 * emitted by that Publisher . When a new Publisher is emitted , { @ code switchOnNext } stops emitting items
 * from the earlier - emitted Publisher and begins emitting items from the new one .
 * The resulting Publisher completes if both the main Publisher and the last inner Publisher , if any , complete .
 * If the main Publisher signals an onError , the termination of the last inner Publisher will emit that error as is
 * or wrapped into a CompositeException along with the other possible errors the former inner Publishers signaled .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > The operator honors backpressure from downstream . The outer { @ code Publisher } is consumed in an
 * unbounded manner ( i . e . , without backpressure ) and the inner { @ code Publisher } s are expected to honor
 * backpressure but it is not enforced ; the operator won ' t signal a { @ code MissingBackpressureException }
 * but the violation < em > may < / em > lead to { @ code OutOfMemoryError } due to internal buffer bloat . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code switchOnNextDelayError } does not operate by default on a particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param < T > the item type
 * @ param sources
 * the source Publisher that emits Publishers
 * @ param prefetch
 * the number of items to prefetch from the inner Publishers
 * @ return a Flowable that emits the items emitted by the Publisher most recently emitted by the source
 * Publisher
 * @ see < a href = " http : / / reactivex . io / documentation / operators / switch . html " > ReactiveX operators documentation : Switch < / a >
 * @ since 2.0 */
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > switchOnNextDelayError ( Publisher < ? extends Publisher < ? extends T > > sources , int prefetch ) { } }

implementation: return fromPublisher ( sources ) . switchMapDelayError ( Functions . < Publisher < ? extends T > > identity ( ) , prefetch ) ;


signature:
public class Flowable { /** * Returns a Flowable that emits { @ code 0L } after a specified delay , and then completes .
 * < img width = " 640 " height = " 200 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / timer . png " alt = " " >
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > This operator does not support backpressure as it uses time . If the downstream needs a slower rate
 * it should slow the timer or use something like { @ link # onBackpressureDrop } . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code timer } operates by default on the { @ code computation } { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param delay
 * the initial delay before emitting a single { @ code 0L }
 * @ param unit
 * time units to use for { @ code delay }
 * @ return a Flowable that emits { @ code 0L } after a specified delay , and then completes
 * @ see < a href = " http : / / reactivex . io / documentation / operators / timer . html " > ReactiveX operators documentation : Timer < / a > */
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public static Flowable < Long > timer ( long delay , TimeUnit unit ) { } }

implementation: return timer ( delay , unit , Schedulers . computation ( ) ) ;


signature:
public class Flowable { /** * Create a Flowable by wrapping a Publisher < em > which has to be implemented according
 * to the Reactive - Streams specification by handling backpressure and
 * cancellation correctly ; no safeguards are provided by the Flowable itself < / em > .
 * < dl >
 * < dt > < b > Backpressure : < / b > < / dt >
 * < dd > This operator is a pass - through for backpressure and the behavior is determined by the
 * provided Publisher implementation . < / dd >
 * < dt > < b > Scheduler : < / b > < / dt >
 * < dd > { @ code unsafeCreate } by default doesn ' t operate on any particular { @ link Scheduler } . < / dd >
 * < / dl >
 * @ param < T > the value type emitted
 * @ param onSubscribe the Publisher instance to wrap
 * @ return the new Flowable instance
 * @ throws IllegalArgumentException if { @ code onSubscribe } is a subclass of { @ code Flowable } ; such
 * instances don ' t need conversion and is possibly a port remnant from 1 . x or one should use { @ link # hide ( ) }
 * instead . */
@ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . NONE ) @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > unsafeCreate ( Publisher < T > onSubscribe ) { } }

implementation: ObjectHelper . requireNonNull ( onSubscribe , "onSubscribe is null" ) ; if ( onSubscribe instanceof Flowable ) { throw new IllegalArgumentException ( "unsafeCreate(Flowable) should be upgraded" ) ; } return RxJavaPlugins . onAssembly ( new FlowableFromPublisher < T > ( onSubscribe ) ) ;