Input: Sorts the rails according to the comparator and returns a full sorted list as a Publisher . <p > This operator requires a finite source ParallelFlowable . [CODESPLIT] @ CheckReturnValue @ NonNull public final Flowable < List < T > > toSortedList ( @ NonNull Comparator < ? super T > comparator , int capacityHint ) { ObjectHelper . requireNonNull ( comparator , "comparator is null" ) ; ObjectHelper . verifyPositive ( capacityHint , "capacityHint" ) ; int ch = capacityHint / parallelism ( ) + 1 ; ParallelFlowable < List < T > > railReduced = reduce ( Functions . < T > createArrayList ( ch ) , ListAddBiConsumer . < T > instance ( ) ) ; ParallelFlowable < List < T > > railSorted = railReduced . map ( new SorterFunction < T > ( comparator ) ) ; Flowable < List < T > > merged = railSorted . reduce ( new MergerBiFunction < T > ( comparator ) ) ; return RxJavaPlugins . onAssembly ( merged ) ; }


Input: Call the specified consumer with the current element passing through any rail . [CODESPLIT] @ CheckReturnValue @ NonNull public final ParallelFlowable < T > doOnNext ( @ NonNull Consumer < ? super T > onNext ) { ObjectHelper . requireNonNull ( onNext , "onNext is null" ) ; return RxJavaPlugins . onAssembly ( new ParallelPeek < T > ( this , onNext , Functions . emptyConsumer ( ) , Functions . emptyConsumer ( ) , Functions . EMPTY_ACTION , Functions . EMPTY_ACTION , Functions . emptyConsumer ( ) , Functions . EMPTY_LONG_CONSUMER , Functions . EMPTY_ACTION ) ) ; }


