Top Description Constructors Methods
io.reactivex.rxjava3.core

public abstract Class Maybe<T>

extends Object
implements MaybeSource<T>
Class Inheritance
All Implemented Interfaces
io.reactivex.rxjava3.core.MaybeSource
Known Direct Subclasses
io.reactivex.rxjava3.internal.jdk8.MaybeFromCompletionStage, io.reactivex.rxjava3.internal.jdk8.MaybeMapOptional, io.reactivex.rxjava3.internal.jdk8.SingleMapOptional, io.reactivex.rxjava3.internal.operators.completable.CompletableOnErrorReturn, io.reactivex.rxjava3.internal.operators.flowable.FlowableLastMaybe, io.reactivex.rxjava3.internal.operators.flowable.FlowableSingleMaybe, io.reactivex.rxjava3.internal.operators.flowable.FlowableElementAtMaybe, io.reactivex.rxjava3.internal.operators.flowable.FlowableElementAtMaybePublisher, io.reactivex.rxjava3.internal.operators.flowable.FlowableReduceMaybe, io.reactivex.rxjava3.internal.operators.maybe.AbstractMaybeWithUpstream, io.reactivex.rxjava3.internal.operators.maybe.MaybeAmb, io.reactivex.rxjava3.internal.operators.maybe.MaybeCache, io.reactivex.rxjava3.internal.operators.maybe.MaybeCreate, io.reactivex.rxjava3.internal.operators.maybe.MaybeDefer, io.reactivex.rxjava3.internal.operators.maybe.MaybeDelayWithCompletable, io.reactivex.rxjava3.internal.operators.maybe.MaybeFromSupplier, io.reactivex.rxjava3.internal.operators.maybe.MaybeJust, io.reactivex.rxjava3.internal.operators.maybe.MaybeNever, io.reactivex.rxjava3.internal.operators.maybe.MaybeEmpty, io.reactivex.rxjava3.internal.operators.maybe.MaybeError, io.reactivex.rxjava3.internal.operators.maybe.MaybeErrorCallable, io.reactivex.rxjava3.internal.operators.maybe.MaybeFilterSingle, io.reactivex.rxjava3.internal.operators.maybe.MaybeFlatMapSingle, io.reactivex.rxjava3.internal.operators.maybe.MaybeFromAction, io.reactivex.rxjava3.internal.operators.maybe.MaybeFromCallable, io.reactivex.rxjava3.internal.operators.maybe.MaybeFromCompletable, io.reactivex.rxjava3.internal.operators.maybe.MaybeFromFuture, io.reactivex.rxjava3.internal.operators.maybe.MaybeFromRunnable, io.reactivex.rxjava3.internal.operators.maybe.MaybeTimeInterval, io.reactivex.rxjava3.internal.operators.maybe.MaybeTimer, io.reactivex.rxjava3.internal.operators.maybe.MaybeUsing, io.reactivex.rxjava3.internal.operators.maybe.MaybeZipArray, io.reactivex.rxjava3.internal.operators.maybe.MaybeZipIterable, io.reactivex.rxjava3.internal.operators.maybe.MaybeDoOnTerminate, io.reactivex.rxjava3.internal.operators.maybe.MaybeFromSingle, io.reactivex.rxjava3.internal.operators.observable.ObservableReduceMaybe, io.reactivex.rxjava3.internal.operators.observable.ObservableSingleMaybe, io.reactivex.rxjava3.internal.operators.observable.ObservableElementAtMaybe, io.reactivex.rxjava3.internal.operators.observable.ObservableLastMaybe, io.reactivex.rxjava3.internal.operators.single.SingleDematerialize, io.reactivex.rxjava3.internal.operators.single.SingleFlatMapMaybe, io.reactivex.rxjava3.internal.operators.single.SingleOnErrorComplete, io.reactivex.rxjava3.subjects.MaybeSubject
Type Parameters
<T>
the value type
Imports
java.util.*, java.util.concurrent.*, java.util.stream.*, org.reactivestreams.*, io.reactivex.rxjava3.annotations.*, io.reactivex.rxjava3.disposables.*, io.reactivex.rxjava3.exceptions.*, io.reactivex.rxjava3.functions.*, io.reactivex.rxjava3.internal.functions.*, io.reactivex.rxjava3.internal.fuseable.*, io.reactivex.rxjava3.internal.jdk8.*, io.reactivex.rxjava3.internal.observers.*, io.reactivex.rxjava3.internal.operators.flowable.*, io.reactivex.rxjava3.internal.operators.maybe.*, io.reactivex.rxjava3.internal.operators.mixed.*, io.reactivex.rxjava3.internal.operators.observable.ObservableElementAtMaybe, io.reactivex.rxjava3.internal.util.ErrorMode, io.reactivex.rxjava3.observers.TestObserver, io.reactivex.rxjava3.plugins.RxJavaPlugins, io.reactivex.rxjava3.schedulers.*

The Maybe class represents a deferred computation and emission of a single value, no value at all or an exception.

The Maybe class implements the MaybeSource base interface and the default consumer type it interacts with is the MaybeObserver via the subscribe(MaybeObserver) method.

The Maybe operates with the following sequential protocol:


    onSubscribe (onSuccess | onError | onComplete)?

Note that onSuccess, onError and onComplete are mutually exclusive events; unlike Observable, onSuccess is never followed by onError or onComplete.

Like Observable, a running Maybe can be stopped through the Disposable instance provided to consumers through MaybeObserver#onSubscribe.

Like an Observable, a Maybe is lazy, can be either "hot" or "cold", synchronous or asynchronous. Maybe instances returned by the methods of this class are cold and there is a standard hot implementation in the form of a subject: MaybeSubject.

The documentation for this class makes use of marble diagrams. The following legend explains these diagrams:

See Flowable or Observable for the implementation of the Reactive Pattern for a stream or vector of values.

Example:


Disposable d = Maybe.just("Hello World")
   .delay(10, TimeUnit.SECONDS, Schedulers.io())
   .subscribeWith(new DisposableMaybeObserver<String>() {
       @Override
       public void onStart() {
           System.out.println("Started");
       }

       @Override
       public void onSuccess(String value) {
           System.out.println("Success: " + value);
       }

       @Override
       public void onError(Throwable error) {
           error.printStackTrace();
       }

       @Override
       public void onComplete() {
           System.out.println("Done!");
       }
   });

Thread.sleep(5000);

d.dispose();

Note that by design, subscriptions via subscribe(MaybeObserver) can't be disposed from the outside (hence the void return of the subscribe(MaybeObserver) method) and it is the responsibility of the implementor of the MaybeObserver to allow this to happen. RxJava supports such usage with the standard DisposableMaybeObserver instance. For convenience, the subscribeWith(MaybeObserver) method is provided as well to allow working with a MaybeObserver (or subclass) instance to be applied with in a fluent manner (such as in the example above).

Since
2.0
See Also
io.reactivex.rxjava3.observers.DisposableMaybeObserver

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static <
the value type
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
amb
(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends T>>
the Iterable sequence of sources. A subscription to each source will occur in the same order as in the Iterable.
sources
)

Runs multiple MaybeSources provided by an Iterable sequence and signals the events of the first one that signals (disposing the rest).

public static <
the value type
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
ambArray
(@NonNull MaybeSource<? extends T>...
the array of sources. A subscription to each source will occur in the same order as in the array.
sources
)

Runs multiple MaybeSources and signals the events of the first one that signals (disposing the rest).

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
ambWith
(@NonNull MaybeSource<? extends T>
a MaybeSource competing to react first. A subscription to this provided source will occur after subscribing to the current source.
other
)

Mirrors the MaybeSource (current or provided) that first signals an event.

public final T

Returns:

the success value
blockingGet
()

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).

public final T

Returns:

the success value
blockingGet
(T
the default item to return if this Maybe is empty
defaultValue
)

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).

public final void
blockingSubscribe()

Subscribes to the current Maybe and blocks the current thread until it terminates.

public final void
blockingSubscribe(@NonNull Consumer<? super T>
the Consumer to call if the current Maybe succeeds
onSuccess
)

Subscribes to the current Maybe and calls given onSuccess callback on the current thread when it completes normally.

public final void
blockingSubscribe(@NonNull Consumer<? super T>
the Consumer to call if the current Maybe succeeds
onSuccess
,
@NonNull Consumer<? super Throwable>
the Consumer to call if the current Maybe signals an error
onError
)

Subscribes to the current Maybe and calls the appropriate callback on the current thread when it terminates.

public final void
blockingSubscribe(@NonNull Consumer<? super T>
the Consumer to call if the current Maybe succeeds
onSuccess
,
@NonNull Consumer<? super Throwable>
the Consumer to call if the current Maybe signals an error
onError
,
@NonNull Action
the Action to call if the current Maybe completes without a value
onComplete
)

Subscribes to the current Maybe and calls the appropriate callback on the current thread when it terminates.

