static <T> @NonNull Maybe<T>
amb(@NonNull Iterable<? extends MaybeSource<? extends T>> sources)
Runs multiple
MaybeSource
s provided by an
Iterable
sequence and signals the events of the first one that signals (disposing the rest).
static <T> @NonNull Maybe<T>
ambArray(MaybeSource<? extends T>... sources)
Runs multiple
MaybeSource
s and signals the events of the first one that signals (disposing the rest).
@NonNull Maybe<T>
ambWith(@NonNull MaybeSource<? extends T> other)
Mirrors the
MaybeSource
(current or provided) that first signals an event.
T
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).
T
blockingGet(T 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).
void
blockingSubscribe()
Subscribes to the current Maybe
and blocks the current thread until it terminates.
void
blockingSubscribe(@NonNull Consumer<? super T> onSuccess)
Subscribes to the current Maybe
and calls given onSuccess
callback on the current thread when it completes normally.
void
blockingSubscribe(@NonNull Consumer<? super T> onSuccess, @NonNull Consumer<? super Throwable> onError)
Subscribes to the current Maybe
and calls the appropriate callback on the current thread when it terminates.
void
blockingSubscribe(@NonNull Consumer<? super T> onSuccess, @NonNull Consumer<? super Throwable> onError, @NonNull Action onComplete)
Subscribes to the current Maybe
and calls the appropriate callback on the current thread when it terminates.
void
blockingSubscribe(@NonNull MaybeObserver<? super T> observer)
Subscribes to the current
Maybe
and calls the appropriate
MaybeObserver
method on the
current thread.
@NonNull Maybe<T>
cache()
Returns a Maybe
that subscribes to this Maybe
lazily, caches its event and replays it, to all the downstream subscribers.
<U> @NonNull Maybe<U>
cast(@NonNull Class<? extends U> clazz)
Casts the success value of the current
Maybe
into the target type or signals a
ClassCastException
if not compatible.
<R> @NonNull Maybe<R>
compose(@NonNull MaybeTransformer<? super T,? extends R> transformer)
static <T> @NonNull Flowable<T>
concat(@NonNull Iterable<? extends MaybeSource<? extends T>> sources)
Concatenate the single values, in a non-overlapping fashion, of the
MaybeSource
sources provided by an
Iterable
sequence as a
Flowable
sequence.
static <T> @NonNull Flowable<T>
concat(@NonNull MaybeSource<? extends T> source1, @NonNull MaybeSource<? extends T> source2)
static <T> @NonNull Flowable<T>
concat(@NonNull MaybeSource<? extends T> source1, @NonNull MaybeSource<? extends T> source2, @NonNull MaybeSource<? extends T> source3)
static <T> @NonNull Flowable<T>
concat(@NonNull MaybeSource<? extends T> source1, @NonNull MaybeSource<? extends T> source2, @NonNull MaybeSource<? extends T> source3, @NonNull MaybeSource<? extends T> source4)
static <T> @NonNull Flowable<T>
concat(@NonNull Publisher<? extends MaybeSource<? extends T>> sources)
Concatenate the single values, in a non-overlapping fashion, of the
MaybeSource
sources provided by a
Publisher
sequence as a
Flowable
sequence.
static <T> @NonNull Flowable<T>
concat(@NonNull Publisher<? extends MaybeSource<? extends T>> sources, int prefetch)
Concatenate the single values, in a non-overlapping fashion, of the
MaybeSource
sources provided by a
Publisher
sequence as a
Flowable
sequence.
static <T> @NonNull Flowable<T>
concatArray(MaybeSource<? extends T>... sources)
Concatenate the single values, in a non-overlapping fashion, of the
MaybeSource
sources in the array as a
Flowable
sequence.
static <T> @NonNull Flowable<T>
concatArrayDelayError(MaybeSource<? extends T>... sources)
Concatenates a variable number of
MaybeSource
sources and delays errors from any of them till all terminate as a
Flowable
sequence.
static <T> @NonNull Flowable<T>
concatArrayEager(MaybeSource<? extends T>... sources)
static <T> @NonNull Flowable<T>
concatArrayEagerDelayError(MaybeSource<? extends T>... sources)
static <T> @NonNull Flowable<T>
concatDelayError(@NonNull Iterable<? extends MaybeSource<? extends T>> sources)
Concatenates the
Iterable
sequence of
MaybeSource
s 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
MaybeSource
s terminate as a
Flowable
sequence.
static <T> @NonNull Flowable<T>
concatDelayError(@NonNull Publisher<? extends MaybeSource<? extends T>> sources)
Concatenates the
Publisher
sequence of
MaybeSource
s 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.
static <T> @NonNull Flowable<T>
concatDelayError(@NonNull Publisher<? extends MaybeSource<? extends T>> sources, int prefetch)
Concatenates the
Publisher
sequence of
MaybeSource
s 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.
static <T> @NonNull Flowable<T>
concatEager(@NonNull Iterable<? extends MaybeSource<? extends T>> sources)
static <T> @NonNull Flowable<T>
concatEager(@NonNull Iterable<? extends MaybeSource<? extends T>> sources, int maxConcurrency)
Concatenates a sequence of
MaybeSource
s eagerly into a
Flowable
sequence and runs a limited number of the inner sequences at once.
static <T> @NonNull Flowable<T>
concatEager(@NonNull Publisher<? extends MaybeSource<? extends T>> sources)
static <T> @NonNull Flowable<T>
concatEager(@NonNull Publisher<? extends MaybeSource<? extends T>> sources, int maxConcurrency)
Concatenates a
Publisher
sequence of
MaybeSource
s eagerly into a
Flowable
sequence, running at most the given number of inner
MaybeSource
s at once.
static <T> @NonNull Flowable<T>
concatEagerDelayError(@NonNull Iterable<? extends MaybeSource<? extends T>> sources)
Concatenates a sequence of
MaybeSource
s eagerly into a
Flowable
sequence, delaying errors until all inner
MaybeSource
s terminate.
static <T> @NonNull Flowable<T>
concatEagerDelayError(@NonNull Iterable<? extends MaybeSource<? extends T>> sources, int maxConcurrency)
Concatenates a sequence of
MaybeSource
s eagerly into a
Flowable
sequence, delaying errors until all inner
MaybeSource
s terminate and runs a limited number of inner
MaybeSource
s at once.
static <T> @NonNull Flowable<T>
concatEagerDelayError(@NonNull Publisher<? extends MaybeSource<? extends T>> sources)
Concatenates a
Publisher
sequence of
MaybeSource
s eagerly into a
Flowable
sequence, delaying errors until all the inner and the outer sequence terminate.
static <T> @NonNull Flowable<T>
concatEagerDelayError(@NonNull Publisher<? extends MaybeSource<? extends T>> sources, int maxConcurrency)
Concatenates a
Publisher
sequence of
MaybeSource
s eagerly into a
Flowable
sequence, delaying errors until all the inner and the outer sequence terminate and runs a limited number of the inner
MaybeSource
s at once.
<R> @NonNull Maybe<R>
concatMap(@NonNull Function<? super T,? extends MaybeSource<? extends R>> 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
.
@NonNull Completable
concatMapCompletable(@NonNull Function<? super T,? extends CompletableSource> 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
.
<R> @NonNull Maybe<R>
concatMapSingle(@NonNull Function<? super T,? extends SingleSource<? extends R>> mapper)
Returns a
Maybe
based on applying a specified function to the item emitted by the current
Maybe
, where that function returns a
Single
.
@NonNull Flowable<T>
concatWith(@NonNull MaybeSource<? extends T> other)
Returns a
Flowable
that emits the items emitted from the current
Maybe
, then the
other
MaybeSource
, one after the other, without interleaving them.
@NonNull Single<Boolean>
contains(@NonNull Object item)
Returns a
Single
that emits a
Boolean
that indicates whether the current
Maybe
emitted a specified item.
@NonNull Single<Long>
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
.
static <T> @NonNull Maybe<T>
create(@NonNull MaybeOnSubscribe<T> onSubscribe)
Provides an API (via a cold Maybe
) that bridges the reactive world with the callback-style world.
@NonNull Single<T>
defaultIfEmpty(T defaultItem)
Returns a
Single
that emits the item emitted by the current
Maybe
or a specified default item if the current
Maybe
is empty.
static <T> @NonNull Maybe<T>
defer(@NonNull Supplier<? extends MaybeSource<? extends T>> supplier)
@NonNull Maybe<T>
delay(long time, @NonNull TimeUnit unit)
Returns a Maybe
that signals the events emitted by the current Maybe
shifted forward in time by a specified delay.
@NonNull Maybe<T>
delay(long time, @NonNull TimeUnit unit, boolean delayError)
Returns a Maybe
that signals the events emitted by the current Maybe
shifted forward in time by a specified delay.
@NonNull Maybe<T>
delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler)
Returns a Maybe
that signals the events emitted by the current Maybe
shifted forward in time by a specified delay.
@NonNull Maybe<T>
delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean 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
.
<U> @NonNull Maybe<T>
delay(@NonNull Publisher<U> delayIndicator)
Delays the emission of this
Maybe
until the given
Publisher
signals an item or completes.
@NonNull Maybe<T>
delaySubscription(long time, @NonNull TimeUnit unit)
Returns a Maybe
that delays the subscription to the current Maybe
by a given amount of time.
@NonNull Maybe<T>
delaySubscription(long time, @NonNull TimeUnit unit, @NonNull Scheduler 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
.
<U> @NonNull Maybe<T>
delaySubscription(@NonNull Publisher<U> subscriptionIndicator)
Returns a
Maybe
that delays the subscription to this
Maybe
until the other
Publisher
emits an element or completes normally.
<R> @NonNull Maybe<R>
dematerialize(@NonNull Function<? super T,Notification<R>> selector)
Maps the
Notification
success value of the current
Maybe
back into normal
onSuccess
,
onError
or
onComplete
signals.
@NonNull Maybe<T>
doAfterSuccess(@NonNull Consumer<? super T> onAfterSuccess)
Calls the specified
Consumer
with the success item after this item has been emitted to the downstream.
@NonNull Maybe<T>
doAfterTerminate(@NonNull Action onAfterTerminate)
@NonNull Maybe<T>
doFinally(@NonNull Action onFinally)
Calls the specified action after this Maybe
signals onSuccess
, onError
or onComplete
or gets disposed by the downstream.
@NonNull Maybe<T>
doOnComplete(@NonNull Action onComplete)
Invokes an
Action
just before the current
Maybe
calls
onComplete
.
@NonNull Maybe<T>
doOnDispose(@NonNull Action onDispose)
@NonNull Maybe<T>
doOnError(@NonNull Consumer<? super Throwable> onError)
Calls the shared
Consumer
with the error sent via
onError
for each
MaybeObserver
that subscribes to the current
Maybe
.
@NonNull Maybe<T>
doOnEvent(@NonNull BiConsumer<? super T,? super Throwable> 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.
@NonNull Maybe<T>
doOnLifecycle(@NonNull Consumer<? super Disposable> onSubscribe, @NonNull Action onDispose)
Calls the appropriate
onXXX
method (shared between all
MaybeObserver
s) for the lifecycle events of the sequence (subscription, disposal).
@NonNull Maybe<T>
doOnSubscribe(@NonNull Consumer<? super Disposable> onSubscribe)
@NonNull Maybe<T>
doOnSuccess(@NonNull Consumer<? super T> onSuccess)
Calls the shared
Consumer
with the success value sent via
onSuccess
for each
MaybeObserver
that subscribes to the current
Maybe
.
@NonNull Maybe<T>
doOnTerminate(@NonNull Action onTerminate)
Returns a Maybe
instance that calls the given onTerminate callback just before this Maybe
completes normally or with an exception.
static <T> @NonNull Maybe<T>
empty()
Returns a (singleton)
Maybe
instance that calls
onComplete
immediately.
static <T> @NonNull Maybe<T>
error(@NonNull Supplier<? extends Throwable> supplier)
Returns a
Maybe
that invokes a
MaybeObserver
's
onError
method when the
MaybeObserver
subscribes to it.
static <T> @NonNull Maybe<T>
error(@NonNull Throwable throwable)
Returns a
Maybe
that invokes a subscriber's
onError
method when the subscriber subscribes to it.
@NonNull Maybe<T>
filter(@NonNull Predicate<? super T> predicate)
Filters the success item of the Maybe
via a predicate function and emitting it if the predicate returns true
, completing otherwise.
<R> @NonNull Maybe<R>
flatMap(@NonNull Function<? super T,? extends MaybeSource<? extends R>> 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
.
<R> @NonNull Maybe<R>
flatMap(@NonNull Function<? super T,? extends MaybeSource<? extends R>> onSuccessMapper, @NonNull Function<? super Throwable,? extends MaybeSource<? extends R>> onErrorMapper, @NonNull Supplier<? extends MaybeSource<? extends R>> onCompleteSupplier)
Maps the
onSuccess
,
onError
or
onComplete
signals of the current
Maybe
into a
MaybeSource
and emits that
MaybeSource
's signals.
<U,R> @NonNull Maybe<R>
flatMap(@NonNull Function<? super T,? extends MaybeSource<? extends U>> mapper, @NonNull BiFunction<? super T,? super U,? extends R> 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
.
@NonNull Completable
flatMapCompletable(@NonNull Function<? super T,? extends CompletableSource> 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
.
<R> @NonNull Observable<R>
flatMapObservable(@NonNull Function<? super T,? extends ObservableSource<? extends R>> 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
.
<R> @NonNull Flowable<R>
flatMapPublisher(@NonNull Function<? super T,? extends Publisher<? extends R>> 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
.
<R> @NonNull Maybe<R>
flatMapSingle(@NonNull Function<? super T,? extends SingleSource<? extends R>> mapper)
Returns a
Maybe
based on applying a specified function to the item emitted by the current
Maybe
, where that function returns a
Single
.
<U> @NonNull Flowable<U>
flattenAsFlowable(@NonNull Function<? super T,? extends Iterable<? extends U>> mapper)
Maps the success value of the current
Maybe
into an
Iterable
and emits its items as a
Flowable
sequence.
<U> @NonNull Observable<U>
flattenAsObservable(@NonNull Function<? super T,? extends Iterable<? extends U>> mapper)
Maps the success value of the current
Maybe
into an
Iterable
and emits its items as an
Observable
sequence.
<R> @NonNull Flowable<R>
flattenStreamAsFlowable(@NonNull Function<? super T,? extends Stream<? extends R>> mapper)
Maps the upstream succecss value into a Java
Stream
and emits its items to the downstream consumer as a
Flowable
.
<R> @NonNull Observable<R>
flattenStreamAsObservable(@NonNull Function<? super T,? extends Stream<? extends R>> mapper)
Maps the upstream succecss value into a Java
Stream
and emits its items to the downstream consumer as an
Observable
.
static <T> @NonNull Maybe<T>
fromAction(@NonNull Action action)
Returns a
Maybe
instance that runs the given
Action
for each
MaybeObserver
and emits either its exception or simply completes.
static <T> @NonNull Maybe<T>
fromCallable(@NonNull Callable<? extends T> 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
.
static <T> @NonNull Maybe<T>
fromCompletable(@NonNull CompletableSource completableSource)
static <T> @NonNull Maybe<T>
fromCompletionStage(@NonNull CompletionStage<T> stage)
Signals the completion value or error of the given (hot)
CompletionStage
-based asynchronous calculation.
static <T> @NonNull Maybe<T>
fromFuture(@NonNull Future<? extends T> future)
Converts a
Future
into a
Maybe
, treating a
null
result as an indication of emptiness.
static <T> @NonNull Maybe<T>
fromFuture(@NonNull Future<? extends T> future, long timeout, @NonNull TimeUnit unit)
Converts a
Future
into a
Maybe
, with a timeout on the
Future
.
static <T> @NonNull Maybe<T>
fromObservable(@NonNull ObservableSource<T> source)
Wraps an
ObservableSource
into a
Maybe
and emits the very first item or completes if the source is empty.
static <T> @NonNull Maybe<T>
fromOptional(@NonNull Optional<T> optional)
Converts the existing value of the provided optional into a
just(Object)
or an empty optional into an
empty()
Maybe
instance.
static <T> @NonNull Maybe<T>
fromPublisher(@NonNull Publisher<T> source)
Wraps a
Publisher
into a
Maybe
and emits the very first item or completes if the source is empty.
static <T> @NonNull Maybe<T>
fromRunnable(@NonNull Runnable run)
Returns a
Maybe
instance that runs the given
Runnable
for each
MaybeObserver
and emits either its unchecked exception or simply completes.
static <T> @NonNull Maybe<T>
fromSingle(@NonNull SingleSource<T> single)
static <T> @NonNull Maybe<T>
fromSupplier(@NonNull Supplier<? extends T> 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
.
@NonNull Maybe<T>
hide()
Hides the identity of this
Maybe
and its
Disposable
.
@NonNull Completable
ignoreElement()
Returns a
Completable
that ignores the item emitted by the current
Maybe
and only calls
onComplete
or
onError
.
@NonNull Single<Boolean>
isEmpty()
Returns a
Single
that emits
true
if the current
Maybe
is empty, otherwise
false
.
static <T> @NonNull Maybe<T>
just(T item)
Returns a Maybe
that emits a specified item.
<R> @NonNull Maybe<R>
lift(@NonNull MaybeOperator<? extends R,? super T> 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.
<R> @NonNull Maybe<R>
map(@NonNull Function<? super T,? extends R> 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.
<R> @NonNull Maybe<R>
mapOptional(@NonNull Function<? super T,Optional<? extends R>> mapper)
Maps the upstream success value into an
Optional
and emits the contained item if not empty.
@NonNull Single<Notification<T>>
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.
static <T> @NonNull Flowable<T>
merge(@NonNull Iterable<? extends MaybeSource<? extends T>> sources)
static <T> @NonNull Maybe<T>
merge(@NonNull MaybeSource<? extends MaybeSource<? extends T>> source)
Flattens a
MaybeSource
that emits a
MaybeSource
into a single
MaybeSource
that emits the item emitted by the nested
MaybeSource
, without any transformation.
static <T> @NonNull Flowable<T>
merge(@NonNull MaybeSource<? extends T> source1, @NonNull MaybeSource<? extends T> source2)
static <T> @NonNull Flowable<T>
merge(@NonNull MaybeSource<? extends T> source1, @NonNull MaybeSource<? extends T> source2, @NonNull MaybeSource<? extends T> source3)
static <T> @NonNull Flowable<T>
merge(@NonNull MaybeSource<? extends T> source1, @NonNull MaybeSource<? extends T> source2, @NonNull MaybeSource<? extends T> source3, @NonNull MaybeSource<? extends T> source4)
static <T> @NonNull Flowable<T>
merge(@NonNull Publisher<? extends MaybeSource<? extends T>> sources)
static <T> @NonNull Flowable<T>
merge(@NonNull Publisher<? extends MaybeSource<? extends T>> sources, int maxConcurrency)
static <T> @NonNull Flowable<T>
mergeArray(MaybeSource<? extends T>... sources)
Merges an array of
MaybeSource
instances into a single
Flowable
sequence, running all
MaybeSource
s at once.
static <T> @NonNull Flowable<T>
mergeArrayDelayError(MaybeSource<? extends T>... sources)
Flattens an array of
MaybeSource
s into one
Flowable
, in a way that allows a subscriber to receive all successfully emitted items from each of the source
MaybeSource
s without being interrupted by an error notification from one of them.
static <T> @NonNull Flowable<T>
mergeDelayError(@NonNull Iterable<? extends MaybeSource<? extends T>> sources)
Flattens an
Iterable
sequence of
MaybeSource
s into one
Flowable
, in a way that allows a subscriber to receive all successfully emitted items from each of the source
MaybeSource
s without being interrupted by an error notification from one of them.
static <T> @NonNull Flowable<T>
mergeDelayError(@NonNull MaybeSource<? extends T> source1, @NonNull MaybeSource<? extends T> source2)
Flattens two
MaybeSource
s into one
Flowable
, in a way that allows a subscriber to receive all successfully emitted items from each of the source
MaybeSource
s without being interrupted by an error notification from one of them.
static <T> @NonNull Flowable<T>
mergeDelayError(@NonNull MaybeSource<? extends T> source1, @NonNull MaybeSource<? extends T> source2, @NonNull MaybeSource<? extends T> 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
MaybeSource
s without being interrupted by an error notification from one of them.
static <T> @NonNull Flowable<T>
mergeDelayError(@NonNull MaybeSource<? extends T> source1, @NonNull MaybeSource<? extends T> source2, @NonNull MaybeSource<? extends T> source3, @NonNull MaybeSource<? extends T> source4)
Flattens four
MaybeSource
s into one
Flowable
, in a way that allows a subscriber to receive all successfully emitted items from all of the source
MaybeSource
s without being interrupted by an error notification from one of them.
static <T> @NonNull Flowable<T>
mergeDelayError(@NonNull Publisher<? extends MaybeSource<? extends T>> sources)
Flattens a
Publisher
that emits
MaybeSource
s into one
Flowable
, in a way that allows a subscriber to receive all successfully emitted items from all of the source
MaybeSource
s without being interrupted by an error notification from one of them or even the main
Publisher
.
static <T> @NonNull Flowable<T>
mergeDelayError(@NonNull Publisher<? extends MaybeSource<? extends T>> sources, int maxConcurrency)
Flattens a
Publisher
that emits
MaybeSource
s into one
Flowable
, in a way that allows a subscriber to receive all successfully emitted items from all of the source
MaybeSource
s 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
MaybeSource
s.
@NonNull Flowable<T>
mergeWith(@NonNull MaybeSource<? extends T> other)
Flattens this
Maybe
and another
MaybeSource
into a single
Flowable
, without any transformation.
static <T> @NonNull Maybe<T>
never()
Returns a
Maybe
that never sends any items or notifications to a
MaybeObserver
.
@NonNull Maybe<T>
observeOn(@NonNull Scheduler scheduler)
Wraps a
Maybe
to emit its item (or notify of its error) on a specified
Scheduler
, asynchronously.
<U> @NonNull Maybe<U>
ofType(@NonNull Class<U> clazz)
Filters the items emitted by the current
Maybe
, only emitting its success value if that is an instance of the supplied
Class
.
@NonNull Maybe<T>
onErrorComplete()
Returns a Maybe
instance that if this Maybe
emits an error, it will emit an onComplete
and swallow the throwable.
@NonNull Maybe<T>
onErrorComplete(@NonNull Predicate<? super Throwable> 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.
@NonNull Maybe<T>
onErrorResumeNext(@NonNull Function<? super Throwable,? extends MaybeSource<? extends T>> 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
.
@NonNull Maybe<T>
onErrorResumeWith(@NonNull MaybeSource<? extends T> fallback)
Resumes the flow with the given
MaybeSource
when the current
Maybe
fails instead of signaling the error via
onError
.
@NonNull Maybe<T>
onErrorReturn(@NonNull Function<? super Throwable,? extends T> 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
.
@NonNull Maybe<T>
onErrorReturnItem(T item)
Ends the flow with the given success item when the current Maybe
fails instead of signaling the error via onError
.
@NonNull Maybe<T>
onTerminateDetach()
Nulls out references to the upstream producer and downstream
MaybeObserver
if the sequence is terminated or downstream calls
dispose()
.
@NonNull Flowable<T>
repeat()
Returns a
Flowable
that repeats the sequence of items emitted by the current
Maybe
indefinitely.
@NonNull Flowable<T>
repeat(long times)
Returns a
Flowable
that repeats the sequence of items emitted by the current
Maybe
at most
count
times.
@NonNull Flowable<T>
repeatUntil(@NonNull BooleanSupplier stop)
Returns a
Flowable
that repeats the sequence of items emitted by the current
Maybe
until the provided stop function returns
true
.
@NonNull Flowable<T>
repeatWhen(@NonNull Function<? super Flowable<Object>,? extends Publisher<?>> handler)
Returns a
Flowable
that emits the same values as the current
Maybe
with the exception of an
onComplete
.
@NonNull Maybe<T>
retry()
Returns a Maybe
that mirrors the current Maybe
, resubscribing to it if it calls onError
(infinite retry count).
@NonNull Maybe<T>
retry(@NonNull BiPredicate<? super Integer,? super Throwable> 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.
@NonNull Maybe<T>
retry(long times)
Returns a Maybe
that mirrors the current Maybe
, resubscribing to it if it calls onError
up to a specified number of retries.
@NonNull Maybe<T>
retry(long times, @NonNull Predicate<? super Throwable> predicate)
Retries at most times
or until the predicate returns false
, whichever happens first.
@NonNull Maybe<T>
retry(@NonNull Predicate<? super Throwable> predicate)
Retries the current Maybe
if it fails and the predicate returns true
.
@NonNull Maybe<T>
retryUntil(@NonNull BooleanSupplier stop)
Retries until the given stop function returns true
.
@NonNull Maybe<T>
retryWhen(@NonNull Function<? super Flowable<Throwable>,? extends Publisher<?>> handler)
Returns a Maybe
that emits the same values as the current Maybe
with the exception of an onError
.
void
safeSubscribe(@NonNull MaybeObserver<? super T> observer)
static <T> @NonNull Single<Boolean>
sequenceEqual(@NonNull MaybeSource<? extends T> source1, @NonNull MaybeSource<? extends T> 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.
static <T> @NonNull Single<Boolean>
sequenceEqual(@NonNull MaybeSource<? extends T> source1, @NonNull MaybeSource<? extends T> source2, @NonNull BiPredicate<? super T,? super T> isEqual)
Returns a
Single
that emits a
Boolean
value that indicates whether two
MaybeSource
s are the same by comparing the items emitted by each
MaybeSource
pairwise based on the results of a specified equality function.
@NonNull Flowable<T>
startWith(@NonNull CompletableSource other)
@NonNull Flowable<T>
startWith(@NonNull MaybeSource<T> other)
Returns a
Flowable
which first runs the other
MaybeSource
then the current
Maybe
if the other succeeded or completed normally.
@NonNull Observable<T>
startWith(@NonNull ObservableSource<T> other)
@NonNull Flowable<T>
startWith(@NonNull Publisher<T> other)
Returns a
Flowable
which first delivers the events of the other
Publisher
then runs the current
Maybe
.
@NonNull Flowable<T>
startWith(@NonNull SingleSource<T> other)
Returns a
Flowable
which first runs the other
SingleSource
then the current
Maybe
if the other succeeded normally.
@NonNull Disposable
subscribe()
Subscribes to a Maybe
and ignores onSuccess
and onComplete
emissions.
@NonNull Disposable
subscribe(@NonNull Consumer<? super T> onSuccess)
Subscribes to a Maybe
and provides a callback to handle the items it emits.
@NonNull Disposable
subscribe(@NonNull Consumer<? super T> onSuccess, @NonNull Consumer<? super Throwable> onError)
Subscribes to a Maybe
and provides callbacks to handle the items it emits and any error notification it issues.
@NonNull Disposable
subscribe(@NonNull Consumer<? super T> onSuccess, @NonNull Consumer<? super Throwable> onError, @NonNull Action onComplete)
Subscribes to a Maybe
and provides callbacks to handle the items it emits and any error or completion notification it issues.
@NonNull Disposable
subscribe(@NonNull Consumer<? super T> onSuccess, @NonNull Consumer<? super Throwable> onError, @NonNull Action onComplete, @NonNull DisposableContainer 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.
void
subscribe(@NonNull MaybeObserver<? super T> observer)
protected abstract void
subscribeActual(@NonNull MaybeObserver<? super T> observer)
Implement this method in subclasses to handle the incoming
MaybeObserver
s.
@NonNull Maybe<T>
subscribeOn(@NonNull Scheduler scheduler)
Asynchronously subscribes subscribers to this
Maybe
on the specified
Scheduler
.
<E extends MaybeObserver<? super T>>
E
subscribeWith(E observer)
Subscribes a given
MaybeObserver
(subclass) to this
Maybe
and returns the given
MaybeObserver
as is.
@NonNull Maybe<T>
switchIfEmpty(@NonNull MaybeSource<? extends T> 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.
@NonNull Single<T>
switchIfEmpty(@NonNull SingleSource<? extends T> 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.
static <T> @NonNull Flowable<T>
switchOnNext(@NonNull Publisher<? extends MaybeSource<? extends T>> sources)
Switches between
MaybeSource
s emitted by the source
Publisher
whenever a new
MaybeSource
is emitted, disposing the previously running
MaybeSource
, exposing the success items as a
Flowable
sequence.
static <T> @NonNull Flowable<T>
switchOnNextDelayError(@NonNull Publisher<? extends MaybeSource<? extends T>> sources)
Switches between
MaybeSource
s 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.
<U> @NonNull Maybe<T>
takeUntil(@NonNull MaybeSource<U> other)
Returns a
Maybe
that emits the items emitted by the current
Maybe
until a second
MaybeSource
emits an item.
<U> @NonNull Maybe<T>
takeUntil(@NonNull Publisher<U> other)
Returns a
Maybe
that emits the item emitted by the current
Maybe
until a second
Publisher
emits an item.
@NonNull TestObserver<T>
test()
@NonNull TestObserver<T>
test(boolean dispose)
Creates a
TestObserver
optionally in cancelled state, then subscribes it to this
Maybe
.
@NonNull Maybe<Timed<T>>
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.
@NonNull Maybe<Timed<T>>
timeInterval(@NonNull Scheduler 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.
@NonNull Maybe<Timed<T>>
timeInterval(@NonNull TimeUnit unit)
Measures the time between the subscription and success item emission of the current
Maybe
and signals it as a tuple (
Timed
) success value.
@NonNull Maybe<Timed<T>>
timeInterval(@NonNull TimeUnit unit, @NonNull Scheduler scheduler)
Measures the time between the subscription and success item emission of the current
Maybe
and signals it as a tuple (
Timed
) success value.
@NonNull Maybe<T>
timeout(long timeout, @NonNull TimeUnit unit)
Returns a Maybe
that mirrors the current Maybe
but applies a timeout policy for each emitted item.
@NonNull Maybe<T>
timeout(long timeout, @NonNull TimeUnit unit, @NonNull MaybeSource<? extends T> fallback)
Returns a Maybe
that mirrors the current Maybe
but applies a timeout policy for each emitted item.
@NonNull Maybe<T>
timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler 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
.
@NonNull Maybe<T>
timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull MaybeSource<? extends T> fallback)
Returns a
Maybe
that mirrors the current
Maybe
but applies a timeout policy for each emitted item using a specified
Scheduler
.
<U> @NonNull Maybe<T>
timeout(@NonNull MaybeSource<U> timeoutIndicator)
<U> @NonNull Maybe<T>
timeout(@NonNull MaybeSource<U> timeoutIndicator, @NonNull MaybeSource<? extends T> 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.
<U> @NonNull Maybe<T>
timeout(@NonNull Publisher<U> timeoutIndicator)
If the current
Maybe
source didn't signal an event before the
timeoutIndicator
Publisher
signals, a
TimeoutException
is signaled instead.
<U> @NonNull Maybe<T>
timeout(@NonNull Publisher<U> timeoutIndicator, @NonNull MaybeSource<? extends T> 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.
static @NonNull Maybe<Long>
timer(long delay, @NonNull TimeUnit unit)
Returns a Maybe
that emits 0L
after a specified delay.
static @NonNull Maybe<Long>
timer(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler)
Returns a
Maybe
that emits
0L
after a specified delay on a specified
Scheduler
.
@NonNull Maybe<Timed<T>>
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.
@NonNull Maybe<Timed<T>>
timestamp(@NonNull Scheduler 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.
@NonNull Maybe<Timed<T>>
timestamp(@NonNull TimeUnit 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.
@NonNull Maybe<Timed<T>>
timestamp(@NonNull TimeUnit unit, @NonNull Scheduler 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.
<R> R
to(@NonNull MaybeConverter<T,? extends R> converter)
Calls the specified converter function during assembly time and returns its resulting value.
@NonNull CompletionStage<T>
toCompletionStage()
@NonNull CompletionStage<T>
toCompletionStage(T defaultItem)
Signals the upstream success item (or the default item if the upstream is empty) via a
CompletionStage
.
@NonNull Flowable<T>
toFlowable()
Converts this
Maybe
into a backpressure-aware
Flowable
instance composing cancellation through.
@NonNull Future<T>
toFuture()
Returns a
Future
representing the single value emitted by the current
Maybe
or
null
if the current
Maybe
is empty.
@NonNull Observable<T>
toObservable()
Converts this
Maybe
into an
Observable
instance composing disposal through.
@NonNull Single<T>
toSingle()
static <T> @NonNull Maybe<T>
unsafeCreate(@NonNull MaybeSource<T> onSubscribe)
Advanced use only:
creates a
Maybe
instance without any safeguards by using a callback that is called with a
MaybeObserver
.
@NonNull Maybe<T>
unsubscribeOn(@NonNull Scheduler scheduler)
static <T,D> @NonNull Maybe<T>
using(@NonNull Supplier<? extends D> resourceSupplier, @NonNull Function<? super D,? extends MaybeSource<? extends T>> sourceSupplier, @NonNull Consumer<? super D> resourceCleanup)
Constructs a
Maybe
that creates a dependent resource object which is disposed of when the generated
MaybeSource
terminates or the downstream calls dispose().
static <T,D> @NonNull Maybe<T>
using(@NonNull Supplier<? extends D> resourceSupplier, @NonNull Function<? super D,? extends MaybeSource<? extends T>> sourceSupplier, @NonNull Consumer<? super D> resourceCleanup, boolean 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}).
static <T> @NonNull Maybe<T>
wrap(@NonNull MaybeSource<T> source)
Wraps a
MaybeSource
instance into a new
Maybe
instance if not already a
Maybe
instance.
static <T,R> @NonNull Maybe<R>
zip(@NonNull Iterable<? extends MaybeSource<? extends T>> sources, @NonNull Function<? super Object[],? extends R> 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
MaybeSource
s.
static <T1,T2,R> @NonNull Maybe<R>
zip(@NonNull MaybeSource<? extends T1> source1, @NonNull MaybeSource<? extends T2> source2, @NonNull BiFunction<? super T1,? super T2,? extends R> 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
MaybeSource
s.
static <T1,T2,T3,R>
@NonNull Maybe<R>
zip(@NonNull MaybeSource<? extends T1> source1, @NonNull MaybeSource<? extends T2> source2, @NonNull MaybeSource<? extends T3> source3, @NonNull Function3<? super T1,? super T2,? super T3,? extends R> 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
MaybeSource
s.
static <T1,T2,T3,T4,R>
@NonNull Maybe<R>
zip(@NonNull MaybeSource<? extends T1> source1, @NonNull MaybeSource<? extends T2> source2, @NonNull MaybeSource<? extends T3> source3, @NonNull MaybeSource<? extends T4> source4, @NonNull Function4<? super T1,? super T2,? super T3,? super T4,? extends R> 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
MaybeSource
s.
static <T1,T2,T3,T4,T5,R>
@NonNull Maybe<R>
zip(@NonNull MaybeSource<? extends T1> source1, @NonNull MaybeSource<? extends T2> source2, @NonNull MaybeSource<? extends T3> source3, @NonNull MaybeSource<? extends T4> source4, @NonNull MaybeSource<? extends T5> source5, @NonNull Function5<? super T1,? super T2,? super T3,? super T4,? super T5,? extends R> 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
MaybeSource
s.
static <T1,T2,T3,T4,T5,T6,R>
@NonNull Maybe<R>
zip(@NonNull MaybeSource<? extends T1> source1, @NonNull MaybeSource<? extends T2> source2, @NonNull MaybeSource<? extends T3> source3, @NonNull MaybeSource<? extends T4> source4, @NonNull MaybeSource<? extends T5> source5, @NonNull MaybeSource<? extends T6> source6, @NonNull Function6<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? extends R> 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
MaybeSource
s.
static <T1,T2,T3,T4,T5,T6,T7,R>
@NonNull Maybe<R>
zip(@NonNull MaybeSource<? extends T1> source1, @NonNull MaybeSource<? extends T2> source2, @NonNull MaybeSource<? extends T3> source3, @NonNull MaybeSource<? extends T4> source4, @NonNull MaybeSource<? extends T5> source5, @NonNull MaybeSource<? extends T6> source6, @NonNull MaybeSource<? extends T7> source7, @NonNull Function7<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? extends R> 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
MaybeSource
s.
static <T1,T2,T3,T4,T5,T6,T7,T8,R>
@NonNull Maybe<R>
zip(@NonNull MaybeSource<? extends T1> source1, @NonNull MaybeSource<? extends T2> source2, @NonNull MaybeSource<? extends T3> source3, @NonNull MaybeSource<? extends T4> source4, @NonNull MaybeSource<? extends T5> source5, @NonNull MaybeSource<? extends T6> source6, @NonNull MaybeSource<? extends T7> source7, @NonNull MaybeSource<? extends T8> source8, @NonNull Function8<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? extends R> 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
MaybeSource
s.
static <T1,T2,T3,T4,T5,T6,T7,T8,T9,R>
@NonNull Maybe<R>
zip(@NonNull MaybeSource<? extends T1> source1, @NonNull MaybeSource<? extends T2> source2, @NonNull MaybeSource<? extends T3> source3, @NonNull MaybeSource<? extends T4> source4, @NonNull MaybeSource<? extends T5> source5, @NonNull MaybeSource<? extends T6> source6, @NonNull MaybeSource<? extends T7> source7, @NonNull MaybeSource<? extends T8> source8, @NonNull MaybeSource<? extends T9> source9, @NonNull Function9<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? super T9,? extends R> 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
MaybeSource
s.
static <T,R> @NonNull Maybe<R>
zipArray(@NonNull Function<? super Object[],? extends R> zipper, MaybeSource<? extends T>... 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
MaybeSource
s.
<U,R> @NonNull Maybe<R>
zipWith(@NonNull MaybeSource<? extends U> other, @NonNull BiFunction<? super T,? super U,? extends R> 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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4