Input: Call the specified consumer with the current element passing through any rail and handles errors based on the given { [CODESPLIT] @ CheckReturnValue @ NonNull public final ParallelFlowable < T > doOnNext ( @ NonNull Consumer < ? super T > onNext , @ NonNull ParallelFailureHandling errorHandler ) { ObjectHelper . requireNonNull ( onNext , "onNext is null" ) ; ObjectHelper . requireNonNull ( errorHandler , "errorHandler is null" ) ; return RxJavaPlugins . onAssembly ( new ParallelDoOnNextTry < T > ( this , onNext , errorHandler ) ) ; }


Input: Call the specified consumer with the current element passing through any rail after it has been delivered to downstream within the rail . [CODESPLIT] @ CheckReturnValue @ NonNull public final ParallelFlowable < T > doAfterNext ( @ NonNull Consumer < ? super T > onAfterNext ) { ObjectHelper . requireNonNull ( onAfterNext , "onAfterNext is null" ) ; return RxJavaPlugins . onAssembly ( new ParallelPeek < T > ( this , Functions . emptyConsumer ( ) , onAfterNext , Functions . emptyConsumer ( ) , Functions . EMPTY_ACTION , Functions . EMPTY_ACTION , Functions . emptyConsumer ( ) , Functions . EMPTY_LONG_CONSUMER , Functions . EMPTY_ACTION ) ) ; }


Input: Call the specified consumer with the exception passing through any rail . [CODESPLIT] @ CheckReturnValue @ NonNull public final ParallelFlowable < T > doOnError ( @ NonNull Consumer < Throwable > onError ) { ObjectHelper . requireNonNull ( onError , "onError is null" ) ; return RxJavaPlugins . onAssembly ( new ParallelPeek < T > ( this , Functions . emptyConsumer ( ) , Functions . emptyConsumer ( ) , onError , Functions . EMPTY_ACTION , Functions . EMPTY_ACTION , Functions . emptyConsumer ( ) , Functions . EMPTY_LONG_CONSUMER , Functions . EMPTY_ACTION ) ) ; }


Input: Run the specified Action when a rail completes . [CODESPLIT] @ CheckReturnValue @ NonNull public final ParallelFlowable < T > doOnComplete ( @ NonNull Action onComplete ) { ObjectHelper . requireNonNull ( onComplete , "onComplete is null" ) ; return RxJavaPlugins . onAssembly ( new ParallelPeek < T > ( this , Functions . emptyConsumer ( ) , Functions . emptyConsumer ( ) , Functions . emptyConsumer ( ) , onComplete , Functions . EMPTY_ACTION , Functions . emptyConsumer ( ) , Functions . EMPTY_LONG_CONSUMER , Functions . EMPTY_ACTION ) ) ; }


Input: Run the specified Action when a rail completes or signals an error . [CODESPLIT] @ CheckReturnValue @ NonNull public final ParallelFlowable < T > doAfterTerminated ( @ NonNull Action onAfterTerminate ) { ObjectHelper . requireNonNull ( onAfterTerminate , "onAfterTerminate is null" ) ; return RxJavaPlugins . onAssembly ( new ParallelPeek < T > ( this , Functions . emptyConsumer ( ) , Functions . emptyConsumer ( ) , Functions . emptyConsumer ( ) , Functions . EMPTY_ACTION , onAfterTerminate , Functions . emptyConsumer ( ) , Functions . EMPTY_LONG_CONSUMER , Functions . EMPTY_ACTION ) ) ; }


Input: Call the specified callback when a rail receives a Subscription from its upstream . [CODESPLIT] @ CheckReturnValue @ NonNull public final ParallelFlowable < T > doOnSubscribe ( @ NonNull Consumer < ? super Subscription > onSubscribe ) { ObjectHelper . requireNonNull ( onSubscribe , "onSubscribe is null" ) ; return RxJavaPlugins . onAssembly ( new ParallelPeek < T > ( this , Functions . emptyConsumer ( ) , Functions . emptyConsumer ( ) , Functions . emptyConsumer ( ) , Functions . EMPTY_ACTION , Functions . EMPTY_ACTION , onSubscribe , Functions . EMPTY_LONG_CONSUMER , Functions . EMPTY_ACTION ) ) ; }


Input: Call the specified consumer with the request amount if any rail receives a request . [CODESPLIT] @ CheckReturnValue @ NonNull public final ParallelFlowable < T > doOnRequest ( @ NonNull LongConsumer onRequest ) { ObjectHelper . requireNonNull ( onRequest , "onRequest is null" ) ; return RxJavaPlugins . onAssembly ( new ParallelPeek < T > ( this , Functions . emptyConsumer ( ) , Functions . emptyConsumer ( ) , Functions . emptyConsumer ( ) , Functions . EMPTY_ACTION , Functions . EMPTY_ACTION , Functions . emptyConsumer ( ) , onRequest , Functions . EMPTY_ACTION ) ) ; }


Input: Run the specified Action when a rail receives a cancellation . [CODESPLIT] @ CheckReturnValue @ NonNull public final ParallelFlowable < T > doOnCancel ( @ NonNull Action onCancel ) { ObjectHelper . requireNonNull ( onCancel , "onCancel is null" ) ; return RxJavaPlugins . onAssembly ( new ParallelPeek < T > ( this , Functions . emptyConsumer ( ) , Functions . emptyConsumer ( ) , Functions . emptyConsumer ( ) , Functions . EMPTY_ACTION , Functions . EMPTY_ACTION , Functions . emptyConsumer ( ) , Functions . EMPTY_LONG_CONSUMER , onCancel ) ) ; }


Input: Collect the elements in each rail into a collection supplied via a collectionSupplier and collected into with a collector action emitting the collection at the end . [CODESPLIT] @ CheckReturnValue @ NonNull public final < C > ParallelFlowable < C > collect ( @ NonNull Callable < ? extends C > collectionSupplier , @ NonNull BiConsumer < ? super C , ? super T > collector ) { ObjectHelper . requireNonNull ( collectionSupplier , "collectionSupplier is null" ) ; ObjectHelper . requireNonNull ( collector , "collector is null" ) ; return RxJavaPlugins . onAssembly ( new ParallelCollect < T , C > ( this , collectionSupplier , collector ) ) ; }


Input: Wraps multiple Publishers into a ParallelFlowable which runs them in parallel and unordered . [CODESPLIT] @ CheckReturnValue @ NonNull public static < T > ParallelFlowable < T > fromArray ( @ NonNull Publisher < T > ... publishers ) { if ( publishers . length == 0 ) { throw new IllegalArgumentException ( "Zero publishers not supported" ) ; } return RxJavaPlugins . onAssembly ( new ParallelFromArray < T > ( publishers ) ) ; }


Input: Perform a fluent transformation to a value via a converter function which receives this ParallelFlowable . [CODESPLIT] @ CheckReturnValue @ NonNull public final < U > U to ( @ NonNull Function < ? super ParallelFlowable < T > , U > converter ) { try { return ObjectHelper . requireNonNull ( converter , "converter is null" ) . apply ( this ) ; } catch ( Throwable ex ) { Exceptions . throwIfFatal ( ex ) ; throw ExceptionHelper . wrapOrThrow ( ex ) ; } }


Input: Allows composing operators in assembly time on top of this ParallelFlowable and returns another ParallelFlowable with composed features . [CODESPLIT] @ CheckReturnValue @ NonNull public final < U > ParallelFlowable < U > compose ( @ NonNull ParallelTransformer < T , U > composer ) { return RxJavaPlugins . onAssembly ( ObjectHelper . requireNonNull ( composer , "composer is null" ) . apply ( this ) ) ; }


Input: Generates and flattens Publishers on each rail optionally delaying errors . <p > It uses unbounded concurrency along with default inner prefetch . [CODESPLIT] @ CheckReturnValue @ NonNull public final < R > ParallelFlowable < R > flatMap ( @ NonNull Function < ? super T , ? extends Publisher < ? extends R > > mapper , boolean delayError ) { return flatMap ( mapper , delayError , Integer . MAX_VALUE , Flowable . bufferSize ( ) ) ; }


Input: Generates and flattens Publishers on each rail optionally delaying errors having a total number of simultaneous subscriptions to the inner Publishers and using the given prefetch amount for the inner Publishers . [CODESPLIT] @ CheckReturnValue @ NonNull public final < R > ParallelFlowable < R > flatMap ( @ NonNull Function < ? super T , ? extends Publisher < ? extends R > > mapper , boolean delayError , int maxConcurrency , int prefetch ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; ObjectHelper . verifyPositive ( maxConcurrency , "maxConcurrency" ) ; ObjectHelper . verifyPositive ( prefetch , "prefetch" ) ; return RxJavaPlugins . onAssembly ( new ParallelFlatMap < T , R > ( this , mapper , delayError , maxConcurrency , prefetch ) ) ; }


Input: Generates and concatenates Publishers on each rail signalling errors immediately and generating 2 publishers upfront . [CODESPLIT] @ CheckReturnValue @ NonNull public final < R > ParallelFlowable < R > concatMap ( @ NonNull Function < ? super T , ? extends Publisher < ? extends R > > mapper ) { return concatMap ( mapper , 2 ) ; }


Input: Generates and concatenates Publishers on each rail signalling errors immediately and using the given prefetch amount for generating Publishers upfront . [CODESPLIT] @ CheckReturnValue @ NonNull public final < R > ParallelFlowable < R > concatMap ( @ NonNull Function < ? super T , ? extends Publisher < ? extends R > > mapper , int prefetch ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; ObjectHelper . verifyPositive ( prefetch , "prefetch" ) ; return RxJavaPlugins . onAssembly ( new ParallelConcatMap < T , R > ( this , mapper , prefetch , ErrorMode . IMMEDIATE ) ) ; }


Input: Generates and concatenates Publishers on each rail optionally delaying errors and generating 2 publishers upfront . [CODESPLIT] @ CheckReturnValue @ NonNull public final < R > ParallelFlowable < R > concatMapDelayError ( @ NonNull Function < ? super T , ? extends Publisher < ? extends R > > mapper , boolean tillTheEnd ) { return concatMapDelayError ( mapper , 2 , tillTheEnd ) ; }


Input: Generates and concatenates Publishers on each rail optionally delaying errors and using the given prefetch amount for generating Publishers upfront . [CODESPLIT] @ CheckReturnValue @ NonNull public final < R > ParallelFlowable < R > concatMapDelayError ( @ NonNull Function < ? super T , ? extends Publisher < ? extends R > > mapper , int prefetch , boolean tillTheEnd ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; ObjectHelper . verifyPositive ( prefetch , "prefetch" ) ; return RxJavaPlugins . onAssembly ( new ParallelConcatMap < T , R > ( this , mapper , prefetch , tillTheEnd ? ErrorMode . END : ErrorMode . BOUNDARY ) ) ; }


Input: Given a connectable observable factory it multicasts over the generated ConnectableObservable via a selector function . [CODESPLIT] public static < U , R > Observable < R > multicastSelector ( final Callable < ? extends ConnectableObservable < U > > connectableFactory , final Function < ? super Observable < U > , ? extends ObservableSource < R > > selector ) { return RxJavaPlugins . onAssembly ( new MulticastReplay < R , U > ( connectableFactory , selector ) ) ; }


Input: Child Observers will observe the events of the ConnectableObservable on the specified scheduler . [CODESPLIT] public static < T > ConnectableObservable < T > observeOn ( final ConnectableObservable < T > co , final Scheduler scheduler ) { final Observable < T > observable = co . observeOn ( scheduler ) ; return RxJavaPlugins . onAssembly ( new Replay < T > ( co , observable ) ) ; }


Input: Creates a replaying ConnectableObservable with an unbounded buffer . [CODESPLIT] @ SuppressWarnings ( "unchecked" ) public static < T > ConnectableObservable < T > createFrom ( ObservableSource < ? extends T > source ) { return create ( source , DEFAULT_UNBOUNDED_FACTORY ) ; }


Input: Creates a replaying ConnectableObservable with a size bound buffer . [CODESPLIT] public static < T > ConnectableObservable < T > create ( ObservableSource < T > source , final int bufferSize ) { if ( bufferSize == Integer . MAX_VALUE ) { return createFrom ( source ) ; } return create ( source , new ReplayBufferSupplier < T > ( bufferSize ) ) ; }


Input: Creates a replaying ConnectableObservable with a time bound buffer . [CODESPLIT] public static < T > ConnectableObservable < T > create ( ObservableSource < T > source , long maxAge , TimeUnit unit , Scheduler scheduler ) { return create ( source , maxAge , unit , scheduler , Integer . MAX_VALUE ) ; }


Input: Creates a replaying ConnectableObservable with a size and time bound buffer . [CODESPLIT] public static < T > ConnectableObservable < T > create ( ObservableSource < T > source , final long maxAge , final TimeUnit unit , final Scheduler scheduler , final int bufferSize ) { return create ( source , new ScheduledReplaySupplier < T > ( bufferSize , maxAge , unit , scheduler ) ) ; }


Input: Creates a OperatorReplay instance to replay values of the given source observable . [CODESPLIT] static < T > ConnectableObservable < T > create ( ObservableSource < T > source , final BufferSupplier < T > bufferFactory ) { // the current connection to source needs to be shared between the operator and its onSubscribe call final AtomicReference < ReplayObserver < T > > curr = new AtomicReference < ReplayObserver < T > > ( ) ; ObservableSource < T > onSubscribe = new ReplaySource < T > ( curr , bufferFactory ) ; return RxJavaPlugins . onAssembly ( new ObservableReplay < T > ( onSubscribe , source , curr , bufferFactory ) ) ; }


Input: Sets the resource at the specified index and disposes the old resource . [CODESPLIT] public boolean setResource ( int index , Subscription resource ) { for ( ; ; ) { Subscription o = get ( index ) ; if ( o == SubscriptionHelper . CANCELLED ) { if ( resource != null ) { resource . cancel ( ) ; } return false ; } if ( compareAndSet ( index , o , resource ) ) { if ( o != null ) { o . cancel ( ) ; } return true ; } } }


Input: Replaces the resource at the specified index and returns the old resource . [CODESPLIT] public Subscription replaceResource ( int index , Subscription resource ) { for ( ; ; ) { Subscription o = get ( index ) ; if ( o == SubscriptionHelper . CANCELLED ) { if ( resource != null ) { resource . cancel ( ) ; } return null ; } if ( compareAndSet ( index , o , resource ) ) { return o ; } } }


Input: Creates an UnicastProcessor with the given internal buffer capacity hint . [CODESPLIT] @ CheckReturnValue @ NonNull public static < T > UnicastProcessor < T > create ( int capacityHint ) { return new UnicastProcessor < T > ( capacityHint ) ; }


Input: Creates an UnicastProcessor with default internal buffer capacity hint and delay error flag . <p > History : 2 . 0 . 8 - experimental [CODESPLIT] @ CheckReturnValue @ NonNull public static < T > UnicastProcessor < T > create ( boolean delayError ) { return new UnicastProcessor < T > ( bufferSize ( ) , null , delayError ) ; }


Input: Creates an UnicastProcessor with the given internal buffer capacity hint and a callback for the case when the single Subscriber cancels its subscription . [CODESPLIT] @ CheckReturnValue @ NonNull public static < T > UnicastProcessor < T > create ( int capacityHint , Runnable onCancelled ) { ObjectHelper . requireNonNull ( onCancelled , "onTerminate" ) ; return new UnicastProcessor < T > ( capacityHint , onCancelled ) ; }


Input: Tries to subscribe to a possibly Callable source s mapped Publisher . [CODESPLIT] @ SuppressWarnings ( "unchecked" ) public static < T , R > boolean tryScalarXMapSubscribe ( Publisher < T > source , Subscriber < ? super R > subscriber , Function < ? super T , ? extends Publisher < ? extends R > > mapper ) { if ( source instanceof Callable ) { T t ; try { t = ( ( Callable < T > ) source ) . call ( ) ; } catch ( Throwable ex ) { Exceptions . throwIfFatal ( ex ) ; EmptySubscription . error ( ex , subscriber ) ; return true ; } if ( t == null ) { EmptySubscription . complete ( subscriber ) ; return true ; } Publisher < ? extends R > r ; try { r = ObjectHelper . requireNonNull ( mapper . apply ( t ) , "The mapper returned a null Publisher" ) ; } catch ( Throwable ex ) { Exceptions . throwIfFatal ( ex ) ; EmptySubscription . error ( ex , subscriber ) ; return true ; } if ( r instanceof Callable ) { R u ; try { u = ( ( Callable < R > ) r ) . call ( ) ; } catch ( Throwable ex ) { Exceptions . throwIfFatal ( ex ) ; EmptySubscription . error ( ex , subscriber ) ; return true ; } if ( u == null ) { EmptySubscription . complete ( subscriber ) ; return true ; } subscriber . onSubscribe ( new ScalarSubscription < R > ( subscriber , u ) ) ; } else { r . subscribe ( subscriber ) ; } return true ; } return false ; }


Input: Maps a scalar value into a Publisher and emits its values . [CODESPLIT] public static < T , U > Flowable < U > scalarXMap ( final T value , final Function < ? super T , ? extends Publisher < ? extends U > > mapper ) { return RxJavaPlugins . onAssembly ( new ScalarXMapFlowable < T , U > ( value , mapper ) ) ; }


Input: Construct a Disposable by wrapping a Runnable that is executed exactly once when the Disposable is disposed . [CODESPLIT] @ NonNull public static Disposable fromRunnable ( @ NonNull Runnable run ) { ObjectHelper . requireNonNull ( run , "run is null" ) ; return new RunnableDisposable ( run ) ; }


Input: Construct a Disposable by wrapping a Action that is executed exactly once when the Disposable is disposed . [CODESPLIT] @ NonNull public static Disposable fromAction ( @ NonNull Action run ) { ObjectHelper . requireNonNull ( run , "run is null" ) ; return new ActionDisposable ( run ) ; }


Input: Construct a Disposable by wrapping a Future that is cancelled exactly once when the Disposable is disposed . [CODESPLIT] @ NonNull public static Disposable fromFuture ( @ NonNull Future < ? > future ) { ObjectHelper . requireNonNull ( future , "future is null" ) ; return fromFuture ( future , true ) ; }


Input: Construct a Disposable by wrapping a Future that is cancelled exactly once when the Disposable is disposed . [CODESPLIT] @ NonNull public static Disposable fromFuture ( @ NonNull Future < ? > future , boolean allowInterrupt ) { ObjectHelper . requireNonNull ( future , "future is null" ) ; return new FutureDisposable ( future , allowInterrupt ) ; }


Input: Construct a Disposable by wrapping a Subscription that is cancelled exactly once when the Disposable is disposed . [CODESPLIT] @ NonNull public static Disposable fromSubscription ( @ NonNull Subscription subscription ) { ObjectHelper . requireNonNull ( subscription , "subscription is null" ) ; return new SubscriptionDisposable ( subscription ) ; }


Input: Block until the first value arrives and return it otherwise return null for an empty source and rethrow any exception . [CODESPLIT] public final T blockingGet ( ) { if ( getCount ( ) != 0 ) { try { BlockingHelper . verifyNonBlocking ( ) ; await ( ) ; } catch ( InterruptedException ex ) { dispose ( ) ; throw ExceptionHelper . wrapOrThrow ( ex ) ; } } Throwable e = error ; if ( e != null ) { throw ExceptionHelper . wrapOrThrow ( e ) ; } return value ; }


Input: Calls the associated hook function . [CODESPLIT] @ NonNull public static Scheduler initComputationScheduler ( @ NonNull Callable < Scheduler > defaultScheduler ) { ObjectHelper . requireNonNull ( defaultScheduler , "Scheduler Callable can't be null" ) ; Function < ? super Callable < Scheduler > , ? extends Scheduler > f = onInitComputationHandler ; if ( f == null ) { return callRequireNonNull ( defaultScheduler ) ; } return applyRequireNonNull ( f , defaultScheduler ) ; // JIT will skip this }


Input: Calls the associated hook function . [CODESPLIT] @ NonNull public static Scheduler initIoScheduler ( @ NonNull Callable < Scheduler > defaultScheduler ) { ObjectHelper . requireNonNull ( defaultScheduler , "Scheduler Callable can't be null" ) ; Function < ? super Callable < Scheduler > , ? extends Scheduler > f = onInitIoHandler ; if ( f == null ) { return callRequireNonNull ( defaultScheduler ) ; } return applyRequireNonNull ( f , defaultScheduler ) ; }


Input: Calls the associated hook function . [CODESPLIT] @ NonNull public static Scheduler initNewThreadScheduler ( @ NonNull Callable < Scheduler > defaultScheduler ) { ObjectHelper . requireNonNull ( defaultScheduler , "Scheduler Callable can't be null" ) ; Function < ? super Callable < Scheduler > , ? extends Scheduler > f = onInitNewThreadHandler ; if ( f == null ) { return callRequireNonNull ( defaultScheduler ) ; } return applyRequireNonNull ( f , defaultScheduler ) ; }


Input: Calls the associated hook function . [CODESPLIT] @ NonNull public static Scheduler initSingleScheduler ( @ NonNull Callable < Scheduler > defaultScheduler ) { ObjectHelper . requireNonNull ( defaultScheduler , "Scheduler Callable can't be null" ) ; Function < ? super Callable < Scheduler > , ? extends Scheduler > f = onInitSingleHandler ; if ( f == null ) { return callRequireNonNull ( defaultScheduler ) ; } return applyRequireNonNull ( f , defaultScheduler ) ; }


Input: Calls the associated hook function . [CODESPLIT] @ NonNull public static Scheduler onComputationScheduler ( @ NonNull Scheduler defaultScheduler ) { Function < ? super Scheduler , ? extends Scheduler > f = onComputationHandler ; if ( f == null ) { return defaultScheduler ; } return apply ( f , defaultScheduler ) ; }


Input: Called when an undeliverable error occurs . <p > Undeliverable errors are those { @code Observer . onError () } invocations that are not allowed to happen on the given consumer type ( { @code Observer } { @code Subscriber } etc . ) due to protocol restrictions because the consumer has either disposed / cancelled its { @code Disposable } / { @code Subscription } or has already terminated with an { @code onError () } or { @code onComplete () } signal . <p > By default this global error handler prints the stacktrace via { @link Throwable#printStackTrace () } and calls { @link java . lang . Thread . UncaughtExceptionHandler#uncaughtException ( Thread Throwable ) } on the current thread . <p > Note that on some platforms the platform runtime terminates the current application with an error if such uncaught exceptions happen . In this case it is recommended the application installs a global error handler via the { @link #setErrorHandler ( Consumer ) } plugin method . [CODESPLIT] public static void onError ( @ NonNull Throwable error ) { Consumer < ? super Throwable > f = errorHandler ; if ( error == null ) { error = new NullPointerException ( "onError called with null. Null values are generally not allowed in 2.x operators and sources." ) ; } else { if ( ! isBug ( error ) ) { error = new UndeliverableException ( error ) ; } } if ( f != null ) { try { f . accept ( error ) ; return ; } catch ( Throwable e ) { // Exceptions.throwIfFatal(e); TODO decide e . printStackTrace ( ) ; // NOPMD uncaught ( e ) ; } } error . printStackTrace ( ) ; // NOPMD uncaught ( error ) ; }


Input: Calls the associated hook function . [CODESPLIT] @ NonNull public static Scheduler onIoScheduler ( @ NonNull Scheduler defaultScheduler ) { Function < ? super Scheduler , ? extends Scheduler > f = onIoHandler ; if ( f == null ) { return defaultScheduler ; } return apply ( f , defaultScheduler ) ; }


Input: Calls the associated hook function . [CODESPLIT] @ NonNull public static Scheduler onNewThreadScheduler ( @ NonNull Scheduler defaultScheduler ) { Function < ? super Scheduler , ? extends Scheduler > f = onNewThreadHandler ; if ( f == null ) { return defaultScheduler ; } return apply ( f , defaultScheduler ) ; }


Input: Called when a task is scheduled . [CODESPLIT] @ NonNull public static Runnable onSchedule ( @ NonNull Runnable run ) { ObjectHelper . requireNonNull ( run , "run is null" ) ; Function < ? super Runnable , ? extends Runnable > f = onScheduleHandler ; if ( f == null ) { return run ; } return apply ( f , run ) ; }


Input: Calls the associated hook function . [CODESPLIT] @ NonNull public static Scheduler onSingleScheduler ( @ NonNull Scheduler defaultScheduler ) { Function < ? super Scheduler , ? extends Scheduler > f = onSingleHandler ; if ( f == null ) { return defaultScheduler ; } return apply ( f , defaultScheduler ) ; }


Input: Removes all handlers and resets to default behavior . [CODESPLIT] public static void reset ( ) { setErrorHandler ( null ) ; setScheduleHandler ( null ) ; setComputationSchedulerHandler ( null ) ; setInitComputationSchedulerHandler ( null ) ; setIoSchedulerHandler ( null ) ; setInitIoSchedulerHandler ( null ) ; setSingleSchedulerHandler ( null ) ; setInitSingleSchedulerHandler ( null ) ; setNewThreadSchedulerHandler ( null ) ; setInitNewThreadSchedulerHandler ( null ) ; setOnFlowableAssembly ( null ) ; setOnFlowableSubscribe ( null ) ; setOnObservableAssembly ( null ) ; setOnObservableSubscribe ( null ) ; setOnSingleAssembly ( null ) ; setOnSingleSubscribe ( null ) ; setOnCompletableAssembly ( null ) ; setOnCompletableSubscribe ( null ) ; setOnConnectableFlowableAssembly ( null ) ; setOnConnectableObservableAssembly ( null ) ; setOnMaybeAssembly ( null ) ; setOnMaybeSubscribe ( null ) ; setOnParallelAssembly ( null ) ; setFailOnNonBlockingScheduler ( false ) ; setOnBeforeBlocking ( null ) ; }


Input: Sets the specific hook function . [CODESPLIT] public static void setComputationSchedulerHandler ( @ Nullable Function < ? super Scheduler , ? extends Scheduler > handler ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } onComputationHandler = handler ; }


Input: Sets the specific hook function . [CODESPLIT] public static void setInitComputationSchedulerHandler ( @ Nullable Function < ? super Callable < Scheduler > , ? extends Scheduler > handler ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } onInitComputationHandler = handler ; }


Input: Sets the specific hook function . [CODESPLIT] public static void setInitIoSchedulerHandler ( @ Nullable Function < ? super Callable < Scheduler > , ? extends Scheduler > handler ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } onInitIoHandler = handler ; }


Input: Sets the specific hook function . [CODESPLIT] public static void setInitNewThreadSchedulerHandler ( @ Nullable Function < ? super Callable < Scheduler > , ? extends Scheduler > handler ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } onInitNewThreadHandler = handler ; }