public final void
blockingSubscribe(@NonNull MaybeObserver<? super T>
the MaybeObserver to call methods on the current thread
observer
)

Subscribes to the current Maybe and calls the appropriate MaybeObserver method on the current thread.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
cache
()

Returns a Maybe that subscribes to this Maybe lazily, caches its event and replays it, to all the downstream subscribers.

public final <
the target type
U
>
@NonNull Maybe<U>

Returns:

the new Maybe instance
cast
(@NonNull Class<? extends U>
the type token to use for casting the success result from the current Maybe
clazz
)

Casts the success value of the current Maybe into the target type or signals a ClassCastException if not compatible.

public final <
the value type of the Maybe returned by the transformer function
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
compose
(@NonNull MaybeTransformer<? super T, ? extends R>
the transformer function, not null
transformer
)

Transform a Maybe by applying a particular MaybeTransformer function to it.

public static <
the value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
concat
(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends T>>
the Iterable sequence of MaybeSource instances
sources
)

Concatenate the single values, in a non-overlapping fashion, of the MaybeSource sources provided by an Iterable sequence as a Flowable sequence.

public static <
the common value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
concat
(@NonNull MaybeSource<? extends T>
a MaybeSource to be concatenated
source1
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be concatenated
source2
)

Returns a Flowable that emits the items emitted by two MaybeSources, one after the other.

public static <
the common value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
concat
(@NonNull MaybeSource<? extends T>
a MaybeSource to be concatenated
source1
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be concatenated
source2
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be concatenated
source3
)

Returns a Flowable that emits the items emitted by three MaybeSources, one after the other.

public static <
the common value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
concat
(@NonNull MaybeSource<? extends T>
a MaybeSource to be concatenated
source1
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be concatenated
source2
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be concatenated
source3
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be concatenated
source4
)

Returns a Flowable that emits the items emitted by four MaybeSources, one after the other.

public static <
the value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
concat
(@NonNull Publisher<@NonNull ? extends MaybeSource<? extends T>>
the Publisher of MaybeSource instances
sources
)

Concatenate the single values, in a non-overlapping fashion, of the MaybeSource sources provided by a Publisher sequence as a Flowable sequence.

public static <
the value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
concat
(@NonNull Publisher<@NonNull ? extends MaybeSource<? extends T>>
the Publisher of MaybeSource instances
sources
,
int
the number of MaybeSources to prefetch from the Publisher
prefetch
)

Concatenate the single values, in a non-overlapping fashion, of the MaybeSource sources provided by a Publisher sequence as a Flowable sequence.

public static <
the value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
concatArray
(@NonNull MaybeSource<? extends T>...
the array of MaybeSource instances
sources
)

Concatenate the single values, in a non-overlapping fashion, of the MaybeSource sources in the array as a Flowable sequence.

public static <
the common base value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
concatArrayDelayError
(@NonNull MaybeSource<? extends T>...
the array of sources
sources
)

Concatenates a variable number of MaybeSource sources and delays errors from any of them till all terminate as a Flowable sequence.

public static <
the value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance with the specified concatenation behavior
concatArrayEager
(@NonNull MaybeSource<? extends T>...
a sequence of MaybeSources that need to be eagerly concatenated
sources
)

Concatenates a sequence of MaybeSource eagerly into a Flowable sequence.

public static <
the value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance with the specified concatenation behavior
concatArrayEagerDelayError
(@NonNull MaybeSource<? extends T>...
a sequence of MaybeSources that need to be eagerly concatenated
sources
)

Concatenates a sequence of MaybeSource eagerly into a Flowable sequence.

public static <
the common element base type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable with the concatenating behavior
concatDelayError
(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends T>>
the Iterable sequence of MaybeSources
sources
)

Concatenates the Iterable sequence of MaybeSources into a single sequence by subscribing to each MaybeSource, one after the other, one at a time and delays any errors till the all inner MaybeSources terminate as a Flowable sequence.

public static <
the common element base type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable with the concatenating behavior
concatDelayError
(@NonNull Publisher<@NonNull ? extends MaybeSource<? extends T>>
the Publisher sequence of MaybeSources
sources
)

Concatenates the Publisher sequence of MaybeSources into a single sequence by subscribing to each inner MaybeSource, one after the other, one at a time and delays any errors till the all inner and the outer Publisher terminate as a Flowable sequence.

public static <
the common element base type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable with the concatenating behavior
concatDelayError
(@NonNull Publisher<@NonNull ? extends MaybeSource<? extends T>>
the Publisher sequence of MaybeSources
sources
,
int
The number of upstream items to prefetch so that fresh items are ready to be mapped when a previous MaybeSource terminates. The operator replenishes after half of the prefetch amount has been consumed and turned into MaybeSources.
prefetch
)

Concatenates the Publisher sequence of MaybeSources into a single sequence by subscribing to each inner MaybeSource, one after the other, one at a time and delays any errors till the all inner and the outer Publisher terminate as a Flowable sequence.

public static <
the value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance with the specified concatenation behavior
concatEager
(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends T>>
a sequence of MaybeSource that need to be eagerly concatenated
sources
)

Concatenates a sequence of MaybeSources eagerly into a Flowable sequence.

public static <
the value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance with the specified concatenation behavior
concatEager
(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends T>>
a sequence of MaybeSource that need to be eagerly concatenated
sources
,
int
the maximum number of concurrently running inner MaybeSources; Integer#MAX_VALUE is interpreted as all inner MaybeSources can be active at the same time
maxConcurrency
)

Concatenates a sequence of MaybeSources eagerly into a Flowable sequence and runs a limited number of the inner sequences at once.

public static <
the value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance with the specified concatenation behavior
concatEager
(@NonNull Publisher<@NonNull ? extends MaybeSource<? extends T>>
a sequence of MaybeSources that need to be eagerly concatenated
sources
)

Concatenates a Publisher sequence of MaybeSources eagerly into a Flowable sequence.

public static <
the value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance with the specified concatenation behavior
concatEager
(@NonNull Publisher<@NonNull ? extends MaybeSource<? extends T>>
a sequence of MaybeSources that need to be eagerly concatenated
sources
,
int
the maximum number of concurrently running inner MaybeSources; Integer#MAX_VALUE is interpreted as all inner MaybeSources can be active at the same time
maxConcurrency
)

Concatenates a Publisher sequence of MaybeSources eagerly into a Flowable sequence, running at most the given number of inner MaybeSources at once.

public static <
the value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance with the specified concatenation behavior
concatEagerDelayError
(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends T>>
a sequence of MaybeSource that need to be eagerly concatenated
sources
)

Concatenates a sequence of MaybeSources eagerly into a Flowable sequence, delaying errors until all inner MaybeSources terminate.

public static <
the value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance with the specified concatenation behavior
concatEagerDelayError
(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends T>>
a sequence of MaybeSource that need to be eagerly concatenated
sources
,
int
the maximum number of concurrently running inner MaybeSources; Integer#MAX_VALUE is interpreted as all inner MaybeSources can be active at the same time
maxConcurrency
)

Concatenates a sequence of MaybeSources eagerly into a Flowable sequence, delaying errors until all inner MaybeSources terminate and runs a limited number of inner MaybeSources at once.

public static <
the value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance with the specified concatenation behavior
concatEagerDelayError
(@NonNull Publisher<@NonNull ? extends MaybeSource<? extends T>>
a sequence of MaybeSources that need to be eagerly concatenated
sources
)

Concatenates a Publisher sequence of MaybeSources eagerly into a Flowable sequence, delaying errors until all the inner and the outer sequence terminate.

public static <
the value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance with the specified concatenation behavior
concatEagerDelayError
(@NonNull Publisher<@NonNull ? extends MaybeSource<? extends T>>
a sequence of MaybeSources that need to be eagerly concatenated
sources
,
int
the maximum number of concurrently running inner MaybeSources; Integer#MAX_VALUE is interpreted as all inner MaybeSources can be active at the same time
maxConcurrency
)

Concatenates a Publisher sequence of MaybeSources eagerly into a Flowable sequence, delaying errors until all the inner and the outer sequence terminate and runs a limited number of the inner MaybeSources at once.

public final <
the result value type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
concatMap
(@NonNull Function<? super T, ? extends MaybeSource<? extends R>>
a function that, when applied to the item emitted by the current Maybe, returns a MaybeSource
mapper
)

Returns a Maybe that is based on applying a specified function to the item emitted by the current Maybe, where that function returns a MaybeSource.

public final @NonNull Completable

Returns:

the new Completable instance
concatMapCompletable
(@NonNull Function<? super T, ? extends CompletableSource>
a function that, when applied to the item emitted by the current Maybe, returns a Completable
mapper
)

Returns a Completable that completes based on applying a specified function to the item emitted by the current Maybe, where that function returns a Completable.

public final <
the result value type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
concatMapSingle
(@NonNull Function<? super T, ? extends SingleSource<? extends R>>
a function that, when applied to the item emitted by the current Maybe, returns a Single
mapper
)

