static <T> @NonNull Single<T>
amb(@NonNull Iterable<? extends SingleSource<? extends T>> sources)
Runs multiple
SingleSource
s and signals the events of the first one that signals (disposing the rest).
static <T> @NonNull Single<T>
ambArray(SingleSource<? extends T>... sources)
Runs multiple
SingleSource
s and signals the events of the first one that signals (disposing the rest).
@NonNull Single<T>
ambWith(@NonNull SingleSource<? extends T> other)
Signals the event of this or the other
SingleSource
whichever signals first.
T
blockingGet()
Waits in a blocking fashion until the current Single
signals a success value (which is returned) or an exception (which is propagated).
void
blockingSubscribe()
Subscribes to the current Single
and blocks the current thread until it terminates.
void
blockingSubscribe(@NonNull Consumer<? super T> onSuccess)
Subscribes to the current Single
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 Single
and calls the appropriate callback on the current thread when it terminates.
void
blockingSubscribe(@NonNull SingleObserver<? super T> observer)
Subscribes to the current
Single
and calls the appropriate
SingleObserver
method on the
current thread.
@NonNull Single<T>
cache()
Stores the success value or exception from the current
Single
and replays it to late
SingleObserver
s.
<U> @NonNull Single<U>
cast(@NonNull Class<? extends U> clazz)
Casts the success value of the current
Single
into the target type or signals a
ClassCastException
if not compatible.
<R> @NonNull Single<R>
compose(@NonNull SingleTransformer<? super T,? extends R> transformer)
static <T> @NonNull Flowable<T>
concat(@NonNull Iterable<? extends SingleSource<? extends T>> sources)
Concatenate the single values, in a non-overlapping fashion, of the
SingleSource
s provided by an
Iterable
sequence.
static <T> @NonNull Observable<T>
concat(@NonNull ObservableSource<? extends SingleSource<? extends T>> sources)
static <T> @NonNull Flowable<T>
concat(@NonNull Publisher<? extends SingleSource<? extends T>> sources)
Concatenate the single values, in a non-overlapping fashion, of the
SingleSource
s provided by a
Publisher
sequence.
static <T> @NonNull Flowable<T>
concat(@NonNull Publisher<? extends SingleSource<? extends T>> sources, int prefetch)
Concatenate the single values, in a non-overlapping fashion, of the
SingleSource
s provided by a
Publisher
sequence and prefetched by the specified amount.
static <T> @NonNull Flowable<T>
concat(@NonNull SingleSource<? extends T> source1, @NonNull SingleSource<? extends T> source2)
static <T> @NonNull Flowable<T>
concat(@NonNull SingleSource<? extends T> source1, @NonNull SingleSource<? extends T> source2, @NonNull SingleSource<? extends T> source3)
static <T> @NonNull Flowable<T>
concat(@NonNull SingleSource<? extends T> source1, @NonNull SingleSource<? extends T> source2, @NonNull SingleSource<? extends T> source3, @NonNull SingleSource<? extends T> source4)
static <T> @NonNull Flowable<T>
concatArray(SingleSource<? extends T>... sources)
Concatenate the single values, in a non-overlapping fashion, of the
SingleSource
s provided in an array.
static <T> @NonNull Flowable<T>
concatArrayDelayError(SingleSource<? extends T>... sources)
Concatenate the single values, in a non-overlapping fashion, of the
SingleSource
s provided in an array.
static <T> @NonNull Flowable<T>
concatArrayEager(SingleSource<? extends T>... sources)
Concatenates a sequence of
SingleSource
eagerly into a single stream of values.
static <T> @NonNull Flowable<T>
concatArrayEagerDelayError(SingleSource<? extends T>... sources)
Concatenates a sequence of
SingleSource
eagerly into a single stream of values.
static <T> @NonNull Flowable<T>
concatDelayError(@NonNull Iterable<? extends SingleSource<? extends T>> sources)
Concatenates the
Iterable
sequence of
SingleSource
s into a single sequence by subscribing to each
SingleSource
, one after the other, one at a time and delays any errors till the all inner
SingleSource
s terminate as a
Flowable
sequence.
static <T> @NonNull Flowable<T>
concatDelayError(@NonNull Publisher<? extends SingleSource<? extends T>> sources)
Concatenates the
Publisher
sequence of
SingleSource
s into a single sequence by subscribing to each inner
SingleSource
, 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 SingleSource<? extends T>> sources, int prefetch)
Concatenates the
Publisher
sequence of
SingleSource
s into a single sequence by subscribing to each inner
SingleSource
, 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 SingleSource<? extends T>> sources)
static <T> @NonNull Flowable<T>
concatEager(@NonNull Iterable<? extends SingleSource<? extends T>> sources, int maxConcurrency)
Concatenates an
Iterable
sequence of
SingleSource
s eagerly into a single stream of values and runs a limited number of the inner sources at once.
static <T> @NonNull Flowable<T>
concatEager(@NonNull Publisher<? extends SingleSource<? extends T>> sources)
static <T> @NonNull Flowable<T>
concatEager(@NonNull Publisher<? extends SingleSource<? extends T>> sources, int maxConcurrency)
Concatenates a
Publisher
sequence of
SingleSource
s eagerly into a single stream of values and runs a limited number of those inner
SingleSource
s at once.
static <T> @NonNull Flowable<T>
concatEagerDelayError(@NonNull Iterable<? extends SingleSource<? extends T>> sources)
Concatenates an
Iterable
sequence of
SingleSource
s eagerly into a single stream of values, delaying errors until all the inner sources terminate.
static <T> @NonNull Flowable<T>
concatEagerDelayError(@NonNull Iterable<? extends SingleSource<? extends T>> sources, int maxConcurrency)
Concatenates an
Iterable
sequence of
SingleSource
s eagerly into a single stream of values, delaying errors until all the inner sources terminate.
static <T> @NonNull Flowable<T>
concatEagerDelayError(@NonNull Publisher<? extends SingleSource<? extends T>> sources)
Concatenates a
Publisher
sequence of
SingleSource
s eagerly into a single stream of values, delaying errors until all the inner and the outer sequence terminate.
static <T> @NonNull Flowable<T>
concatEagerDelayError(@NonNull Publisher<? extends SingleSource<? extends T>> sources, int maxConcurrency)
Concatenates a
Publisher
sequence of
SingleSource
s eagerly into a single stream of values, running at most the specified number of those inner
SingleSource
s at once and delaying errors until all the inner and the outer sequence terminate.
<R> @NonNull Single<R>
concatMap(@NonNull Function<? super T,? extends SingleSource<? extends R>> mapper)
Returns a
Single
that is based on applying a specified function to the item emitted by the current
Single
, where that function returns a
SingleSource
.
@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
Single
, where that function returns a
CompletableSource
.
<R> @NonNull Maybe<R>
concatMapMaybe(@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
Single
, where that function returns a
MaybeSource
.
@NonNull Flowable<T>
concatWith(@NonNull SingleSource<? extends T> other)
Returns a
Flowable
that emits the item emitted by the current
Single
, then the item emitted by the specified
SingleSource
.
@NonNull Single<Boolean>
contains(@NonNull Object item)
Signals
true
if the current
Single
signals a success value that is
Object.equals(Object)
with the value provided.
@NonNull Single<Boolean>
contains(@NonNull Object item, @NonNull BiPredicate<Object,Object> comparer)
Signals
true
if the current
Single
signals a success value that is equal with the value provided by calling a
BiPredicate
.
static <T> @NonNull Single<T>
create(@NonNull SingleOnSubscribe<T> source)
Provides an API (via a cold Single
) that bridges the reactive world with the callback-style world.
static <T> @NonNull Single<T>
defer(@NonNull Supplier<? extends SingleSource<? extends T>> supplier)
@NonNull Single<T>
delay(long time, @NonNull TimeUnit unit)
Delays the emission of the success signal from the current Single
by the specified amount.
@NonNull Single<T>
delay(long time, @NonNull TimeUnit unit, boolean delayError)
Delays the emission of the success or error signal from the current Single
by the specified amount.
@NonNull Single<T>
delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler)
Delays the emission of the success signal from the current Single
by the specified amount.
@NonNull Single<T>
delay(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, boolean delayError)
Delays the emission of the success or error signal from the current Single
by the specified amount.
@NonNull Single<T>
delaySubscription(@NonNull CompletableSource subscriptionIndicator)
Delays the actual subscription to the current
Single
until the given other
CompletableSource
completes.
@NonNull Single<T>
delaySubscription(long time, @NonNull TimeUnit unit)
Delays the actual subscription to the current Single
until the given time delay elapsed.
@NonNull Single<T>
delaySubscription(long time, @NonNull TimeUnit unit, @NonNull Scheduler scheduler)
Delays the actual subscription to the current Single
until the given time delay elapsed.
<U> @NonNull Single<T>
delaySubscription(@NonNull ObservableSource<U> subscriptionIndicator)
Delays the actual subscription to the current
Single
until the given other
ObservableSource
signals its first value or completes.
<U> @NonNull Single<T>
delaySubscription(@NonNull Publisher<U> subscriptionIndicator)
Delays the actual subscription to the current
Single
until the given other
Publisher
signals its first value or completes.
<U> @NonNull Single<T>
delaySubscription(@NonNull SingleSource<U> subscriptionIndicator)
Delays the actual subscription to the current
Single
until the given other
SingleSource
signals success.
<R> @NonNull Maybe<R>
dematerialize(@NonNull Function<? super T,Notification<R>> selector)
Maps the
Notification
success value of the current
Single
back into normal
onSuccess
,
onError
or
onComplete
signals as a
Maybe
source.
@NonNull Single<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 Single<T>
doAfterTerminate(@NonNull Action onAfterTerminate)
Registers an
Action
to be called after this
Single
invokes either
onSuccess
or
onError
.
@NonNull Single<T>
doFinally(@NonNull Action onFinally)
Calls the specified action after this Single
signals onSuccess
or onError
or gets disposed by the downstream.
@NonNull Single<T>
doOnDispose(@NonNull Action onDispose)
@NonNull Single<T>
doOnError(@NonNull Consumer<? super Throwable> onError)
Calls the shared consumer with the error sent via
onError
for each
SingleObserver
that subscribes to the current
Single
.
@NonNull Single<T>
doOnEvent(@NonNull BiConsumer<? super T,? super Throwable> onEvent)
Calls the shared consumer with the error sent via
onError
or the value via
onSuccess
for each
SingleObserver
that subscribes to the current
Single
.
@NonNull Single<T>
doOnLifecycle(@NonNull Consumer<? super Disposable> onSubscribe, @NonNull Action onDispose)
Calls the appropriate
onXXX
method (shared between all
SingleObserver
s) for the lifecycle events of the sequence (subscription, disposal).
@NonNull Single<T>
doOnSubscribe(@NonNull Consumer<? super Disposable> onSubscribe)
Calls the shared consumer with the
Disposable
sent through the
onSubscribe
for each
SingleObserver
that subscribes to the current
Single
.
@NonNull Single<T>
doOnSuccess(@NonNull Consumer<? super T> onSuccess)
Calls the shared consumer with the success value sent via
onSuccess
for each
SingleObserver
that subscribes to the current
Single
.
@NonNull Single<T>
doOnTerminate(@NonNull Action onTerminate)
Returns a Single
instance that calls the given onTerminate
callback just before this Single
completes normally or with an exception.
static <T> @NonNull Single<T>
error(@NonNull Supplier<? extends Throwable> supplier)
static <T> @NonNull Single<T>
error(@NonNull Throwable throwable)
Returns a
Single
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 Single
via a predicate function and emitting it if the predicate returns true
, completing otherwise.
<R> @NonNull Single<R>
flatMap(@NonNull Function<? super T,? extends SingleSource<? extends R>> mapper)
Returns a
Single
that is based on applying a specified function to the item emitted by the current
Single
, where that function returns a
SingleSource
.
<R> @NonNull Single<R>
flatMap(@NonNull Function<? super T,? extends SingleSource<? extends R>> onSuccessMapper, @NonNull Function<? super Throwable,? extends SingleSource<? extends R>> onErrorMapper)
Maps the
onSuccess
or
onError
signals of the current
Single
into a
SingleSource
and emits that
SingleSource
's signals.
<U,R> @NonNull Single<R>
flatMap(@NonNull Function<? super T,? extends SingleSource<? extends U>> mapper, @NonNull BiFunction<? super T,? super U,? extends R> combiner)
Returns a
Single
that emits the results of a specified function to the pair of values emitted by the current
Single
and a specified mapped
SingleSource
.
@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
Single
, where that function returns a
CompletableSource
.
<R> @NonNull Maybe<R>
flatMapMaybe(@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
Single
, where that function returns a
MaybeSource
.
<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
Single
, 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
Single
, where that function returns a
Publisher
.
<U> @NonNull Flowable<U>
flattenAsFlowable(@NonNull Function<? super T,? extends Iterable<? extends U>> mapper)
Maps the success value of the current
Single
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
Single
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 Single<T>
fromCallable(@NonNull Callable<? extends T> callable)
Returns a
Single
that invokes the given
Callable
for each incoming
SingleObserver
and emits its value or exception to them.
static <T> @NonNull Single<T>
fromCompletionStage(@NonNull CompletionStage<T> stage)
Signals the completion value or error of the given (hot)
CompletionStage
-based asynchronous calculation.
static <T> @NonNull Single<T>
fromFuture(@NonNull Future<? extends T> future)
Converts a
Future
into a
Single
and awaits its outcome in a blocking fashion.
static <T> @NonNull Single<T>
fromFuture(@NonNull Future<? extends T> future, long timeout, @NonNull TimeUnit unit)
Converts a
Future
into a
Single
and awaits its outcome, or timeout, in a blocking fashion.
static <T> @NonNull Single<T>
fromMaybe(@NonNull MaybeSource<T> maybe)
Returns a
Single
instance that when subscribed to, subscribes to the
MaybeSource
instance and emits
onSuccess
as a single item, turns an
onComplete
into
NoSuchElementException
error signal or forwards the
onError
signal.
static <T> @NonNull Single<T>
fromMaybe(@NonNull MaybeSource<T> maybe, T defaultItem)
Returns a
Single
instance that when subscribed to, subscribes to the
MaybeSource
instance and emits
onSuccess
as a single item, emits the
defaultItem
for an
onComplete
signal or forwards the
onError
signal.
static <T> @NonNull Single<T>
fromObservable(@NonNull ObservableSource<? extends T> observable)
Wraps a specific
ObservableSource
into a
Single
and signals its single element or error.
static <T> @NonNull Single<T>
fromPublisher(@NonNull Publisher<? extends T> publisher)
Wraps a specific
Publisher
into a
Single
and signals its single element or error.
static <T> @NonNull Single<T>
fromSupplier(@NonNull Supplier<? extends T> supplier)
Returns a
Single
that invokes passed supplier and emits its result for each individual
SingleObserver
that subscribes.
@NonNull Single<T>
hide()
Hides the identity of the current
Single
, including the
Disposable
that is sent to the downstream via
onSubscribe()
.
@NonNull Completable
ignoreElement()
Returns a
Completable
that ignores the success value of this
Single
and signals
onComplete
instead.
static <T> @NonNull Single<T>
just(T item)
Returns a Single
that emits a specified item.
<R> @NonNull Single<R>
lift(@NonNull SingleOperator<? extends R,? super T> lift)
This method requires advanced knowledge about building operators, please consider other standard composition methods first;
Returns a
Single
which, when subscribed to, invokes the
apply(SingleObserver)
method of the provided
SingleOperator
for each individual downstream
Single
and allows the insertion of a custom operator by accessing the downstream's
SingleObserver
during this subscription phase and providing a new
SingleObserver
, containing the custom operator's intended business logic, that will be used in the subscription process going further upstream.
<R> @NonNull Single<R>
map(@NonNull Function<? super T,? extends R> mapper)
Returns a Single
that applies a specified function to the item emitted by the current Single
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 as a
Maybe
.
@NonNull Single<Notification<T>>
materialize()
Maps the signal types of this
Single
into a
Notification
of the same kind and emits it as a single success value to downstream.
static <T> @NonNull Flowable<T>
merge(@NonNull Iterable<? extends SingleSource<? extends T>> sources)
static <T> @NonNull Flowable<T>
merge(@NonNull Publisher<? extends SingleSource<? extends T>> sources)
static <T> @NonNull Single<T>
merge(@NonNull SingleSource<? extends SingleSource<? extends T>> source)
Flattens a
SingleSource
that emits a
SingleSingle
into a single
Single
that emits the item emitted by the nested
SingleSource
, without any transformation.
static <T> @NonNull Flowable<T>
merge(@NonNull SingleSource<? extends T> source1, @NonNull SingleSource<? extends T> source2)
static <T> @NonNull Flowable<T>
merge(@NonNull SingleSource<? extends T> source1, @NonNull SingleSource<? extends T> source2, @NonNull SingleSource<? extends T> source3)
static <T> @NonNull Flowable<T>
merge(@NonNull SingleSource<? extends T> source1, @NonNull SingleSource<? extends T> source2, @NonNull SingleSource<? extends T> source3, @NonNull SingleSource<? extends T> source4)
static <T> @NonNull Flowable<T>
mergeArray(SingleSource<? extends T>... sources)
Merges an array of
SingleSource
instances into a single
Flowable
sequence, running all
SingleSource
s at once.
static <T> @NonNull Flowable<T>
mergeArrayDelayError(SingleSource<? extends T>... sources)
Flattens an array of
SingleSource
s into one
Flowable
, in a way that allows a subscriber to receive all successfully emitted items from each of the source
SingleSource
s without being interrupted by an error notification from one of them.
static <T> @NonNull Flowable<T>
mergeDelayError(@NonNull Iterable<? extends SingleSource<? extends T>> sources)
Merges an
Iterable
sequence of
SingleSource
instances into one
Flowable
sequence, running all
SingleSource
s at once and delaying any error(s) until all sources succeed or fail.
static <T> @NonNull Flowable<T>
mergeDelayError(@NonNull Publisher<? extends SingleSource<? extends T>> sources)
Merges a sequence of
SingleSource
instances emitted by a
Publisher
into a
Flowable
sequence, running all
SingleSource
s at once and delaying any error(s) until all sources succeed or fail.
static <T> @NonNull Flowable<T>
mergeDelayError(@NonNull SingleSource<? extends T> source1, @NonNull SingleSource<? extends T> source2)
Flattens two
SingleSource
s into one
Flowable
, without any transformation, delaying any error(s) until all sources succeed or fail.
static <T> @NonNull Flowable<T>
mergeDelayError(@NonNull SingleSource<? extends T> source1, @NonNull SingleSource<? extends T> source2, @NonNull SingleSource<? extends T> source3)
Flattens two
SingleSource
s into one
Flowable
, without any transformation, delaying any error(s) until all sources succeed or fail.
static <T> @NonNull Flowable<T>
mergeDelayError(@NonNull SingleSource<? extends T> source1, @NonNull SingleSource<? extends T> source2, @NonNull SingleSource<? extends T> source3, @NonNull SingleSource<? extends T> source4)
Flattens two
SingleSource
s into one
Flowable
, without any transformation, delaying any error(s) until all sources succeed or fail.
@NonNull Flowable<T>
mergeWith(@NonNull SingleSource<? extends T> other)
static <T> @NonNull Single<T>
never()
Returns a singleton instance of a never-signaling Single
(only calls onSubscribe
).
@NonNull Single<T>
observeOn(@NonNull Scheduler scheduler)
Signals the success item or the terminal signals of the current
Single
on the specified
Scheduler
, asynchronously.
<U> @NonNull Maybe<U>
ofType(@NonNull Class<U> clazz)
Filters the items emitted by the current
Single
, only emitting its success value if that is an instance of the supplied
Class
.
@NonNull Maybe<T>
onErrorComplete()
Returns a
Maybe
instance that if the current
Single
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
Single
emits an error and the predicate returns
true
, it will emit an
onComplete
and swallow the throwable.
@NonNull Single<T>
onErrorResumeNext(@NonNull Function<? super Throwable,? extends SingleSource<? extends T>> fallbackSupplier)
Resumes the flow with a
SingleSource
returned for the failure
Throwable
of the current
Single
by a function instead of signaling the error via
onError
.
@NonNull Single<T>
onErrorResumeWith(@NonNull SingleSource<? extends T> fallback)
Resumes the flow with the given
SingleSource
when the current
Single
fails instead of signaling the error via
onError
.
@NonNull Single<T>
onErrorReturn(@NonNull Function<Throwable,? extends T> itemSupplier)
Ends the flow with a success item returned by a function for the
Throwable
error signaled by the current
Single
instead of signaling the error via
onError
.
@NonNull Single<T>
onErrorReturnItem(T item)
Signals the specified value as success in case the current Single
signals an error.
@NonNull Single<T>
onTerminateDetach()
Nulls out references to the upstream producer and downstream
SingleObserver
if the sequence is terminated or downstream calls
dispose()
.
@NonNull Flowable<T>
repeat()
Repeatedly re-subscribes to the current
Single
and emits each success value as a
Flowable
sequence.
@NonNull Flowable<T>
repeat(long times)
Re-subscribes to the current
Single
at most the given number of times and emits each success value as a
Flowable
sequence.
@NonNull Flowable<T>
repeatUntil(@NonNull BooleanSupplier stop)
Re-subscribes to the current
Single
until the given
BooleanSupplier
returns
true
and emits the success items as a
Flowable
sequence.
@NonNull Flowable<T>
repeatWhen(@NonNull Function<? super Flowable<Object>,? extends Publisher<?>> handler)
Re-subscribes to the current
Single
if the
Publisher
returned by the handler function signals a value in response to a value signaled through the
Flowable
the handler receives.
@NonNull Single<T>
retry()
Repeatedly re-subscribes to the current Single
indefinitely if it fails with an onError
.
@NonNull Single<T>
retry(@NonNull BiPredicate<? super Integer,? super Throwable> predicate)
Re-subscribe to the current Single
if the given predicate returns true
when the Single
fails with an onError
.
@NonNull Single<T>
retry(long times)
Repeatedly re-subscribe at most the specified times to the current Single
if it fails with an onError
.
@NonNull Single<T>
retry(long times, @NonNull Predicate<? super Throwable> predicate)
Repeatedly re-subscribe at most times or until the predicate returns false
, whichever happens first if it fails with an onError
.
@NonNull Single<T>
retry(@NonNull Predicate<? super Throwable> predicate)
Re-subscribe to the current Single
if the given predicate returns true
when the Single
fails with an onError
.
@NonNull Single<T>
retryUntil(@NonNull BooleanSupplier stop)
Retries until the given stop function returns true
.
@NonNull Single<T>
retryWhen(@NonNull Function<? super Flowable<Throwable>,? extends Publisher<?>> handler)
Re-subscribes to the current
Single
if and when the
Publisher
returned by the handler function signals a value.
void
safeSubscribe(@NonNull SingleObserver<? super T> observer)
static <T> @NonNull Single<Boolean>
sequenceEqual(@NonNull SingleSource<? extends T> source1, @NonNull SingleSource<? extends T> source2)
@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
Single
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
Single
.
@NonNull Flowable<T>
startWith(@NonNull SingleSource<T> other)
Returns a
Flowable
which first runs the other
SingleSource
then the current
Single
if the other succeeded normally.
@NonNull Disposable
subscribe()
Subscribes to a Single
but ignore its emission or notification.
@NonNull Disposable
subscribe(@NonNull BiConsumer<? super T,? super Throwable> onCallback)
Subscribes to a Single
and provides a composite callback to handle the item it emits or any error notification it issues.
@NonNull Disposable
subscribe(@NonNull Consumer<? super T> onSuccess)
Subscribes to a Single
and provides a callback to handle the item it emits.
@NonNull Disposable
subscribe(@NonNull Consumer<? super T> onSuccess, @NonNull Consumer<? super Throwable> onError)
Subscribes to a Single
and provides callbacks to handle the item it emits or any error notification it issues.
@NonNull Disposable
subscribe(@NonNull Consumer<? super T> onSuccess, @NonNull Consumer<? super Throwable> onError, @NonNull DisposableContainer container)
Wraps the given onXXX callbacks into a
Disposable
SingleObserver
, adds it to the given
DisposableContainer
and ensures, that if the upstream terminates or this particular
Disposable
is disposed, the
SingleObserver
is removed from the given container.
void
subscribe(@NonNull SingleObserver<? super T> observer)
protected abstract void
subscribeActual(@NonNull SingleObserver<? super T> observer)
Implement this method in subclasses to handle the incoming
SingleObserver
s.
@NonNull Single<T>
subscribeOn(@NonNull Scheduler scheduler)
<E extends SingleObserver<? super T>>
E
subscribeWith(E observer)
Subscribes a given
SingleObserver
(subclass) to this
Single
and returns the given
SingleObserver
as is.
static <T> @NonNull Flowable<T>
switchOnNext(@NonNull Publisher<? extends SingleSource<? extends T>> sources)
Switches between
SingleSource
s emitted by the source
Publisher
whenever a new
SingleSource
is emitted, disposing the previously running
SingleSource
, exposing the success items as a
Flowable
sequence.
static <T> @NonNull Flowable<T>
switchOnNextDelayError(@NonNull Publisher<? extends SingleSource<? extends T>> sources)
Switches between
SingleSource
s emitted by the source
Publisher
whenever a new
SingleSource
is emitted, disposing the previously running
SingleSource
, exposing the success items as a
Flowable
sequence and delaying all errors from all of them until all terminate.
@NonNull Single<T>
takeUntil(@NonNull CompletableSource other)
Returns a
Single
that emits the item emitted by the current
Single
until a
CompletableSource
terminates.
<E> @NonNull Single<T>
takeUntil(@NonNull Publisher<E> other)
Returns a
Single
that emits the item emitted by the current
Single
until a
Publisher
emits an item or completes.
<E> @NonNull Single<T>
takeUntil(@NonNull SingleSource<? extends E> other)
Returns a Single
that emits the item emitted by the current Single
until a second Single
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
Single
.
@NonNull Single<Timed<T>>
timeInterval()
Measures the time (in milliseconds) between the subscription and success item emission of the current
Single
and signals it as a tuple (
Timed
) success value.
@NonNull Single<Timed<T>>
timeInterval(@NonNull Scheduler scheduler)
Measures the time (in milliseconds) between the subscription and success item emission of the current
Single
and signals it as a tuple (
Timed
) success value.
@NonNull Single<Timed<T>>
timeInterval(@NonNull TimeUnit unit)
Measures the time between the subscription and success item emission of the current
Single
and signals it as a tuple (
Timed
) success value.
@NonNull Single<Timed<T>>
timeInterval(@NonNull TimeUnit unit, @NonNull Scheduler scheduler)
Measures the time between the subscription and success item emission of the current
Single
and signals it as a tuple (
Timed
) success value.
@NonNull Single<T>
timeout(long timeout, @NonNull TimeUnit unit)
Signals a
TimeoutException
if the current
Single
doesn't signal a success value within the specified timeout window.
@NonNull Single<T>
timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler)
Signals a
TimeoutException
if the current
Single
doesn't signal a success value within the specified timeout window.
@NonNull Single<T>
timeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull SingleSource<? extends T> fallback)
Runs the current
Single
and if it doesn't signal within the specified timeout window, it is disposed and the other
SingleSource
subscribed to.
@NonNull Single<T>
timeout(long timeout, @NonNull TimeUnit unit, @NonNull SingleSource<? extends T> fallback)
Runs the current
Single
and if it doesn't signal within the specified timeout window, it is disposed and the other
SingleSource
subscribed to.
static @NonNull Single<Long>
timer(long delay, @NonNull TimeUnit unit)
Signals success with 0L value after the given delay when a
SingleObserver
subscribes.
static @NonNull Single<Long>
timer(long delay, @NonNull TimeUnit unit, @NonNull Scheduler scheduler)
@NonNull Single<Timed<T>>
timestamp()
Combines the success value from the current
Single
with the current time (in milliseconds) of its reception, using the
computation
Scheduler
as time source, then signals them as a
Timed
instance.
@NonNull Single<Timed<T>>
timestamp(@NonNull Scheduler scheduler)
Combines the success value from the current
Single
with the current time (in milliseconds) of its reception, using the given
Scheduler
as time source, then signals them as a
Timed
instance.
@NonNull Single<Timed<T>>
timestamp(@NonNull TimeUnit unit)
Combines the success value from the current
Single
with the current time of its reception, using the
computation
Scheduler
as time source, then signals it as a
Timed
instance.
@NonNull Single<Timed<T>>
timestamp(@NonNull TimeUnit unit, @NonNull Scheduler scheduler)
Combines the success value from the current
Single
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 SingleConverter<T,? extends R> converter)
Calls the specified converter function during assembly time and returns its resulting value.
@NonNull CompletionStage<T>
toCompletionStage()
@NonNull Flowable<T>
toFlowable()
@NonNull Future<T>
toFuture()
Returns a
Future
representing the single value emitted by this
Single
.
@NonNull Maybe<T>
toMaybe()
Converts this
Single
into a
Maybe
.
@NonNull Observable<T>
toObservable()
static <T> @NonNull Single<T>
unsafeCreate(@NonNull SingleSource<T> onSubscribe)
Advanced use only:
creates a
Single
instance without any safeguards by using a callback that is called with a
SingleObserver
.
@NonNull Single<T>
unsubscribeOn(@NonNull Scheduler scheduler)
static <T,U> @NonNull Single<T>
using(@NonNull Supplier<U> resourceSupplier, @NonNull Function<? super U,? extends SingleSource<? extends T>> sourceSupplier, @NonNull Consumer<? super U> resourceCleanup)
Allows using and disposing a resource while running a
SingleSource
instance generated from that resource (similar to a try-with-resources).
static <T,U> @NonNull Single<T>
using(@NonNull Supplier<U> resourceSupplier, @NonNull Function<? super U,? extends SingleSource<? extends T>> sourceSupplier, @NonNull Consumer<? super U> resourceCleanup, boolean eager)
Allows using and disposing a resource while running a
SingleSource
instance generated from that resource (similar to a try-with-resources).
static <T> @NonNull Single<T>
wrap(@NonNull SingleSource<T> source)
Wraps a
SingleSource
instance into a new
Single
instance if not already a
Single
instance.
static <T,R> @NonNull Single<R>
zip(@NonNull Iterable<? extends SingleSource<? extends T>> sources, @NonNull Function<? super Object[],? extends R> zipper)
Waits until all
SingleSource
sources provided by the
Iterable
sequence signal a success value and calls a zipper function with an array of these values to return a result to be emitted to the downstream.
static <T1,T2,R> @NonNull Single<R>
zip(@NonNull SingleSource<? extends T1> source1, @NonNull SingleSource<? extends T2> source2, @NonNull BiFunction<? super T1,? super T2,? extends R> zipper)
Returns a
Single
that emits the results of a specified combiner function applied to two items emitted by two other
SingleSource
s.
static <T1,T2,T3,R>
@NonNull Single<R>
zip(@NonNull SingleSource<? extends T1> source1, @NonNull SingleSource<? extends T2> source2, @NonNull SingleSource<? extends T3> source3, @NonNull Function3<? super T1,? super T2,? super T3,? extends R> zipper)
Returns a
Single
that emits the results of a specified combiner function applied to three items emitted by three other
SingleSource
s.
static <T1,T2,T3,T4,R>
@NonNull Single<R>
zip(@NonNull SingleSource<? extends T1> source1, @NonNull SingleSource<? extends T2> source2, @NonNull SingleSource<? extends T3> source3, @NonNull SingleSource<? extends T4> source4, @NonNull Function4<? super T1,? super T2,? super T3,? super T4,? extends R> zipper)
Returns a
Single
that emits the results of a specified combiner function applied to four items emitted by four other
SingleSource
s.
static <T1,T2,T3,T4,T5,R>
@NonNull Single<R>
zip(@NonNull SingleSource<? extends T1> source1, @NonNull SingleSource<? extends T2> source2, @NonNull SingleSource<? extends T3> source3, @NonNull SingleSource<? extends T4> source4, @NonNull SingleSource<? extends T5> source5, @NonNull Function5<? super T1,? super T2,? super T3,? super T4,? super T5,? extends R> zipper)
Returns a
Single
that emits the results of a specified combiner function applied to five items emitted by five other
SingleSource
s.
static <T1,T2,T3,T4,T5,T6,R>
@NonNull Single<R>
zip(@NonNull SingleSource<? extends T1> source1, @NonNull SingleSource<? extends T2> source2, @NonNull SingleSource<? extends T3> source3, @NonNull SingleSource<? extends T4> source4, @NonNull SingleSource<? extends T5> source5, @NonNull SingleSource<? extends T6> source6, @NonNull Function6<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? extends R> zipper)
Returns a
Single
that emits the results of a specified combiner function applied to six items emitted by six other
SingleSource
s.
static <T1,T2,T3,T4,T5,T6,T7,R>
@NonNull Single<R>
zip(@NonNull SingleSource<? extends T1> source1, @NonNull SingleSource<? extends T2> source2, @NonNull SingleSource<? extends T3> source3, @NonNull SingleSource<? extends T4> source4, @NonNull SingleSource<? extends T5> source5, @NonNull SingleSource<? extends T6> source6, @NonNull SingleSource<? extends T7> source7, @NonNull Function7<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? extends R> zipper)
Returns a
Single
that emits the results of a specified combiner function applied to seven items emitted by seven other
SingleSource
s.
static <T1,T2,T3,T4,T5,T6,T7,T8,R>
@NonNull Single<R>
zip(@NonNull SingleSource<? extends T1> source1, @NonNull SingleSource<? extends T2> source2, @NonNull SingleSource<? extends T3> source3, @NonNull SingleSource<? extends T4> source4, @NonNull SingleSource<? extends T5> source5, @NonNull SingleSource<? extends T6> source6, @NonNull SingleSource<? extends T7> source7, @NonNull SingleSource<? 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
Single
that emits the results of a specified combiner function applied to eight items emitted by eight other
SingleSource
s.
static <T1,T2,T3,T4,T5,T6,T7,T8,T9,R>
@NonNull Single<R>
zip(@NonNull SingleSource<? extends T1> source1, @NonNull SingleSource<? extends T2> source2, @NonNull SingleSource<? extends T3> source3, @NonNull SingleSource<? extends T4> source4, @NonNull SingleSource<? extends T5> source5, @NonNull SingleSource<? extends T6> source6, @NonNull SingleSource<? extends T7> source7, @NonNull SingleSource<? extends T8> source8, @NonNull SingleSource<? 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
Single
that emits the results of a specified combiner function applied to nine items emitted by nine other
SingleSource
s.
static <T,R> @NonNull Single<R>
zipArray(@NonNull Function<? super Object[],? extends R> zipper, SingleSource<? extends T>... sources)
Waits until all
SingleSource
sources provided via an array signal a success value and calls a zipper function with an array of these values to return a result to be emitted to downstream.
<U,R> @NonNull Single<R>
zipWith(@NonNull SingleSource<U> other, @NonNull BiFunction<? super T,? super U,? extends R> zipper)
Returns a
Single
that emits the result of applying a specified function to the pair of items emitted by the current
Single
and another specified
SingleSource
.
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