Input: Sets the specific hook function . [CODESPLIT] public static void setInitSingleSchedulerHandler ( @ Nullable Function < ? super Callable < Scheduler > , ? extends Scheduler > handler ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } onInitSingleHandler = handler ; }


Input: Sets the specific hook function . [CODESPLIT] public static void setIoSchedulerHandler ( @ Nullable Function < ? super Scheduler , ? extends Scheduler > handler ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } onIoHandler = handler ; }


Input: Sets the specific hook function . [CODESPLIT] public static void setNewThreadSchedulerHandler ( @ Nullable Function < ? super Scheduler , ? extends Scheduler > handler ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } onNewThreadHandler = handler ; }


Input: Sets the specific hook function . [CODESPLIT] public static void setScheduleHandler ( @ Nullable Function < ? super Runnable , ? extends Runnable > handler ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } onScheduleHandler = handler ; }


Input: Sets the specific hook function . [CODESPLIT] public static void setSingleSchedulerHandler ( @ Nullable Function < ? super Scheduler , ? extends Scheduler > handler ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } onSingleHandler = handler ; }


Input: Sets the specific hook function . [CODESPLIT] public static void setOnCompletableAssembly ( @ Nullable Function < ? super Completable , ? extends Completable > onCompletableAssembly ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } RxJavaPlugins . onCompletableAssembly = onCompletableAssembly ; }