Returns a Maybe based on applying a specified function to the item emitted by the current Maybe, where that function returns a Single.

public final @NonNull Flowable<T>

Returns:

the new Flowable instance
concatWith
(@NonNull MaybeSource<? extends T>
a MaybeSource to be concatenated after the current
other
)

Returns a Flowable that emits the items emitted from the current Maybe, then the other MaybeSource, one after the other, without interleaving them.

public final @NonNull Single<Boolean>

Returns:

the new Single instance
contains
(@NonNull Object
the item to search for in the emissions from the current Maybe, not null
item
)

Returns a Single that emits a Boolean that indicates whether the current Maybe emitted a specified item.

public final @NonNull Single<Long>

Returns:

the new Single instance
count
()

Returns a Single that counts the total number of items emitted (0 or 1) by the current Maybe and emits this count as a 64-bit Long.

public static <
the value type
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
create
(@NonNull MaybeOnSubscribe<T>
the emitter that is called when a MaybeObserver subscribes to the returned Maybe
onSubscribe
)

Provides an API (via a cold Maybe) that bridges the reactive world with the callback-style world.

public final @NonNull Single<T>

Returns:

the new Single instance
defaultIfEmpty
(T
the item to emit if the current Maybe emits no items
defaultItem
)

Returns a Single that emits the item emitted by the current Maybe or a specified default item if the current Maybe is empty.

public static <
the value type
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
defer
(@NonNull Supplier<? extends @NonNull MaybeSource<? extends T>>
the Supplier that is called for each individual MaybeObserver and returns a MaybeSource instance to subscribe to
supplier
)

Calls a Supplier for each individual MaybeObserver to return the actual MaybeSource source to be subscribed to.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
delay
(long
the delay to shift the source by
time
,
@NonNull TimeUnit
the TimeUnit in which time is defined
unit
)

Returns a Maybe that signals the events emitted by the current Maybe shifted forward in time by a specified delay.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
delay
(long
the delay to shift the source by
time
,
@NonNull TimeUnit
the TimeUnit in which time is defined
unit
,
boolean
if true, both success and error signals are delayed. if false, only success signals are delayed.
delayError
)

Returns a Maybe that signals the events emitted by the current Maybe shifted forward in time by a specified delay.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
delay
(long
the delay to shift the source by
time
,
@NonNull TimeUnit
the TimeUnit in which time is defined
unit
,
@NonNull Scheduler
the Scheduler to use for delaying
scheduler
)

Returns a Maybe that signals the events emitted by the current Maybe shifted forward in time by a specified delay.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
delay
(long
the delay to shift the source by
time
,
@NonNull TimeUnit
the TimeUnit in which time is defined
unit
,
@NonNull Scheduler
the Scheduler to use for delaying
scheduler
,
boolean
if true, both success and error signals are delayed. if false, only success signals are delayed.
delayError
)

Returns a Maybe that signals the events emitted by the current Maybe shifted forward in time by a specified delay running on the specified Scheduler.

public final <
the subscription delay value type (ignored)
U
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
delay
(@NonNull Publisher<U>
the Publisher that gets subscribed to when this Maybe signals an event and that signal is emitted when the Publisher signals an item or completes
delayIndicator
)

Delays the emission of this Maybe until the given Publisher signals an item or completes.

public final <
the value type of the other Publisher, irrelevant
U
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
delaySubscription
(@NonNull Publisher<U>
the other Publisher that should trigger the subscription to this Publisher.
subscriptionIndicator
)

Returns a Maybe that delays the subscription to this Maybe until the other Publisher emits an element or completes normally.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
delaySubscription
(long
the time to delay the subscription
time
,
@NonNull TimeUnit
the time unit of delay
unit
)

Returns a Maybe that delays the subscription to the current Maybe by a given amount of time.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
delaySubscription
(long
the time to delay the subscription
time
,
@NonNull TimeUnit
the time unit of delay
unit
,
@NonNull Scheduler
the Scheduler on which the waiting and subscription will happen
scheduler
)

Returns a Maybe that delays the subscription to the current Maybe by a given amount of time, both waiting and subscribing on a given Scheduler.

public final <
the result type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
dematerialize
(@NonNull Function<? super T, @NonNull Notification<R>>
the function called with the success item and should return a Notification instance.
selector
)

Maps the Notification success value of the current Maybe back into normal onSuccess, onError or onComplete signals.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
doAfterSuccess
(@NonNull Consumer<? super T>
the Consumer that will be called after emitting an item from upstream to the downstream
onAfterSuccess
)

Calls the specified Consumer with the success item after this item has been emitted to the downstream.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
doAfterTerminate
(@NonNull Action
an Action to be invoked when the current Maybe finishes
onAfterTerminate
)

Registers an Action to be called when this Maybe invokes either onSuccess, onComplete or onError.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
doFinally
(@NonNull Action
the action called when this Maybe terminates or gets disposed
onFinally
)

Calls the specified action after this Maybe signals onSuccess, onError or onComplete or gets disposed by the downstream.

public final @NonNull Maybe<T>

Returns:

the new Maybe with the side-effecting behavior applied
doOnComplete
(@NonNull Action
the action to invoke when the current Maybe calls onComplete
onComplete
)

Invokes an Action just before the current Maybe calls onComplete.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
doOnDispose
(@NonNull Action
the action called when the subscription is disposed
onDispose
)

Calls the shared Action if a MaybeObserver subscribed to the current Maybe disposes the common Disposable it received via onSubscribe.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
doOnError
(@NonNull Consumer<? super Throwable>
the consumer called with the success value of onError
onError
)

Calls the shared Consumer with the error sent via onError for each MaybeObserver that subscribes to the current Maybe.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
doOnEvent
(@NonNull BiConsumer<@Nullable ? super T, @Nullable ? super Throwable>
the callback to call with the success value or the exception, whichever is not null
onEvent
)

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.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
doOnLifecycle
(@NonNull Consumer<? super Disposable> onSubscribe, @NonNull Action
called when the downstream disposes the Disposable via dispose()
onDispose
)

Calls the appropriate onXXX method (shared between all MaybeObservers) for the lifecycle events of the sequence (subscription, disposal).

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
doOnSubscribe
(@NonNull Consumer<? super Disposable>
the Consumer called with the Disposable sent via onSubscribe
onSubscribe
)

Calls the shared Consumer with the Disposable sent through the onSubscribe for each MaybeObserver that subscribes to the current Maybe.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
doOnSuccess
(@NonNull Consumer<? super T>
the Consumer called with the success value of the upstream
onSuccess
)

Calls the shared Consumer with the success value sent via onSuccess for each MaybeObserver that subscribes to the current Maybe.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
doOnTerminate
(@NonNull Action
the action to invoke when the consumer calls onComplete or onError
onTerminate
)

Returns a Maybe instance that calls the given onTerminate callback just before this Maybe completes normally or with an exception.

public static <
the value type
T
>
@NonNull Maybe<T>

Returns:

the shared Maybe instance
empty
()

Returns a (singleton) Maybe instance that calls onComplete immediately.

public static <
the type of the item (ostensibly) emitted by the Maybe
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
error
(@NonNull Throwable
the particular Throwable to pass to onError
throwable
)

Returns a Maybe that invokes a subscriber's onError method when the subscriber subscribes to it.

public static <
the type of the items (ostensibly) emitted by the Maybe
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
error
(@NonNull Supplier<? extends @NonNull Throwable>
a Supplier factory to return a Throwable for each individual MaybeObserver
supplier
)

Returns a Maybe that invokes a MaybeObserver's onError method when the MaybeObserver subscribes to it.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
filter
(@NonNull Predicate<? super T>
a function that evaluates the item emitted by the current Maybe, returning true if it passes the filter
predicate
)

Filters the success item of the Maybe via a predicate function and emitting it if the predicate returns true, completing otherwise.

public final <
the result value type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
flatMap
(@NonNull Function<? super T, ? extends MaybeSource<? extends R>>
a function that, when applied to the item emitted by the current Maybe, returns a MaybeSource
mapper
)

Returns a Maybe that is based on applying a specified function to the item emitted by the current Maybe, where that function returns a MaybeSource.

public final <
the result type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
flatMap
(@NonNull Function<? super T, ? extends MaybeSource<? extends R>>
a function that returns a MaybeSource to merge for the onSuccess item emitted by this Maybe
onSuccessMapper
,
@NonNull Function<? super Throwable, ? extends MaybeSource<? extends R>>
a function that returns a MaybeSource to merge for an onError notification from this Maybe
onErrorMapper
,
@NonNull Supplier<? extends MaybeSource<? extends R>>
a function that returns a MaybeSource to merge for an onComplete notification this Maybe
onCompleteSupplier
)

Maps the onSuccess, onError or onComplete signals of the current Maybe into a MaybeSource and emits that MaybeSource's signals.

public final <
the type of items emitted by the MaybeSource returned by the mapper function
U
,
the type of items emitted by the resulting Maybe
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
flatMap
(@NonNull Function<? super T, ? extends MaybeSource<? extends U>>
a function that returns a MaybeSource for the item emitted by the current Maybe
mapper
,
@NonNull BiFunction<? super T, ? super U, ? extends R>
a function that combines one item emitted by each of the source and collection MaybeSource and returns an item to be emitted by the resulting MaybeSource
combiner
)

Returns a Maybe that emits the results of a specified function to the pair of values emitted by the current Maybe and a specified mapped MaybeSource.

public final @NonNull Completable

Returns:

the new Completable instance
flatMapCompletable
(@NonNull Function<? super T, ? extends CompletableSource>
a function that, when applied to the item emitted by the current Maybe, returns a Completable
mapper
)

Returns a Completable that completes based on applying a specified function to the item emitted by the current Maybe, where that function returns a Completable.

public final <
the result value type
R
>
@NonNull Observable<R>

Returns:

the new Observable instance
flatMapObservable
(@NonNull Function<? super T, ? extends ObservableSource<? extends R>>
a function that, when applied to the item emitted by the current Maybe, returns an ObservableSource
mapper
)

Returns an Observable that is based on applying a specified function to the item emitted by the current Maybe, where that function returns an ObservableSource.

public final <
the result value type
R
>
@NonNull Flowable<R>

Returns:

the new Flowable instance
flatMapPublisher
(@NonNull Function<? super T, @NonNull ? extends Publisher<? extends R>>
a function that, when applied to the item emitted by the current Maybe, returns a Flowable
mapper
)

Returns a Flowable that emits items based on applying a specified function to the item emitted by the current Maybe, where that function returns a Publisher.

public final <
the result value type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
flatMapSingle
(@NonNull Function<? super T, ? extends SingleSource<? extends R>>
a function that, when applied to the item emitted by the current Maybe, returns a Single
mapper
)

Returns a Maybe based on applying a specified function to the item emitted by the current Maybe, where that function returns a Single.

public final <
the type of item emitted by the inner Iterable
U
>
@NonNull Flowable<U>

Returns:

the new Flowable instance
flattenAsFlowable
(@NonNull Function<? super T, @NonNull ? extends Iterable<? extends U>>
a function that returns an Iterable sequence of values for when given an item emitted by the current Maybe
mapper
)

Maps the success value of the current Maybe into an Iterable and emits its items as a Flowable sequence.

public final <
the type of item emitted by the resulting Iterable
U
>
@NonNull Observable<U>

Returns:

the new Observable instance
flattenAsObservable
(@NonNull Function<? super T, @NonNull ? extends Iterable<? extends U>>
a function that returns an Iterable sequence of values for when given an item emitted by the current Maybe
mapper
)

Maps the success value of the current Maybe into an Iterable and emits its items as an Observable sequence.

public final <
the element type of the Stream and the output Flowable
R
>
@NonNull Flowable<R>

Returns:

the new Flowable instance
flattenStreamAsFlowable
(@NonNull Function<? super T, @NonNull ? extends Stream<? extends R>>
the function that receives the upstream success item and should return a Stream of values to emit.
mapper
)

Maps the upstream succecss value into a Java Stream and emits its items to the downstream consumer as a Flowable.

public final <
the element type of the Stream and the output Observable
R
>
@NonNull Observable<R>

Returns:

the new Observable instance
flattenStreamAsObservable
(@NonNull Function<? super T, @NonNull ? extends Stream<? extends R>>
the function that receives the upstream success item and should return a Stream of values to emit.
mapper
)

Maps the upstream succecss value into a Java Stream and emits its items to the downstream consumer as an Observable.

public static <
the target type
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
fromAction
(@NonNull Action
the Action to run for each MaybeObserver
action
)

Returns a Maybe instance that runs the given Action for each MaybeObserver and emits either its exception or simply completes.

public static <
the type of the item emitted by the Maybe.
T
>
@NonNull Maybe<@NonNull T>

Returns:

the new Maybe instance
fromCallable
(@NonNull Callable<? extends @Nullable T>
a Callable instance whose execution should be deferred and performed for each individual MaybeObserver that subscribes to the returned Maybe.
callable
)

Returns a Maybe that invokes the given Callable for each individual MaybeObserver that subscribes and emits the resulting non-null item via onSuccess while considering a null result from the Callable as indication for valueless completion via onComplete.

public static <
the target type
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
fromCompletable
(@NonNull CompletableSource
the CompletableSource to convert from
completableSource
)

Wraps a CompletableSource into a Maybe.

public static <
the element type of the CompletionStage
T
>
@NonNull Maybe<@NonNull T>

Returns:

the new Maybe instance
fromCompletionStage
(@NonNull CompletionStage<T>
the CompletionStage to convert to Maybe and signal its terminal value or error
stage
)

Signals the completion value or error of the given (hot) CompletionStage-based asynchronous calculation.

public static <
the type of object that the Future returns, and also the type of item to be emitted by the resulting Maybe
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
fromFuture
(@NonNull Future<? extends T>
the source Future
future
)

Converts a Future into a Maybe, treating a null result as an indication of emptiness.

public static <
the type of object that the Future returns, and also the type of item to be emitted by the resulting Maybe
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
fromFuture
(@NonNull Future<? extends T>
the source Future
future
,
long
the maximum time to wait before calling get
timeout
,
@NonNull TimeUnit
the TimeUnit of the timeout argument
unit
)

Converts a Future into a Maybe, with a timeout on the Future.

public static <
the target type
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
fromObservable
(@NonNull ObservableSource<T>
the ObservableSource to convert from
source
)

Wraps an ObservableSource into a Maybe and emits the very first item or completes if the source is empty.

public static <
the element type of the optional value
T
>
@NonNull Maybe<@NonNull T>

Returns:

the new Maybe instance
fromOptional
(@NonNull Optional<T>
the optional value to convert into a Maybe
optional
)

Converts the existing value of the provided optional into a just(Object) or an empty optional into an empty() Maybe instance.

public static <
the target type
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
fromPublisher
(@NonNull Publisher<T>
the Publisher to convert from
source
)

Wraps a Publisher into a Maybe and emits the very first item or completes if the source is empty.

public static <
the target type
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
fromRunnable
(@NonNull Runnable
the Runnable to run for each MaybeObserver
run
)

Returns a Maybe instance that runs the given Runnable for each MaybeObserver and emits either its unchecked exception or simply completes.

public static <
the target type
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
fromSingle
(@NonNull SingleSource<T>
the SingleSource to convert from
single
)

Wraps a SingleSource into a Maybe.

public static <
the type of the item emitted by the Maybe.
T
>
@NonNull Maybe<@NonNull T>

Returns:

the new Maybe instance
fromSupplier
(@NonNull Supplier<? extends @Nullable T>
a Supplier instance whose execution should be deferred and performed for each individual MaybeObserver that subscribes to the returned Maybe.
supplier
)

Returns a Maybe that invokes the given Supplier for each individual MaybeObserver that subscribes and emits the resulting non-null item via onSuccess while considering a null result from the Supplier as indication for valueless completion via onComplete.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
hide
()

Hides the identity of this Maybe and its Disposable.

public final @NonNull Completable

Returns:

the new Completable instance
ignoreElement
()

Returns a Completable that ignores the item emitted by the current Maybe and only calls onComplete or onError.

public final @NonNull Single<Boolean>

Returns:

the new Single instance
isEmpty
()

Returns a Single that emits true if the current Maybe is empty, otherwise false.

public static <
the type of that item
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
just
(T
the item to emit
item
)

Returns a Maybe that emits a specified item.

public final <
the output value type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
lift
(@NonNull MaybeOperator<? extends R, ? super T>
the MaybeOperator that receives the downstream's MaybeObserver and should return a MaybeObserver with custom behavior to be used as the consumer for the current Maybe.
lift
)

This method requires advanced knowledge about building operators, please consider other standard composition methods first; Returns a Maybe which, when subscribed to, invokes the apply(MaybeObserver) method of the provided MaybeOperator for each individual downstream Maybe and allows the insertion of a custom operator by accessing the downstream's MaybeObserver during this subscription phase and providing a new MaybeObserver, containing the custom operator's intended business logic, that will be used in the subscription process going further upstream.

public final <
the result value type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
map
(@NonNull Function<? super T, ? extends R>
a function to apply to the item emitted by the Maybe
mapper
)

Returns a Maybe that applies a specified function to the item emitted by the current Maybe and emits the result of this function application.

public final <
the non-null output type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
mapOptional
(@NonNull Function<? super T, @NonNull Optional<? extends R>>
the function that receives the upstream success item and should return a non-empty Optional to emit as the success output or an empty Optional to complete the Maybe
mapper
)

Maps the upstream success value into an Optional and emits the contained item if not empty.

public final @NonNull Single<Notification<T>>

Returns:

the new Single instance
materialize
()