Input: Sets the specific hook function . [CODESPLIT] public static void setOnCompletableSubscribe ( @ Nullable BiFunction < ? super Completable , ? super CompletableObserver , ? extends CompletableObserver > onCompletableSubscribe ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } RxJavaPlugins . onCompletableSubscribe = onCompletableSubscribe ; }


Input: Sets the specific hook function . [CODESPLIT] @ SuppressWarnings ( "rawtypes" ) public static void setOnFlowableAssembly ( @ Nullable Function < ? super Flowable , ? extends Flowable > onFlowableAssembly ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } RxJavaPlugins . onFlowableAssembly = onFlowableAssembly ; }


Input: Sets the specific hook function . [CODESPLIT] @ SuppressWarnings ( "rawtypes" ) public static void setOnMaybeAssembly ( @ Nullable Function < ? super Maybe , ? extends Maybe > onMaybeAssembly ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } RxJavaPlugins . onMaybeAssembly = onMaybeAssembly ; }


Input: Sets the specific hook function . [CODESPLIT] @ SuppressWarnings ( "rawtypes" ) public static void setOnConnectableFlowableAssembly ( @ Nullable Function < ? super ConnectableFlowable , ? extends ConnectableFlowable > onConnectableFlowableAssembly ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } RxJavaPlugins . onConnectableFlowableAssembly = onConnectableFlowableAssembly ; }


Input: Sets the specific hook function . [CODESPLIT] @ SuppressWarnings ( "rawtypes" ) public static void setOnFlowableSubscribe ( @ Nullable BiFunction < ? super Flowable , ? super Subscriber , ? extends Subscriber > onFlowableSubscribe ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } RxJavaPlugins . onFlowableSubscribe = onFlowableSubscribe ; }


Input: Sets the specific hook function . [CODESPLIT] @ SuppressWarnings ( "rawtypes" ) public static void setOnMaybeSubscribe ( @ Nullable BiFunction < ? super Maybe , MaybeObserver , ? extends MaybeObserver > onMaybeSubscribe ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } RxJavaPlugins . onMaybeSubscribe = onMaybeSubscribe ; }


Input: Sets the specific hook function . [CODESPLIT] @ SuppressWarnings ( "rawtypes" ) public static void setOnObservableAssembly ( @ Nullable Function < ? super Observable , ? extends Observable > onObservableAssembly ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } RxJavaPlugins . onObservableAssembly = onObservableAssembly ; }


Input: Sets the specific hook function . [CODESPLIT] @ SuppressWarnings ( "rawtypes" ) public static void setOnConnectableObservableAssembly ( @ Nullable Function < ? super ConnectableObservable , ? extends ConnectableObservable > onConnectableObservableAssembly ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } RxJavaPlugins . onConnectableObservableAssembly = onConnectableObservableAssembly ; }


Input: Sets the specific hook function . [CODESPLIT] @ SuppressWarnings ( "rawtypes" ) public static void setOnObservableSubscribe ( @ Nullable BiFunction < ? super Observable , ? super Observer , ? extends Observer > onObservableSubscribe ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } RxJavaPlugins . onObservableSubscribe = onObservableSubscribe ; }


Input: Sets the specific hook function . [CODESPLIT] @ SuppressWarnings ( "rawtypes" ) public static void setOnSingleAssembly ( @ Nullable Function < ? super Single , ? extends Single > onSingleAssembly ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } RxJavaPlugins . onSingleAssembly = onSingleAssembly ; }


Input: Sets the specific hook function . [CODESPLIT] @ SuppressWarnings ( "rawtypes" ) public static void setOnSingleSubscribe ( @ Nullable BiFunction < ? super Single , ? super SingleObserver , ? extends SingleObserver > onSingleSubscribe ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } RxJavaPlugins . onSingleSubscribe = onSingleSubscribe ; }


Input: Calls the associated hook function . [CODESPLIT] @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ NonNull public static < T > Subscriber < ? super T > onSubscribe ( @ NonNull Flowable < T > source , @ NonNull Subscriber < ? super T > subscriber ) { BiFunction < ? super Flowable , ? super Subscriber , ? extends Subscriber > f = onFlowableSubscribe ; if ( f != null ) { return apply ( f , source , subscriber ) ; } return subscriber ; }


Input: Calls the associated hook function . [CODESPLIT] @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ NonNull public static < T > Observer < ? super T > onSubscribe ( @ NonNull Observable < T > source , @ NonNull Observer < ? super T > observer ) { BiFunction < ? super Observable , ? super Observer , ? extends Observer > f = onObservableSubscribe ; if ( f != null ) { return apply ( f , source , observer ) ; } return observer ; }


Input: Calls the associated hook function . [CODESPLIT] @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ NonNull public static < T > SingleObserver < ? super T > onSubscribe ( @ NonNull Single < T > source , @ NonNull SingleObserver < ? super T > observer ) { BiFunction < ? super Single , ? super SingleObserver , ? extends SingleObserver > f = onSingleSubscribe ; if ( f != null ) { return apply ( f , source , observer ) ; } return observer ; }


Input: Calls the associated hook function . [CODESPLIT] @ NonNull public static CompletableObserver onSubscribe ( @ NonNull Completable source , @ NonNull CompletableObserver observer ) { BiFunction < ? super Completable , ? super CompletableObserver , ? extends CompletableObserver > f = onCompletableSubscribe ; if ( f != null ) { return apply ( f , source , observer ) ; } return observer ; }


Input: Calls the associated hook function . [CODESPLIT] @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ NonNull public static < T > MaybeObserver < ? super T > onSubscribe ( @ NonNull Maybe < T > source , @ NonNull MaybeObserver < ? super T > observer ) { BiFunction < ? super Maybe , ? super MaybeObserver , ? extends MaybeObserver > f = onMaybeSubscribe ; if ( f != null ) { return apply ( f , source , observer ) ; } return observer ; }


Input: Calls the associated hook function . [CODESPLIT] @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ NonNull public static < T > Maybe < T > onAssembly ( @ NonNull Maybe < T > source ) { Function < ? super Maybe , ? extends Maybe > f = onMaybeAssembly ; if ( f != null ) { return apply ( f , source ) ; } return source ; }


Input: Calls the associated hook function . [CODESPLIT] @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ NonNull public static < T > Flowable < T > onAssembly ( @ NonNull Flowable < T > source ) { Function < ? super Flowable , ? extends Flowable > f = onFlowableAssembly ; if ( f != null ) { return apply ( f , source ) ; } return source ; }


Input: Calls the associated hook function . [CODESPLIT] @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ NonNull public static < T > ConnectableFlowable < T > onAssembly ( @ NonNull ConnectableFlowable < T > source ) { Function < ? super ConnectableFlowable , ? extends ConnectableFlowable > f = onConnectableFlowableAssembly ; if ( f != null ) { return apply ( f , source ) ; } return source ; }


Input: Calls the associated hook function . [CODESPLIT] @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ NonNull public static < T > Observable < T > onAssembly ( @ NonNull Observable < T > source ) { Function < ? super Observable , ? extends Observable > f = onObservableAssembly ; if ( f != null ) { return apply ( f , source ) ; } return source ; }


Input: Calls the associated hook function . [CODESPLIT] @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ NonNull public static < T > ConnectableObservable < T > onAssembly ( @ NonNull ConnectableObservable < T > source ) { Function < ? super ConnectableObservable , ? extends ConnectableObservable > f = onConnectableObservableAssembly ; if ( f != null ) { return apply ( f , source ) ; } return source ; }