Maps the signal types of this Maybe into a Notification of the same kind and emits it as a Single's onSuccess value to downstream.

public static <
the common and resulting value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
merge
(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends T>>
the Iterable sequence of MaybeSource sources
sources
)

Merges an Iterable sequence of MaybeSource instances into a single Flowable sequence, running all MaybeSources at once.

public static <
the common and resulting value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
merge
(@NonNull Publisher<@NonNull ? extends MaybeSource<? extends T>>
the Flowable sequence of MaybeSource sources
sources
)

Merges a Publisher sequence of MaybeSource instances into a single Flowable sequence, running all MaybeSources at once.

public static <
the common and resulting value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
merge
(@NonNull Publisher<@NonNull ? extends MaybeSource<? extends T>>
the Flowable sequence of MaybeSource sources
sources
,
int
the maximum number of concurrently running MaybeSources
maxConcurrency
)

Merges a Publisher sequence of MaybeSource instances into a single Flowable sequence, running at most maxConcurrency MaybeSources at once.

public static <
the value type of the sources and the output
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
merge
(@NonNull MaybeSource<? extends MaybeSource<? extends T>>
a MaybeSource that emits a MaybeSource
source
)

Flattens a MaybeSource that emits a MaybeSource into a single MaybeSource that emits the item emitted by the nested MaybeSource, without any transformation.

public static <
the common value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
merge
(@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source1
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source2
)

Flattens two MaybeSources into a single Flowable, without any transformation.

public static <
the common value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
merge
(@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source1
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source2
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source3
)

Flattens three MaybeSources into a single Flowable, without any transformation.

public static <
the common value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
merge
(@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source1
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source2
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source3
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source4
)

Flattens four MaybeSources into a single Flowable, without any transformation.

public static <
the common and resulting value type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
mergeArray
(MaybeSource<? extends T>...
the array sequence of MaybeSource sources
sources
)

Merges an array of MaybeSource instances into a single Flowable sequence, running all MaybeSources at once.

public static <
the common element base type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
mergeArrayDelayError
(@NonNull MaybeSource<? extends T>...
the array of MaybeSources
sources
)

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.

public static <
the common element base type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
mergeDelayError
(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends T>>
the Iterable of MaybeSources
sources
)

Flattens an Iterable sequence 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.

public static <
the common element base type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
mergeDelayError
(@NonNull Publisher<@NonNull ? extends MaybeSource<? extends T>>
a Publisher that emits MaybeSources
sources
)

Flattens a Publisher that emits MaybeSources into one Flowable, in a way that allows a subscriber to receive all successfully emitted items from all of the source MaybeSources without being interrupted by an error notification from one of them or even the main Publisher.

public static <
the common element base type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
mergeDelayError
(@NonNull Publisher<@NonNull ? extends MaybeSource<? extends T>>
a Publisher that emits MaybeSources
sources
,
int
the maximum number of active inner MaybeSources to be merged at a time
maxConcurrency
)

Flattens a Publisher that emits MaybeSources into one Flowable, in a way that allows a subscriber to receive all successfully emitted items from all of the source MaybeSources without being interrupted by an error notification from one of them or even the main Publisher as well as limiting the total number of active MaybeSources.

public static <
the common element base type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
mergeDelayError
(@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source1
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source2
)

Flattens two 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.

public static <
the common element base type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
mergeDelayError
(@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source1
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source2
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source3
)

Flattens three MaybeSource into one Flowable, in a way that allows a subscriber to receive all successfully emitted items from all of the source MaybeSources without being interrupted by an error notification from one of them.

public static <
the common element base type
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
mergeDelayError
(@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source1
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source2
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source3
,
@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
source4
)

Flattens four MaybeSources into one Flowable, in a way that allows a subscriber to receive all successfully emitted items from all of the source MaybeSources without being interrupted by an error notification from one of them.

public final @NonNull Flowable<T>

Returns:

the new Flowable instance
mergeWith
(@NonNull MaybeSource<? extends T>
a MaybeSource to be merged
other
)

Flattens this Maybe and another MaybeSource into a single Flowable, without any transformation.

public static <
the type of items (not) emitted by the Maybe
T
>
@NonNull Maybe<T>

Returns:

the shared Maybe instance
never
()

Returns a Maybe that never sends any items or notifications to a MaybeObserver.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance that its subscribers are notified on the specified Scheduler
observeOn
(@NonNull Scheduler
the Scheduler to notify subscribers on
scheduler
)

Wraps a Maybe to emit its item (or notify of its error) on a specified Scheduler, asynchronously.

public final <
the output type
U
>
@NonNull Maybe<U>

Returns:

the new Maybe instance
ofType
(@NonNull Class<U>
the class type to filter the items emitted by the current Maybe
clazz
)

Filters the items emitted by the current Maybe, only emitting its success value if that is an instance of the supplied Class.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
onErrorComplete
()

Returns a Maybe instance that if this Maybe emits an error, it will emit an onComplete and swallow the throwable.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
onErrorComplete
(@NonNull Predicate<? super Throwable>
the predicate to call when an Throwable is emitted which should return true if the Throwable should be swallowed and replaced with an onComplete.
predicate
)

Returns a Maybe instance that if this Maybe emits an error and the predicate returns true, it will emit an onComplete and swallow the throwable.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
onErrorResumeNext
(@NonNull Function<? super Throwable, ? extends MaybeSource<? extends T>>
a function that returns a MaybeSource that will take over if the current Maybe encounters an error
fallbackSupplier
)

Resumes the flow with a MaybeSource returned for the failure Throwable of the current Maybe by a function instead of signaling the error via onError.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
onErrorResumeWith
(@NonNull MaybeSource<? extends T>
the next MaybeSource that will take over if the current Maybe encounters an error
fallback
)

Resumes the flow with the given MaybeSource when the current Maybe fails instead of signaling the error via onError.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
onErrorReturn
(@NonNull Function<? super Throwable, ? extends T>
a function that returns a single value that will be emitted as success value the current Maybe signals an onError event
itemSupplier
)

Ends the flow with a success item returned by a function for the Throwable error signaled by the current Maybe instead of signaling the error via onError.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
onErrorReturnItem
(T
the value that is emitted as onSuccess in case the current Maybe signals an onError
item
)

Ends the flow with the given success item when the current Maybe fails instead of signaling the error via onError.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance the sequence is terminated or downstream calls dispose()
onTerminateDetach
()

Nulls out references to the upstream producer and downstream MaybeObserver if the sequence is terminated or downstream calls dispose().

public final @NonNull Flowable<T>

Returns:

the new Flowable instance
repeat
()

Returns a Flowable that repeats the sequence of items emitted by the current Maybe indefinitely.

public final @NonNull Flowable<T>

Returns:

the new Flowable instance
repeat
(long
the number of times the current Maybe items are repeated, a count of 0 will yield an empty sequence
times
)

Returns a Flowable that repeats the sequence of items emitted by the current Maybe at most count times.

public final @NonNull Flowable<T>

Returns:

the new Flowable instance
repeatUntil
(@NonNull BooleanSupplier
a boolean supplier that is called when the current Flowable completes and unless it returns false, the current Flowable is resubscribed
stop
)

Returns a Flowable that repeats the sequence of items emitted by the current Maybe until the provided stop function returns true.

public final @NonNull Flowable<T>

Returns:

the new Flowable instance
repeatWhen
(@NonNull Function<? super Flowable<Object>, @NonNull ? extends Publisher<@NonNull ?>>
receives a Publisher of notifications with which a user can complete or error, aborting the repeat.
handler
)

Returns a Flowable that emits the same values as the current Maybe with the exception of an onComplete.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
retry
()

Returns a Maybe that mirrors the current Maybe, resubscribing to it if it calls onError (infinite retry count).

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
retry
(@NonNull BiPredicate<? super Integer, ? super Throwable>
the predicate that determines if a resubscription may happen in case of a specific exception and retry count
predicate
)

Returns a Maybe that mirrors the current Maybe, resubscribing to it if it calls onError and the predicate returns true for that specific exception and retry count.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
retry
(long
the number of times to resubscribe if the current Maybe fails
times
)

Returns a Maybe that mirrors the current Maybe, resubscribing to it if it calls onError up to a specified number of retries.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
retry
(long
the number of times to resubscribe if the current Maybe fails
times
,
@NonNull Predicate<? super Throwable>
the predicate called with the failure Throwable and should return true to trigger a retry.
predicate
)

Retries at most times or until the predicate returns false, whichever happens first.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
retry
(@NonNull Predicate<? super Throwable>
the predicate that receives the failure Throwable and should return true to trigger a retry.
predicate
)

Retries the current Maybe if it fails and the predicate returns true.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
retryUntil
(@NonNull BooleanSupplier
the function that should return true to stop retrying
stop
)

Retries until the given stop function returns true.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
retryWhen
(@NonNull Function<? super Flowable<Throwable>, @NonNull ? extends Publisher<@NonNull ?>>
receives a Publisher of notifications with which a user can complete or error, aborting the retry
handler
)