Input: Calls the associated hook function . [CODESPLIT] @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ NonNull public static < T > Single < T > onAssembly ( @ NonNull Single < T > source ) { Function < ? super Single , ? extends Single > f = onSingleAssembly ; if ( f != null ) { return apply ( f , source ) ; } return source ; }


Input: Calls the associated hook function . [CODESPLIT] @ NonNull public static Completable onAssembly ( @ NonNull Completable source ) { Function < ? super Completable , ? extends Completable > f = onCompletableAssembly ; if ( f != null ) { return apply ( f , source ) ; } return source ; }


Input: Sets the specific hook function . <p > History : 2 . 0 . 6 - experimental ; 2 . 1 - beta [CODESPLIT] @ SuppressWarnings ( "rawtypes" ) public static void setOnParallelAssembly ( @ Nullable Function < ? super ParallelFlowable , ? extends ParallelFlowable > handler ) { if ( lockdown ) { throw new IllegalStateException ( "Plugins can't be changed anymore" ) ; } onParallelAssembly = handler ; }


Input: Calls the associated hook function . <p > History : 2 . 0 . 6 - experimental ; 2 . 1 - beta [CODESPLIT] @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ NonNull public static < T > ParallelFlowable < T > onAssembly ( @ NonNull ParallelFlowable < T > source ) { Function < ? super ParallelFlowable , ? extends ParallelFlowable > f = onParallelAssembly ; if ( f != null ) { return apply ( f , source ) ; } return source ; }


Input: Called before an operator attempts a blocking operation such as awaiting a condition or signal and should return true to indicate the operator should not block but throw an IllegalArgumentException . <p > History : 2 . 0 . 5 - experimental [CODESPLIT] public static boolean onBeforeBlocking ( ) { BooleanSupplier f = onBeforeBlocking ; if ( f != null ) { try { return f . getAsBoolean ( ) ; } catch ( Throwable ex ) { throw ExceptionHelper . wrapOrThrow ( ex ) ; } } return false ; }