Returns a Maybe that emits the same values as the current Maybe with the exception of an onError.

public final void
safeSubscribe(@NonNull MaybeObserver<? super T>
the potentially misbehaving MaybeObserver
observer
)

Wraps the given MaybeObserver, catches any RuntimeExceptions thrown by its MaybeObserver#onSubscribe(Disposable), MaybeObserver#onSuccess(Object), MaybeObserver#onError(Throwable) or MaybeObserver#onComplete() methods and routes those to the global error handler via RxJavaPlugins#onError(Throwable).

public static <
the type of items emitted by each MaybeSource
T
>
@NonNull Single<Boolean>

Returns:

the new Single instance
sequenceEqual
(@NonNull MaybeSource<? extends T>
the first MaybeSource to compare
source1
,
@NonNull MaybeSource<? extends T>
the second MaybeSource to compare
source2
)

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.

public static <
the type of items emitted by each MaybeSource
T
>
@NonNull Single<Boolean>

Returns:

the new Single instance
sequenceEqual
(@NonNull MaybeSource<? extends T>
the first MaybeSource to compare
source1
,
@NonNull MaybeSource<? extends T>
the second MaybeSource to compare
source2
,
@NonNull BiPredicate<? super T, ? super T>
a function used to compare items emitted by each MaybeSource
isEqual
)

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.

public final @NonNull Flowable<T>

Returns:

the new Flowable instance
startWith
(@NonNull CompletableSource
the other CompletableSource to run first
other
)

Returns a Flowable which first runs the other CompletableSource then the current Maybe if the other completed normally.

public final @NonNull Flowable<T>

Returns:

the new Flowable instance
startWith
(@NonNull SingleSource<T>
the other SingleSource to run first
other
)

Returns a Flowable which first runs the other SingleSource then the current Maybe if the other succeeded normally.

public final @NonNull Flowable<T>

Returns:

the new Flowable instance
startWith
(@NonNull MaybeSource<T>
the other MaybeSource to run first
other
)

Returns a Flowable which first runs the other MaybeSource then the current Maybe if the other succeeded or completed normally.

public final @NonNull Observable<T>

Returns:

the new Observable instance
startWith
(@NonNull ObservableSource<T>
the other ObservableSource to run first
other
)

Returns an Observable which first delivers the events of the other ObservableSource then runs the current Maybe.

public final @NonNull Flowable<T>

Returns:

the new Flowable instance
startWith
(@NonNull Publisher<T>
the other Publisher to run first
other
)

Returns a Flowable which first delivers the events of the other Publisher then runs the current Maybe.

public final @NonNull Disposable

Returns:

the new Disposable instance that can be used for disposing the subscription at any time
subscribe
()

Subscribes to a Maybe and ignores onSuccess and onComplete emissions.

public final @NonNull Disposable

Returns:

the new Disposable instance that can be used for disposing the subscription at any time
subscribe
(@NonNull Consumer<? super T>
the Consumer<T> you have designed to accept a success value from the Maybe
onSuccess
)

Subscribes to a Maybe and provides a callback to handle the items it emits.

public final @NonNull Disposable

Returns:

the new Disposable instance that can be used for disposing the subscription at any time
subscribe
(@NonNull Consumer<? super T>
the Consumer<T> you have designed to accept a success value from the Maybe
onSuccess
,
@NonNull Consumer<? super Throwable>
the Consumer<Throwable> you have designed to accept any error notification from the Maybe
onError
)

Subscribes to a Maybe and provides callbacks to handle the items it emits and any error notification it issues.

public final @NonNull Disposable

Returns:

the new Disposable instance that can be used for disposing the subscription at any time
subscribe
(@NonNull Consumer<? super T>
the Consumer<T> you have designed to accept a success value from the Maybe
onSuccess
,
@NonNull Consumer<? super Throwable>
the Consumer<Throwable> you have designed to accept any error notification from the Maybe
onError
,
@NonNull Action
the Action you have designed to accept a completion notification from the Maybe
onComplete
)

Subscribes to a Maybe and provides callbacks to handle the items it emits and any error or completion notification it issues.

public final @NonNull Disposable

Returns:

the Disposable that allows disposing the particular subscription.
subscribe
(@NonNull Consumer<? super T>
the callback for upstream items
onSuccess
,
@NonNull Consumer<? super Throwable>
the callback for an upstream error
onError
,
@NonNull Action
the callback for an upstream completion without any value or error
onComplete
,
@NonNull DisposableContainer
the DisposableContainer (such as CompositeDisposable) to add and remove the created Disposable MaybeObserver
container
)

Wraps the given onXXX callbacks into a Disposable MaybeObserver, adds it to the given DisposableContainer and ensures, that if the upstream terminates or this particular Disposable is disposed, the MaybeObserver is removed from the given composite.

public final void
subscribe(@NonNull MaybeObserver<? super T> observer)

protected abstract void
subscribeActual(@NonNull MaybeObserver<? super T>
the MaybeObserver to handle, not null
observer
)

Implement this method in subclasses to handle the incoming MaybeObservers.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
subscribeOn
(@NonNull Scheduler
the Scheduler to perform subscription actions on
scheduler
)

Asynchronously subscribes subscribers to this Maybe on the specified Scheduler.

public final <
the type of the MaybeObserver to use and return
E extends MaybeObserver<? super T>
>
E

Returns:

the input observer
subscribeWith
(E
the MaybeObserver (subclass) to use and return, not null
observer
)

Subscribes a given MaybeObserver (subclass) to this Maybe and returns the given MaybeObserver as is.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
switchIfEmpty
(@NonNull MaybeSource<? extends T>
the alternate MaybeSource to subscribe to if the main does not emit any items
other
)

Returns a Maybe that emits the items emitted by the current Maybe or the items of an alternate MaybeSource if the current Maybe is empty.

public final @NonNull Single<T>

Returns:

the new Single instance
switchIfEmpty
(@NonNull SingleSource<? extends T>
the alternate SingleSource to subscribe to if the main does not emit any items
other
)

Returns a Single that emits the items emitted by the current Maybe or the item of an alternate SingleSource if the current Maybe is empty.

public static <
the element type of the MaybeSources
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
switchOnNext
(@NonNull Publisher<@NonNull ? extends MaybeSource<? extends T>>
the Publisher sequence of inner MaybeSources to switch between
sources
)

Switches between MaybeSources emitted by the source Publisher whenever a new MaybeSource is emitted, disposing the previously running MaybeSource, exposing the success items as a Flowable sequence.

public static <
the element type of the MaybeSources
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
switchOnNextDelayError
(@NonNull Publisher<@NonNull ? extends MaybeSource<? extends T>>
the Publisher sequence of inner MaybeSources to switch between
sources
)

Switches between MaybeSources emitted by the source Publisher whenever a new MaybeSource is emitted, disposing the previously running MaybeSource, exposing the success items as a Flowable sequence and delaying all errors from all of them until all terminate.

public final <
the type of items emitted by other
U
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
takeUntil
(@NonNull MaybeSource<U>
the MaybeSource whose first emitted item will cause takeUntil to stop emitting items from the current Maybe
other
)

Returns a Maybe that emits the items emitted by the current Maybe until a second MaybeSource emits an item.

public final <
the type of items emitted by other
U
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
takeUntil
(@NonNull Publisher<U>
the Publisher whose first emitted item will cause takeUntil to stop emitting items from the source Publisher
other
)

Returns a Maybe that emits the item emitted by the current Maybe until a second Publisher emits an item.

public final @NonNull TestObserver<T>

Returns:

the new TestObserver instance
test
()

Creates a TestObserver and subscribes it to this Maybe.

public final @NonNull TestObserver<T>

Returns:

the new TestObserver instance
test
(boolean
if true, the TestObserver will be disposed before subscribing to this Maybe.
dispose
)

Creates a TestObserver optionally in cancelled state, then subscribes it to this Maybe.

public final @NonNull Maybe<Timed<T>>

Returns:

the new Maybe instance
timeInterval
()

Measures the time (in milliseconds) between the subscription and success item emission of the current Maybe and signals it as a tuple (Timed) success value.

public final @NonNull Maybe<Timed<T>>

Returns:

the new Maybe instance
timeInterval
(@NonNull Scheduler
the Scheduler used for providing the current time
scheduler
)

Measures the time (in milliseconds) between the subscription and success item emission of the current Maybe and signals it as a tuple (Timed) success value.

public final @NonNull Maybe<Timed<T>>

Returns:

the new Maybe instance
timeInterval
(@NonNull TimeUnit
the time unit for measurement
unit
)

Measures the time between the subscription and success item emission of the current Maybe and signals it as a tuple (Timed) success value.

public final @NonNull Maybe<Timed<T>>

Returns:

the new Maybe instance
timeInterval
(@NonNull TimeUnit
the time unit for measurement
unit
,
@NonNull Scheduler
the Scheduler used for providing the current time
scheduler
)

Measures the time between the subscription and success item emission of the current Maybe and signals it as a tuple (Timed) success value.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
timeout
(long
maximum duration between emitted items before a timeout occurs
timeout
,
@NonNull TimeUnit
the unit of time that applies to the timeout argument.
unit
)

Returns a Maybe that mirrors the current Maybe but applies a timeout policy for each emitted item.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
timeout
(long
maximum duration between items before a timeout occurs
timeout
,
@NonNull TimeUnit
the unit of time that applies to the timeout argument
unit
,
@NonNull MaybeSource<? extends T>
the fallback MaybeSource to use in case of a timeout
fallback
)

Returns a Maybe that mirrors the current Maybe but applies a timeout policy for each emitted item.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
timeout
(long
maximum duration between items before a timeout occurs
timeout
,
@NonNull TimeUnit
the unit of time that applies to the timeout argument
unit
,
@NonNull Scheduler
the Scheduler to run the timeout timers on
scheduler
,
@NonNull MaybeSource<? extends T>
the MaybeSource to use as the fallback in case of a timeout
fallback
)

Returns a Maybe that mirrors the current Maybe but applies a timeout policy for each emitted item using a specified Scheduler.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
timeout
(long
maximum duration between items before a timeout occurs
timeout
,
@NonNull TimeUnit
the unit of time that applies to the timeout argument
unit
,
@NonNull Scheduler
the Scheduler to run the timeout timers on
scheduler
)

Returns a Maybe that mirrors the current Maybe but applies a timeout policy for each emitted item, where this policy is governed on a specified Scheduler.

public final <
the value type of the
U
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
timeout
(@NonNull MaybeSource<U>
the MaybeSource that indicates the timeout by signaling onSuccess or onComplete.
timeoutIndicator
)

If the current Maybe didn't signal an event before the timeoutIndicator MaybeSource signals, a TimeoutException is signaled instead.

public final <
the value type of the
U
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
timeout
(@NonNull MaybeSource<U>
the MaybeSource that indicates the timeout by signaling onSuccess or onComplete.
timeoutIndicator
,
@NonNull MaybeSource<? extends T>
the MaybeSource that is subscribed to if the current Maybe times out
fallback
)

If the current Maybe didn't signal an event before the timeoutIndicator MaybeSource signals, the current Maybe is disposed and the fallback MaybeSource subscribed to as a continuation.

public final <
the value type of the
U
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
timeout
(@NonNull Publisher<U>
the Publisher that indicates the timeout by signaling onSuccess or onComplete.
timeoutIndicator
)

If the current Maybe source didn't signal an event before the timeoutIndicator Publisher signals, a TimeoutException is signaled instead.

public final <
the value type of the
U
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
timeout
(@NonNull Publisher<U>
the MaybeSource that indicates the timeout by signaling onSuccess or onComplete
timeoutIndicator
,
@NonNull MaybeSource<? extends T>
the MaybeSource that is subscribed to if the current Maybe times out
fallback
)

If the current Maybe didn't signal an event before the timeoutIndicator Publisher signals, the current Maybe is disposed and the fallback MaybeSource subscribed to as a continuation.

public static @NonNull Maybe<Long>

Returns:

the new Maybe instance
timer
(long
the initial delay before emitting a single 0L
delay
,
@NonNull TimeUnit
time units to use for delay
unit
)

Returns a Maybe that emits 0L after a specified delay.

public static @NonNull Maybe<Long>

Returns:

the new Maybe instance
timer
(long
the initial delay before emitting a single 0L
delay
,
@NonNull TimeUnit
time units to use for delay
unit
,
@NonNull Scheduler
the Scheduler to use for scheduling the item
scheduler
)

Returns a Maybe that emits 0L after a specified delay on a specified Scheduler.

public final @NonNull Maybe<Timed<T>>

Returns:

the new Maybe instance
timestamp
()

Combines the success value from the current Maybe with the current time (in milliseconds) of its reception, using the computation Scheduler as time source, then signals them as a Timed instance.

public final @NonNull Maybe<Timed<T>>

Returns:

the new Maybe instance
timestamp
(@NonNull Scheduler
the Scheduler used for providing the current time
scheduler
)

Combines the success value from the current Maybe with the current time (in milliseconds) of its reception, using the given Scheduler as time source, then signals them as a Timed instance.

public final @NonNull Maybe<Timed<T>>

Returns:

the new Maybe instance
timestamp
(@NonNull TimeUnit
the time unit for measurement
unit
)

Combines the success value from the current Maybe with the current time of its reception, using the computation Scheduler as time source, then signals it as a Timed instance.

public final @NonNull Maybe<Timed<T>>

Returns:

the new Maybe instance
timestamp
(@NonNull TimeUnit
the time unit for measurement
unit
,
@NonNull Scheduler
the Scheduler used for providing the current time
scheduler
)

Combines the success value from the current Maybe with the current time of its reception, using the given Scheduler as time source, then signals it as a Timed instance.

public final <
the resulting object type
R
>
R

Returns:

the converted value
to
(@NonNull MaybeConverter<T, ? extends R>
the function that receives the current Maybe instance and returns a value
converter
)

Calls the specified converter function during assembly time and returns its resulting value.

public final @NonNull CompletionStage<T>

Returns:

the new CompletionStage instance
toCompletionStage
()

Signals the upstream success item (or a NoSuchElementException if the upstream is empty) via a CompletionStage.

public final @NonNull CompletionStage<T>

Returns:

the new CompletionStage instance
toCompletionStage
(T
the item to signal if the upstream is empty
defaultItem
)

Signals the upstream success item (or the default item if the upstream is empty) via a CompletionStage.

public final @NonNull Flowable<T>

Returns:

the new Flowable instance
toFlowable
()

Converts this Maybe into a backpressure-aware Flowable instance composing cancellation through.

public final @NonNull Future<T>

Returns:

the new Future instance
toFuture
()

Returns a Future representing the single value emitted by the current Maybe or null if the current Maybe is empty.

public final @NonNull Observable<T>

Returns:

the new Observable instance
toObservable
()

Converts this Maybe into an Observable instance composing disposal through.

public final @NonNull Single<T>

Returns:

the new Single instance
toSingle
()

Converts this Maybe into a Single instance composing disposal through and turning an empty Maybe into a signal of NoSuchElementException.

public static <
the value type
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
unsafeCreate
(@NonNull MaybeSource<T>
the function that is called with the subscribing MaybeObserver
onSubscribe
)

Advanced use only: creates a Maybe instance without any safeguards by using a callback that is called with a MaybeObserver.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
unsubscribeOn
(@NonNull Scheduler
the target scheduler where to execute the disposal
scheduler
)

Returns a Maybe which makes sure when a MaybeObserver disposes the Disposable, that call is propagated up on the specified Scheduler.

public static <
the element type of the generated MaybeSource
T
,
the type of the resource associated with the output sequence
D
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
using
(@NonNull Supplier<? extends D>
the factory function to create a resource object that depends on the Maybe
resourceSupplier
,
@NonNull Function<? super D, ? extends MaybeSource<? extends T>>
the factory function to create a MaybeSource
sourceSupplier
,
@NonNull Consumer<? super D>
the function that will dispose of the resource
resourceCleanup
)

Constructs a Maybe that creates a dependent resource object which is disposed of when the generated MaybeSource terminates or the downstream calls dispose().

public static <
the element type of the generated MaybeSource
T
,
the type of the resource associated with the output sequence
D
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
using
(@NonNull Supplier<? extends D>
the factory function to create a resource object that depends on the Maybe
resourceSupplier
,
@NonNull Function<? super D, ? extends MaybeSource<? extends T>>
the factory function to create a MaybeSource
sourceSupplier
,
@NonNull Consumer<? super D>
the function that will dispose of the resource
resourceCleanup
,
boolean
If true then resource disposal will happen either on a dispose() call before the upstream is disposed or just before the emission of a terminal event (onSuccess, onComplete or onError). If false the resource disposal will happen either on a dispose() call after the upstream is disposed or just after the emission of a terminal event (onSuccess, onComplete or onError).
eager
)

Constructs a Maybe that creates a dependent resource object which is disposed first ({code eager == true}) when the generated MaybeSource terminates or the downstream disposes; or after ({code eager == false}).

public static <
the value type
T
>
@NonNull Maybe<T>

Returns:

the new wrapped or cast Maybe instance
wrap
(@NonNull MaybeSource<T>
the source to wrap
source
)

Wraps a MaybeSource instance into a new Maybe instance if not already a Maybe instance.

public static <
the common value type
T
,
the zipped result type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
zip
(@NonNull Iterable<@NonNull ? extends MaybeSource<? extends T>>
an Iterable of source MaybeSources
sources
,
@NonNull Function<? super Object[], ? extends R>
a function that, when applied to an item emitted by each of the source MaybeSources, results in an item that will be emitted by the resulting Maybe
zipper
)

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.