Input: Create an instance of the default { [CODESPLIT] @ NonNull public static Scheduler createComputationScheduler ( @ NonNull ThreadFactory threadFactory ) { return new ComputationScheduler ( ObjectHelper . requireNonNull ( threadFactory , "threadFactory is null" ) ) ; }


Input: Wraps the call to the function in try - catch and propagates thrown checked exceptions as RuntimeException . [CODESPLIT] @ NonNull static < T , R > R apply ( @ NonNull Function < T , R > f , @ NonNull T t ) { try { return f . apply ( t ) ; } catch ( Throwable ex ) { throw ExceptionHelper . wrapOrThrow ( ex ) ; } }


Input: Wraps the call to the function in try - catch and propagates thrown checked exceptions as RuntimeException . [CODESPLIT] @ NonNull static < T , U , R > R apply ( @ NonNull BiFunction < T , U , R > f , @ NonNull T t , @ NonNull U u ) { try { return f . apply ( t , u ) ; } catch ( Throwable ex ) { throw ExceptionHelper . wrapOrThrow ( ex ) ; } }


Input: Wraps the call to the Scheduler creation callable in try - catch and propagates thrown checked exceptions as RuntimeException and enforces that result is not null . [CODESPLIT] @ NonNull static Scheduler callRequireNonNull ( @ NonNull Callable < Scheduler > s ) { try { return ObjectHelper . requireNonNull ( s . call ( ) , "Scheduler Callable result can't be null" ) ; } catch ( Throwable ex ) { throw ExceptionHelper . wrapOrThrow ( ex ) ; } }


Input: Wraps the call to the Scheduler creation function in try - catch and propagates thrown checked exceptions as RuntimeException and enforces that result is not null . [CODESPLIT] @ NonNull static Scheduler applyRequireNonNull ( @ NonNull Function < ? super Callable < Scheduler > , ? extends Scheduler > f , Callable < Scheduler > s ) { return ObjectHelper . requireNonNull ( apply ( f , s ) , "Scheduler Callable result can't be null" ) ; }


Input: Runs multiple MaybeSources and signals the events of the first one that signals ( disposing the rest ) . <p > <img width = 640 height = 519 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Maybe . amb . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Maybe < T > amb ( final Iterable < ? extends MaybeSource < ? extends T > > sources ) { ObjectHelper . requireNonNull ( sources , "sources is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeAmb < T > ( null , sources ) ) ; }


Input: Runs multiple MaybeSources and signals the events of the first one that signals ( disposing the rest ) . <p > <img width = 640 height = 519 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Maybe . ambArray . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) @ SuppressWarnings ( "unchecked" ) public static < T > Maybe < T > ambArray ( final MaybeSource < ? extends T > ... sources ) { if ( sources . length == 0 ) { return empty ( ) ; } if ( sources . length == 1 ) { return wrap ( ( MaybeSource < T > ) sources [ 0 ] ) ; } return RxJavaPlugins . onAssembly ( new MaybeAmb < T > ( sources , null ) ) ; }


Input: Concatenate the single values in a non - overlapping fashion of the MaybeSource sources provided by a Publisher sequence . <p > <img width = 640 height = 416 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Maybe . concat . p . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The returned { [CODESPLIT] @ BackpressureSupport ( BackpressureKind . FULL ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > concat ( Publisher < ? extends MaybeSource < ? extends T > > sources ) { return concat ( sources , 2 ) ; }


Input: Concatenates a variable number of MaybeSource sources and delays errors from any of them till all terminate . <p > <img width = 640 height = 425 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Maybe . concatArrayDelayError . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ SuppressWarnings ( "unchecked" ) @ BackpressureSupport ( BackpressureKind . FULL ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > concatArrayDelayError ( MaybeSource < ? extends T > ... sources ) { if ( sources . length == 0 ) { return Flowable . empty ( ) ; } else if ( sources . length == 1 ) { return RxJavaPlugins . onAssembly ( new MaybeToFlowable < T > ( ( MaybeSource < T > ) sources [ 0 ] ) ) ; } return RxJavaPlugins . onAssembly ( new MaybeConcatArrayDelayError < T > ( sources ) ) ; }


Input: Concatenates a sequence of MaybeSource eagerly into a single stream of values . <p > Eager concatenation means that once a subscriber subscribes this operator subscribes to all of the source MaybeSources . The operator buffers the value emitted by these MaybeSources and then drains them in order each one after the previous one completes . <p > <img width = 640 height = 489 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Maybe . concatArrayEager . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This method does not operate by default on a particular { [CODESPLIT] @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ BackpressureSupport ( BackpressureKind . FULL ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > concatArrayEager ( MaybeSource < ? extends T > ... sources ) { return Flowable . fromArray ( sources ) . concatMapEager ( ( Function ) MaybeToPublisher . instance ( ) ) ; }


Input: Concatenates a sequence of MaybeSources eagerly into a single stream of values . <p > Eager concatenation means that once a subscriber subscribes this operator subscribes to all of the source MaybeSources . The operator buffers the values emitted by these MaybeSources and then drains them in order each one after the previous one completes . <p > <img width = 640 height = 526 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Maybe . concatEager . i . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > Backpressure is honored towards the downstream . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This method does not operate by default on a particular { [CODESPLIT] @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ BackpressureSupport ( BackpressureKind . FULL ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > concatEager ( Iterable < ? extends MaybeSource < ? extends T > > sources ) { return Flowable . fromIterable ( sources ) . concatMapEager ( ( Function ) MaybeToPublisher . instance ( ) ) ; }


Input: Provides an API ( via a cold Maybe ) that bridges the reactive world with the callback - style world . <p > Example : <pre > <code > Maybe . &lt ; Event&gt ; create ( emitter - &gt ; { Callback listener = new Callback () { &#64 ; Override public void onEvent ( Event e ) { if ( e . isNothing () ) { emitter . onComplete () ; } else { emitter . onSuccess ( e ) ; } } [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Maybe < T > create ( MaybeOnSubscribe < T > onSubscribe ) { ObjectHelper . requireNonNull ( onSubscribe , "onSubscribe is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeCreate < T > ( onSubscribe ) ) ; }


Input: Calls a Callable for each individual MaybeObserver to return the actual MaybeSource source to be subscribed to . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Maybe < T > defer ( final Callable < ? extends MaybeSource < ? extends T > > maybeSupplier ) { ObjectHelper . requireNonNull ( maybeSupplier , "maybeSupplier is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeDefer < T > ( maybeSupplier ) ) ; }


Input: Returns a ( singleton ) Maybe instance that calls { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) @ SuppressWarnings ( "unchecked" ) public static < T > Maybe < T > empty ( ) { return RxJavaPlugins . onAssembly ( ( Maybe < T > ) MaybeEmpty . INSTANCE ) ; }


Input: Returns a Maybe that invokes a subscriber s { @link MaybeObserver#onError onError } method when the subscriber subscribes to it . <p > <img width = 640 height = 447 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Maybe . error . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code error } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Maybe < T > error ( Throwable exception ) { ObjectHelper . requireNonNull ( exception , "exception is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeError < T > ( exception ) ) ; }


Input: Returns a Maybe that invokes a { @link MaybeObserver } s { @link MaybeObserver#onError onError } method when the MaybeObserver subscribes to it . <p > <img width = 640 height = 190 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / error . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code error } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Maybe < T > error ( Callable < ? extends Throwable > supplier ) { ObjectHelper . requireNonNull ( supplier , "errorSupplier is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeErrorCallable < T > ( supplier ) ) ; }


Input: Wraps a CompletableSource into a Maybe . [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Maybe < T > fromCompletable ( CompletableSource completableSource ) { ObjectHelper . requireNonNull ( completableSource , "completableSource is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeFromCompletable < T > ( completableSource ) ) ; }


Input: Wraps a SingleSource into a Maybe . [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Maybe < T > fromSingle ( SingleSource < T > singleSource ) { ObjectHelper . requireNonNull ( singleSource , "singleSource is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeFromSingle < T > ( singleSource ) ) ; }


Input: Returns a { @link Maybe } that invokes the given { @link Callable } for each individual { @link MaybeObserver } that subscribes and emits the resulting non - null item via { @code onSuccess } while considering a { @code null } result from the { @code Callable } as indication for valueless completion via { @code onComplete } . <p > This operator allows you to defer the execution of the given { @code Callable } until a { @code MaybeObserver } subscribes to the returned { @link Maybe } . In other terms this source operator evaluates the given { @code Callable } lazily . <p > Note that the { @code null } handling of this operator differs from the similar source operators in the other { @link io . reactivex base reactive classes } . Those operators signal a { @code NullPointerException } if the value returned by their { @code Callable } is { @code null } while this { @code fromCallable } considers it to indicate the returned { @code Maybe } is empty . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code fromCallable } does not operate by default on a particular { @link Scheduler } . < / dd > <dt > <b > Error handling : < / b > < / dt > <dd > Any non - fatal exception thrown by { @link Callable#call () } will be forwarded to { @code onError } except if the { @code MaybeObserver } disposed the subscription in the meantime . In this latter case the exception is forwarded to the global error handler via { @link io . reactivex . plugins . RxJavaPlugins#onError ( Throwable ) } wrapped into a { @link io . reactivex . exceptions . UndeliverableException UndeliverableException } . Fatal exceptions are rethrown and usually will end up in the executing thread s { @link java . lang . Thread . UncaughtExceptionHandler#uncaughtException ( Thread Throwable ) } handler . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Maybe < T > fromCallable ( @ NonNull final Callable < ? extends T > callable ) { ObjectHelper . requireNonNull ( callable , "callable is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeFromCallable < T > ( callable ) ) ; }


Input: Converts a { @link Future } into a Maybe treating a null result as an indication of emptiness . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / from . Future . png alt = > <p > You can convert any object that supports the { @link Future } interface into a Maybe that emits the return value of the { @link Future#get } method of that object by passing the object into the { @code from } method . <p > <em > Important note : < / em > This Maybe is blocking ; you cannot dispose it . <p > Unlike 1 . x disposing the Maybe won t cancel the future . If necessary one can use composition to achieve the cancellation effect : { @code futureMaybe . doOnDispose (( ) - > future . cancel ( true )) ; } . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code fromFuture } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Maybe < T > fromFuture ( Future < ? extends T > future ) { ObjectHelper . requireNonNull ( future , "future is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeFromFuture < T > ( future , 0L , null ) ) ; }


Input: Converts a { @link Future } into a Maybe with a timeout on the Future . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / from . Future . png alt = > <p > You can convert any object that supports the { @link Future } interface into a Maybe that emits the return value of the { @link Future#get } method of that object by passing the object into the { @code fromFuture } method . <p > Unlike 1 . x disposing the Maybe won t cancel the future . If necessary one can use composition to achieve the cancellation effect : { @code futureMaybe . doOnCancel (( ) - > future . cancel ( true )) ; } . <p > <em > Important note : < / em > This Maybe is blocking on the thread it gets subscribed on ; you cannot dispose it . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code fromFuture } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Maybe < T > fromFuture ( Future < ? extends T > future , long timeout , TimeUnit unit ) { ObjectHelper . requireNonNull ( future , "future is null" ) ; ObjectHelper . requireNonNull ( unit , "unit is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeFromFuture < T > ( future , timeout , unit ) ) ; }


Input: Returns a Maybe instance that runs the given Action for each subscriber and emits either its exception or simply completes . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Maybe < T > fromRunnable ( final Runnable run ) { ObjectHelper . requireNonNull ( run , "run is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeFromRunnable < T > ( run ) ) ; }


Input: Returns a { @code Maybe } that emits a specified item . <p > <img width = 640 height = 485 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Maybe . just . png alt = > <p > To convert any object into a { @code Maybe } that emits that object pass that object into the { @code just } method . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code just } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Maybe < T > just ( T item ) { ObjectHelper . requireNonNull ( item , "item is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeJust < T > ( item ) ) ; }


Input: Merges a Flowable sequence of MaybeSource instances into a single Flowable sequence running all MaybeSources at once . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ BackpressureSupport ( BackpressureKind . FULL ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > merge ( Publisher < ? extends MaybeSource < ? extends T > > sources ) { return merge ( sources , Integer . MAX_VALUE ) ; }


Input: Flattens an array of MaybeSources into one Flowable in a way that allows a Subscriber to receive all successfully emitted items from each of the source MaybeSources without being interrupted by an error notification from one of them . <p > This behaves like { @link #merge ( Publisher ) } except that if any of the merged MaybeSources notify of an error via { @link Subscriber#onError onError } { @code mergeDelayError } will refrain from propagating that error notification until all of the merged MaybeSources have finished emitting items . <p > <img width = 640 height = 380 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / mergeDelayError . png alt = > <p > Even if multiple merged MaybeSources 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 . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code mergeArrayDelayError } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) @ BackpressureSupport ( BackpressureKind . FULL ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > mergeArrayDelayError ( MaybeSource < ? extends T > ... sources ) { if ( sources . length == 0 ) { return Flowable . empty ( ) ; } return Flowable . fromArray ( sources ) . flatMap ( ( Function ) MaybeToPublisher . instance ( ) , true , sources . length ) ; }


Input: Flattens an Iterable of MaybeSources into one Flowable in a way that allows a Subscriber to receive all successfully emitted items from each of the source MaybeSources without being interrupted by an error notification from one of them . <p > This behaves like { @link #merge ( Publisher ) } except that if any of the merged MaybeSources notify of an error via { @link Subscriber#onError onError } { @code mergeDelayError } will refrain from propagating that error notification until all of the merged MaybeSources have finished emitting items . <p > <img width = 640 height = 380 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / mergeDelayError . png alt = > <p > Even if multiple merged MaybeSources 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 . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code mergeDelayError } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) @ BackpressureSupport ( BackpressureKind . FULL ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Flowable < T > mergeDelayError ( Iterable < ? extends MaybeSource < ? extends T > > sources ) { return Flowable . fromIterable ( sources ) . flatMap ( ( Function ) MaybeToPublisher . instance ( ) , true ) ; }


Input: Returns a Maybe that never sends any items or notifications to a { @link MaybeObserver } . <p > <img width = 640 height = 185 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / never . png alt = > <p > This Maybe is useful primarily for testing purposes . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code never } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) @ SuppressWarnings ( "unchecked" ) public static < T > Maybe < T > never ( ) { return RxJavaPlugins . onAssembly ( ( Maybe < T > ) MaybeNever . INSTANCE ) ; }


Input: Returns a Single that emits a Boolean value that indicates whether two MaybeSource sequences are the same by comparing the items emitted by each MaybeSource pairwise . <p > <img width = 640 height = 385 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / sequenceEqual . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code sequenceEqual } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Single < Boolean > sequenceEqual ( MaybeSource < ? extends T > source1 , MaybeSource < ? extends T > source2 ) { return sequenceEqual ( source1 , source2 , ObjectHelper . equalsPredicate ( ) ) ; }


Input: Returns a Single that emits a Boolean value that indicates whether two MaybeSources are the same by comparing the items emitted by each MaybeSource pairwise based on the results of a specified equality function . <p > <img width = 640 height = 385 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / sequenceEqual . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code sequenceEqual } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Single < Boolean > sequenceEqual ( MaybeSource < ? extends T > source1 , MaybeSource < ? extends T > source2 , BiPredicate < ? super T , ? super T > isEqual ) { ObjectHelper . requireNonNull ( source1 , "source1 is null" ) ; ObjectHelper . requireNonNull ( source2 , "source2 is null" ) ; ObjectHelper . requireNonNull ( isEqual , "isEqual is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeEqualSingle < T > ( source1 , source2 , isEqual ) ) ; }


Input: Returns a Maybe that emits { @code 0L } after a specified delay . <p > <img width = 640 height = 200 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / timer . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code timer } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public static Maybe < Long > timer ( long delay , TimeUnit unit ) { return timer ( delay , unit , Schedulers . computation ( ) ) ; }


Input: Returns a Maybe that emits { @code 0L } after a specified delay on a specified Scheduler . <p > <img width = 640 height = 200 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / timer . s . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > You specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public static Maybe < Long > timer ( long delay , TimeUnit unit , Scheduler scheduler ) { ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeTimer ( Math . max ( 0L , delay ) , unit , scheduler ) ) ; }


Input: <strong > Advanced use only : < / strong > creates a Maybe instance without any safeguards by using a callback that is called with a MaybeObserver . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Maybe < T > unsafeCreate ( MaybeSource < T > onSubscribe ) { if ( onSubscribe instanceof Maybe ) { throw new IllegalArgumentException ( "unsafeCreate(Maybe) should be upgraded" ) ; } ObjectHelper . requireNonNull ( onSubscribe , "onSubscribe is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeUnsafeCreate < T > ( onSubscribe ) ) ; }


Input: Constructs a Maybe that creates a dependent resource object which is disposed of when the upstream terminates or the downstream calls dispose () . <p > <img width = 640 height = 400 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / using . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code using } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T , D > Maybe < T > using ( Callable < ? extends D > resourceSupplier , Function < ? super D , ? extends MaybeSource < ? extends T > > sourceSupplier , Consumer < ? super D > resourceDisposer ) { return using ( resourceSupplier , sourceSupplier , resourceDisposer , true ) ; }


Input: Constructs a Maybe that creates a dependent resource object which is disposed of just before termination if you have set { @code disposeEagerly } to { @code true } and a downstream dispose () does not occur before termination . Otherwise resource disposal will occur on call to dispose () . Eager disposal is particularly appropriate for a synchronous Maybe that reuses resources . { @code disposeAction } will only be called once per subscription . <p > <img width = 640 height = 400 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / using . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code using } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T , D > Maybe < T > using ( Callable < ? extends D > resourceSupplier , Function < ? super D , ? extends MaybeSource < ? extends T > > sourceSupplier , Consumer < ? super D > resourceDisposer , boolean eager ) { ObjectHelper . requireNonNull ( resourceSupplier , "resourceSupplier is null" ) ; ObjectHelper . requireNonNull ( sourceSupplier , "sourceSupplier is null" ) ; ObjectHelper . requireNonNull ( resourceDisposer , "disposer is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeUsing < T , D > ( resourceSupplier , sourceSupplier , resourceDisposer , eager ) ) ; }


Input: Wraps a MaybeSource instance into a new Maybe instance if not already a Maybe instance . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Maybe < T > wrap ( MaybeSource < T > source ) { if ( source instanceof Maybe ) { return RxJavaPlugins . onAssembly ( ( Maybe < T > ) source ) ; } ObjectHelper . requireNonNull ( source , "onSubscribe is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeUnsafeCreate < T > ( source ) ) ; }


Input: Returns a Maybe that emits the results of a specified combiner function applied to combinations of items emitted in sequence by an Iterable of other MaybeSources . <p > Note on method signature : since Java doesn t allow creating a generic array with { @code new T [] } the implementation of this operator has to create an { @code Object [] } instead . Unfortunately a { @code Function<Integer [] R > } passed to the method would trigger a { @code ClassCastException } . [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T , R > Maybe < R > zip ( Iterable < ? extends MaybeSource < ? extends T > > sources , Function < ? super Object [ ] , ? extends R > zipper ) { ObjectHelper . requireNonNull ( zipper , "zipper is null" ) ; ObjectHelper . requireNonNull ( sources , "sources is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeZipIterable < T , R > ( sources , zipper ) ) ; }


Input: Returns a Maybe that emits the results of a specified combiner function applied to combinations of items emitted in sequence by an array of other MaybeSources . <p > Note on method signature : since Java doesn t allow creating a generic array with { @code new T [] } the implementation of this operator has to create an { @code Object [] } instead . Unfortunately a { @code Function<Integer [] R > } passed to the method would trigger a { @code ClassCastException } . [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T , R > Maybe < R > zipArray ( Function < ? super Object [ ] , ? extends R > zipper , MaybeSource < ? extends T > ... sources ) { ObjectHelper . requireNonNull ( sources , "sources is null" ) ; if ( sources . length == 0 ) { return empty ( ) ; } ObjectHelper . requireNonNull ( zipper , "zipper is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeZipArray < T , R > ( sources , zipper ) ) ; }


Input: Mirrors the MaybeSource ( current or provided ) that first signals an event . <p > <img width = 640 height = 385 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / amb . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code ambWith } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ SuppressWarnings ( "unchecked" ) @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > ambWith ( MaybeSource < ? extends T > other ) { ObjectHelper . requireNonNull ( other , "other is null" ) ; return ambArray ( this , other ) ; }


Input: Waits in a blocking fashion until the current Maybe signals a success value ( which is returned ) null if completed or an exception ( which is propagated ) . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final T blockingGet ( ) { BlockingMultiObserver < T > observer = new BlockingMultiObserver < T > ( ) ; subscribe ( observer ) ; return observer . blockingGet ( ) ; }


Input: Waits in a blocking fashion until the current Maybe signals a success value ( which is returned ) defaultValue if completed or an exception ( which is propagated ) . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final T blockingGet ( T defaultValue ) { ObjectHelper . requireNonNull ( defaultValue , "defaultValue is null" ) ; BlockingMultiObserver < T > observer = new BlockingMultiObserver < T > ( ) ; subscribe ( observer ) ; return observer . blockingGet ( defaultValue ) ; }


Input: Returns a Maybe that subscribes to this Maybe lazily caches its event and replays it to all the downstream subscribers . <p > <img width = 640 height = 410 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / cache . png alt = > <p > The operator subscribes only when the first downstream subscriber subscribes and maintains a single subscription towards this Maybe . <p > <em > Note : < / em > You sacrifice the ability to dispose the origin when you use the { @code cache } . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code cache } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > cache ( ) { return RxJavaPlugins . onAssembly ( new MaybeCache < T > ( this ) ) ; }


Input: Transform a Maybe by applying a particular Transformer function to it . <p > This method operates on the Maybe itself whereas { @link #lift } operates on the Maybe s MaybeObservers . <p > If the operator you are creating is designed to act on the individual item emitted by a Maybe use { @link #lift } . If your operator is designed to transform the source Maybe as a whole ( for instance by applying a particular set of existing RxJava operators to it ) use { @code compose } . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code compose } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ SuppressWarnings ( "unchecked" ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Maybe < R > compose ( MaybeTransformer < ? super T , ? extends R > transformer ) { return wrap ( ( ( MaybeTransformer < T , R > ) ObjectHelper . requireNonNull ( transformer , "transformer is null" ) ) . apply ( this ) ) ; }


Input: Returns a Maybe that is based on applying a specified function to the item emitted by the source Maybe where that function returns a MaybeSource . <p > <img width = 640 height = 356 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Maybe . flatMap . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Maybe < R > concatMap ( Function < ? super T , ? extends MaybeSource < ? extends R > > mapper ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeFlatten < T , R > ( this , mapper ) ) ; }


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


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


Input: Returns a Maybe that counts the total number of items emitted ( 0 or 1 ) by the source Maybe and emits this count as a 64 - bit Long . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / longCount . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code count } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < Long > count ( ) { return RxJavaPlugins . onAssembly ( new MaybeCount < T > ( this ) ) ; }


Input: Returns a Maybe that signals the events emitted by the source Maybe shifted forward in time by a specified delay . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / delay . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code delay } operates by default on the { @code computation } { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . COMPUTATION ) public final Maybe < T > delay ( long delay , TimeUnit unit ) { return delay ( delay , unit , Schedulers . computation ( ) ) ; }


Input: Returns a Maybe that signals the events emitted by the source Maybe shifted forward in time by a specified delay running on the specified Scheduler . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / delay . s . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > you specify which { @link Scheduler } this operator will use . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . CUSTOM ) public final Maybe < T > delay ( long delay , TimeUnit unit , Scheduler scheduler ) { ObjectHelper . requireNonNull ( unit , "unit is null" ) ; ObjectHelper . requireNonNull ( scheduler , "scheduler is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeDelay < T > ( this , Math . max ( 0L , delay ) , unit , scheduler ) ) ; }


Input: Returns a Maybe that delays the subscription to this Maybe until the other Publisher emits an element or completes normally . <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The { @code Publisher } source is consumed in an unbounded fashion ( without applying backpressure ) . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This method does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ BackpressureSupport ( BackpressureKind . UNBOUNDED_IN ) @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U > Maybe < T > delaySubscription ( Publisher < U > subscriptionIndicator ) { ObjectHelper . requireNonNull ( subscriptionIndicator , "subscriptionIndicator is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeDelaySubscriptionOtherPublisher < T , U > ( this , subscriptionIndicator ) ) ; }


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


Input: Calls the shared consumer with the error sent via onError for each MaybeObserver that subscribes to the current Maybe . <p > <img width = 640 height = 358 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnError . m . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > doOnError ( Consumer < ? super Throwable > onError ) { return RxJavaPlugins . onAssembly ( new MaybePeek < T > ( this , Functions . emptyConsumer ( ) , // onSubscribe Functions . emptyConsumer ( ) , // onSuccess ObjectHelper . requireNonNull ( onError , "onError is null" ) , Functions . EMPTY_ACTION , // onComplete Functions . EMPTY_ACTION , // (onSuccess | onError | onComplete) Functions . EMPTY_ACTION // dispose ) ) ; }


Input: Calls the given onEvent callback with the ( success value null ) for an onSuccess ( null throwable ) for an onError or ( null null ) for an onComplete signal from this Maybe before delivering said signal to the downstream . <p > Exceptions thrown from the callback will override the event so the downstream receives the error instead of the original signal . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > doOnEvent ( BiConsumer < ? super T , ? super Throwable > onEvent ) { ObjectHelper . requireNonNull ( onEvent , "onEvent is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeDoOnEvent < T > ( this , onEvent ) ) ; }


Input: Returns a Maybe instance that calls the given onTerminate callback just before this Maybe completes normally or with an exception . <p > <img width = 640 height = 305 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / doOnTerminate . png alt = > <p > This differs from { [CODESPLIT] @ Experimental @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > doOnTerminate ( final Action onTerminate ) { ObjectHelper . requireNonNull ( onTerminate , "onTerminate is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeDoOnTerminate < T > ( this , onTerminate ) ) ; }


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


Input: Maps the success value of the upstream { @link Maybe } into an { @link Iterable } and emits its items as a { @link Flowable } sequence . <p > <img width = 640 height = 373 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / flattenAsFlowable . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors backpressure from downstream . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code flattenAsFlowable } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ BackpressureSupport ( BackpressureKind . FULL ) @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U > Flowable < U > flattenAsFlowable ( final Function < ? super T , ? extends Iterable < ? extends U > > mapper ) { ObjectHelper . requireNonNull ( mapper , "mapper is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeFlatMapIterableFlowable < T , U > ( this , mapper ) ) ; }


Input: Hides the identity of this Maybe and its Disposable . <p > <img width = 640 height = 300 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Maybe . hide . png alt = > <p > Allows preventing certain identity - based optimizations ( fusion ) . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > hide ( ) { return RxJavaPlugins . onAssembly ( new MaybeHide < T > ( this ) ) ; }


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


Input: Returns a Single that emits { @code true } if the source Maybe is empty otherwise { @code false } . <p > <img width = 640 height = 320 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / isEmpty . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code isEmpty } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < Boolean > isEmpty ( ) { return RxJavaPlugins . onAssembly ( new MaybeIsEmptySingle < T > ( this ) ) ; }


Input: <strong > This method requires advanced knowledge about building operators please consider other standard composition methods first ; < / strong > Returns a { @code Maybe } which when subscribed to invokes the { @link MaybeOperator#apply ( MaybeObserver ) apply ( MaybeObserver ) } method of the provided { @link MaybeOperator } for each individual downstream { @link Maybe } and allows the insertion of a custom operator by accessing the downstream s { @link MaybeObserver } during this subscription phase and providing a new { @code MaybeObserver } containing the custom operator s intended business logic that will be used in the subscription process going further upstream . <p > Generally such a new { @code MaybeObserver } will wrap the downstream s { @code MaybeObserver } and forwards the { @code onSuccess } { @code onError } and { @code onComplete } 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 . <p > Example : <pre > <code > // Step 1 : Create the consumer type that will be returned by the MaybeOperator . apply () : [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > Maybe < R > lift ( final MaybeOperator < ? extends R , ? super T > lift ) { ObjectHelper . requireNonNull ( lift , "lift is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeLift < T , R > ( this , lift ) ) ; }


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


Input: Filters the items emitted by a Maybe only emitting its success value if that is an instance of the supplied Class . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / ofClass . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code ofType } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U > Maybe < U > ofType ( final Class < U > clazz ) { ObjectHelper . requireNonNull ( clazz , "clazz is null" ) ; return filter ( Functions . isInstanceOf ( clazz ) ) . cast ( clazz ) ; }


Input: Calls the specified converter function with the current Maybe instance during assembly time and returns its result . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code to } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > @param <R > the result type @param convert the function that is called with the current Maybe instance during assembly time that should return some value to be the result [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final < R > R to ( Function < ? super Maybe < T > , R > convert ) { try { return ObjectHelper . requireNonNull ( convert , "convert is null" ) . apply ( this ) ; } catch ( Throwable ex ) { Exceptions . throwIfFatal ( ex ) ; throw ExceptionHelper . wrapOrThrow ( ex ) ; } }


Input: Converts this Maybe into an Observable instance composing disposal through . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ SuppressWarnings ( "unchecked" ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > toObservable ( ) { if ( this instanceof FuseToObservable ) { return ( ( FuseToObservable < T > ) this ) . fuseToObservable ( ) ; } return RxJavaPlugins . onAssembly ( new MaybeToObservable < T > ( this ) ) ; }


Input: Converts this Maybe into a Single instance composing disposal through and turning an empty Maybe into a signal of NoSuchElementException . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > toSingle ( ) { return RxJavaPlugins . onAssembly ( new MaybeToSingle < T > ( this , null ) ) ; }


Input: Returns a Maybe instance that if this Maybe emits an error it will emit an onComplete and swallow the throwable . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > onErrorComplete ( ) { return onErrorComplete ( Functions . alwaysTrue ( ) ) ; }


Input: Instructs a Maybe to pass control to another { @link MaybeSource } rather than invoking { @link MaybeObserver#onError onError } if it encounters an error . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / onErrorResumeNext . png alt = > <p > You can use this to prevent errors from propagating or to supply fallback data should errors be encountered . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code onErrorResumeNext } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > onErrorResumeNext ( final MaybeSource < ? extends T > next ) { ObjectHelper . requireNonNull ( next , "next is null" ) ; return onErrorResumeNext ( Functions . justFunction ( next ) ) ; }


Input: Instructs a Maybe to pass control to another Maybe rather than invoking { @link MaybeObserver#onError onError } if it encounters an error . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / onErrorResumeNext . png alt = > <p > You can use this to prevent errors from propagating or to supply fallback data should errors be encountered . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code onErrorResumeNext } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > onErrorResumeNext ( Function < ? super Throwable , ? extends MaybeSource < ? extends T > > resumeFunction ) { ObjectHelper . requireNonNull ( resumeFunction , "resumeFunction is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeOnErrorNext < T > ( this , resumeFunction , true ) ) ; }


Input: Instructs a Maybe to emit an item ( returned by a specified function ) rather than invoking { @link MaybeObserver#onError onError } if it encounters an error . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / onErrorReturn . png alt = > <p > You can use this to prevent errors from propagating or to supply fallback data should errors be encountered . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code onErrorReturn } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > onErrorReturn ( Function < ? super Throwable , ? extends T > valueSupplier ) { ObjectHelper . requireNonNull ( valueSupplier , "valueSupplier is null" ) ; return RxJavaPlugins . onAssembly ( new MaybeOnErrorReturn < T > ( this , valueSupplier ) ) ; }


Input: Nulls out references to the upstream producer and downstream MaybeObserver if the sequence is terminated or downstream calls dispose () . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > onTerminateDetach ( ) { return RxJavaPlugins . onAssembly ( new MaybeDetach < T > ( this ) ) ; }


Input: Returns a Flowable that repeats the sequence of items emitted by the source Maybe until the provided stop function returns true . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / repeat . on . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator honors downstream backpressure . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code repeatUntil } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ BackpressureSupport ( BackpressureKind . FULL ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > repeatUntil ( BooleanSupplier stop ) { return toFlowable ( ) . repeatUntil ( stop ) ; }


Input: Returns a Flowable that emits the same values as the source Publisher with the exception of an { @code onComplete } . An { @code onComplete } notification from the source will result in the emission of a { @code void } item to the Publisher provided as an argument to the { @code notificationHandler } function . If that Publisher calls { @code onComplete } or { @code onError } then { @code repeatWhen } will call { @code onComplete } or { @code onError } on the child subscription . Otherwise this Publisher will resubscribe to the source Publisher . <p > <img width = 640 height = 430 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / repeatWhen . f . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator honors downstream backpressure and expects the source { @code Publisher } to honor backpressure as well . If this expectation is violated the operator <em > may< / em > throw an { @code IllegalStateException } . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code repeatWhen } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ BackpressureSupport ( BackpressureKind . FULL ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > repeatWhen ( final Function < ? super Flowable < Object > , ? extends Publisher < ? > > handler ) { return toFlowable ( ) . repeatWhen ( handler ) ; }


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


Input: Returns a Maybe that mirrors the source Maybe resubscribing to it if it calls { @code onError } up to a specified number of retries . <p > <img width = 640 height = 315 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / retry . png alt = > <p > If the source Maybe calls { @link MaybeObserver#onError } this method will resubscribe to the source Maybe for a maximum of { @code count } resubscriptions rather than propagating the { @code onError } call . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code retry } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > retry ( long count ) { return retry ( count , Functions . alwaysTrue ( ) ) ; }


Input: Retries at most times or until the predicate returns false whichever happens first . [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > retry ( long times , Predicate < ? super Throwable > predicate ) { return toFlowable ( ) . retry ( times , predicate ) . singleElement ( ) ; }


Input: Returns a Maybe that emits the same values as the source Maybe with the exception of an { @code onError } . An { @code onError } notification from the source will result in the emission of a { @link Throwable } item to the Publisher provided as an argument to the { @code notificationHandler } function . If that Publisher calls { @code onComplete } or { @code onError } then { @code retry } will call { @code onComplete } or { @code onError } on the child subscription . Otherwise this Publisher will resubscribe to the source Publisher . <p > <img width = 640 height = 430 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / retryWhen . f . png alt = > <p > Example : [CODESPLIT] @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Maybe < T > retryWhen ( final Function < ? super Flowable < Throwable > , ? extends Publisher < ? > > handler ) { return toFlowable ( ) . retryWhen ( handler ) . singleElement ( ) ; }


Input: Subscribes to a Maybe and ignores { @code onSuccess } and { @code onComplete } emissions . <p > If the Maybe emits an error it is wrapped into an { @link io . reactivex . exceptions . OnErrorNotImplementedException OnErrorNotImplementedException } and routed to the RxJavaPlugins . onError handler . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code subscribe } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl > [CODESPLIT] @ SchedulerSupport ( SchedulerSupport . NONE ) public final Disposable subscribe ( ) { return subscribe ( Functions . emptyConsumer ( ) , Functions . ON_ERROR_MISSING , Functions . EMPTY_ACTION ) ; }