public static <
the value type of the first source
T1
,
the value type of the second source
T2
,
the zipped result type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
zip
(@NonNull MaybeSource<? extends T1>
the first source MaybeSource
source1
,
@NonNull MaybeSource<? extends T2>
a second source MaybeSource
source2
,
@NonNull BiFunction<? super T1, ? super T2, ? extends R>
a function that, when applied to an item emitted by each of the source MaybeSources, results in an item that will be emitted by the resulting Maybe
zipper
)

Returns a Maybe that emits the results of a specified combiner function applied to combinations of two items emitted, in sequence, by two other MaybeSources.

public static <
the value type of the first source
T1
,
the value type of the second source
T2
,
the value type of the third source
T3
,
the zipped result type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
zip
(@NonNull MaybeSource<? extends T1>
the first source MaybeSource
source1
,
@NonNull MaybeSource<? extends T2>
a second source MaybeSource
source2
,
@NonNull MaybeSource<? extends T3>
a third source MaybeSource
source3
,
@NonNull Function3<? super T1, ? super T2, ? super T3, ? extends R>
a function that, when applied to an item emitted by each of the source MaybeSources, results in an item that will be emitted by the resulting Maybe
zipper
)

Returns a Maybe that emits the results of a specified combiner function applied to combinations of three items emitted, in sequence, by three other MaybeSources.

public static <
the value type of the first source
T1
,
the value type of the second source
T2
,
the value type of the third source
T3
,
the value type of the fourth source
T4
,
the zipped result type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
zip
(@NonNull MaybeSource<? extends T1>
the first source MaybeSource
source1
,
@NonNull MaybeSource<? extends T2>
a second source MaybeSource
source2
,
@NonNull MaybeSource<? extends T3>
a third source MaybeSource
source3
,
@NonNull MaybeSource<? extends T4>
a fourth source MaybeSource
source4
,
@NonNull Function4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R>
a function that, when applied to an item emitted by each of the source MaybeSources, results in an item that will be emitted by the resulting Maybe
zipper
)

Returns a Maybe that emits the results of a specified combiner function applied to combinations of four items emitted, in sequence, by four other MaybeSources.

public static <
the value type of the first source
T1
,
the value type of the second source
T2
,
the value type of the third source
T3
,
the value type of the fourth source
T4
,
the value type of the fifth source
T5
,
the zipped result type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
zip
(@NonNull MaybeSource<? extends T1>
the first source MaybeSource
source1
,
@NonNull MaybeSource<? extends T2>
a second source MaybeSource
source2
,
@NonNull MaybeSource<? extends T3>
a third source MaybeSource
source3
,
@NonNull MaybeSource<? extends T4>
a fourth source MaybeSource
source4
,
@NonNull MaybeSource<? extends T5>
a fifth source MaybeSource
source5
,
@NonNull Function5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R>
a function that, when applied to an item emitted by each of the source MaybeSources, results in an item that will be emitted by the resulting Maybe
zipper
)

Returns a Maybe that emits the results of a specified combiner function applied to combinations of five items emitted, in sequence, by five other MaybeSources.

public static <
the value type of the first source
T1
,
the value type of the second source
T2
,
the value type of the third source
T3
,
the value type of the fourth source
T4
,
the value type of the fifth source
T5
,
the value type of the sixth source
T6
,
the zipped result type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
zip
(@NonNull MaybeSource<? extends T1>
the first source MaybeSource
source1
,
@NonNull MaybeSource<? extends T2>
a second source MaybeSource
source2
,
@NonNull MaybeSource<? extends T3>
a third source MaybeSource
source3
,
@NonNull MaybeSource<? extends T4>
a fourth source MaybeSource
source4
,
@NonNull MaybeSource<? extends T5>
a fifth source MaybeSource
source5
,
@NonNull MaybeSource<? extends T6>
a sixth source MaybeSource
source6
,
@NonNull Function6<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? extends R>
a function that, when applied to an item emitted by each of the source MaybeSources, results in an item that will be emitted by the resulting Maybe
zipper
)

Returns a Maybe that emits the results of a specified combiner function applied to combinations of six items emitted, in sequence, by six other MaybeSources.

public static <
the value type of the first source
T1
,
the value type of the second source
T2
,
the value type of the third source
T3
,
the value type of the fourth source
T4
,
the value type of the fifth source
T5
,
the value type of the sixth source
T6
,
the value type of the seventh source
T7
,
the zipped result type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
zip
(@NonNull MaybeSource<? extends T1>
the first source MaybeSource
source1
,
@NonNull MaybeSource<? extends T2>
a second source MaybeSource
source2
,
@NonNull MaybeSource<? extends T3>
a third source MaybeSource
source3
,
@NonNull MaybeSource<? extends T4>
a fourth source MaybeSource
source4
,
@NonNull MaybeSource<? extends T5>
a fifth source MaybeSource
source5
,
@NonNull MaybeSource<? extends T6>
a sixth source MaybeSource
source6
,
@NonNull MaybeSource<? extends T7>
a seventh source MaybeSource
source7
,
@NonNull Function7<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? extends R>
a function that, when applied to an item emitted by each of the source MaybeSources, results in an item that will be emitted by the resulting Maybe
zipper
)

Returns a Maybe that emits the results of a specified combiner function applied to combinations of seven items emitted, in sequence, by seven other MaybeSources.

public static <
the value type of the first source
T1
,
the value type of the second source
T2
,
the value type of the third source
T3
,
the value type of the fourth source
T4
,
the value type of the fifth source
T5
,
the value type of the sixth source
T6
,
the value type of the seventh source
T7
,
the value type of the eighth source
T8
,
the zipped result type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
zip
(@NonNull MaybeSource<? extends T1>
the first source MaybeSource
source1
,
@NonNull MaybeSource<? extends T2>
a second source MaybeSource
source2
,
@NonNull MaybeSource<? extends T3>
a third source MaybeSource
source3
,
@NonNull MaybeSource<? extends T4>
a fourth source MaybeSource
source4
,
@NonNull MaybeSource<? extends T5>
a fifth source MaybeSource
source5
,
@NonNull MaybeSource<? extends T6>
a sixth source MaybeSource
source6
,
@NonNull MaybeSource<? extends T7>
a seventh source MaybeSource
source7
,
@NonNull MaybeSource<? extends T8>
an eighth source MaybeSource
source8
,
@NonNull Function8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R>
a function that, when applied to an item emitted by each of the source MaybeSources, results in an item that will be emitted by the resulting Maybe
zipper
)

Returns a Maybe that emits the results of a specified combiner function applied to combinations of eight items emitted, in sequence, by eight other MaybeSources.

public static <
the value type of the first source
T1
,
the value type of the second source
T2
,
the value type of the third source
T3
,
the value type of the fourth source
T4
,
the value type of the fifth source
T5
,
the value type of the sixth source
T6
,
the value type of the seventh source
T7
,
the value type of the eighth source
T8
,
the value type of the ninth source
T9
,
the zipped result type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
zip
(@NonNull MaybeSource<? extends T1>
the first source MaybeSource
source1
,
@NonNull MaybeSource<? extends T2>
a second source MaybeSource
source2
,
@NonNull MaybeSource<? extends T3>
a third source MaybeSource
source3
,
@NonNull MaybeSource<? extends T4>
a fourth source MaybeSource
source4
,
@NonNull MaybeSource<? extends T5>
a fifth source MaybeSource
source5
,
@NonNull MaybeSource<? extends T6>
a sixth source MaybeSource
source6
,
@NonNull MaybeSource<? extends T7>
a seventh source MaybeSource
source7
,
@NonNull MaybeSource<? extends T8>
an eighth source MaybeSource
source8
,
@NonNull MaybeSource<? extends T9>
a ninth source MaybeSource
source9
,
@NonNull Function9<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? extends R>
a function that, when applied to an item emitted by each of the source MaybeSources, results in an item that will be emitted by the resulting Maybe
zipper
)

Returns a Maybe that emits the results of a specified combiner function applied to combinations of nine items emitted, in sequence, by nine other MaybeSources.

public static <
the common element type
T
,
the result type
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
zipArray
(@NonNull Function<? super Object[], ? extends R>
a function that, when applied to an item emitted by each of the source MaybeSources, results in an item that will be emitted by the resulting Maybe
zipper
,
@NonNull MaybeSource<? extends T>...
an array of source MaybeSources
sources
)

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.

public final <
the type of items emitted by the other MaybeSource
U
,
the type of items emitted by the resulting Maybe
R
>
@NonNull Maybe<R>

Returns:

the new Maybe instance
zipWith
(@NonNull MaybeSource<? extends U>
the other MaybeSource
other
,
@NonNull BiFunction<? super T, ? super U, ? extends R>
a function that combines the pairs of items from the two MaybeSources to generate the items to be emitted by the resulting Maybe
zipper
)

Waits until this and the other MaybeSource signal a success value then applies the given BiFunction to those values and emits the BiFunction's resulting value to downstream.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait