Single
Single class implements the Reactive Pattern for a single value response.
Single behaves similarly to Observable except that it can only emit either a single successful
value or an error (there is no onComplete notification as there is for an Observable).
The Single class implements the SingleSource base interface and the default consumer
type it interacts with is the SingleObserver via the subscribe(SingleObserver) method.
The Single operates with the following sequential protocol:
onSubscribe (onSuccess | onError)?
Note that onSuccess and onError are mutually exclusive events; unlike Observable,
onSuccess is never followed by onError.
Like Observable, a running Single can be stopped through the Disposable instance
provided to consumers through SingleObserver#onSubscribe.
Like an Observable, a Single is lazy, can be either "hot" or "cold", synchronous or
asynchronous. Single instances returned by the methods of this class are cold
and there is a standard hot implementation in the form of a subject:
SingleSubject.
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.
For more information see the ReactiveX documentation.
Example:
Disposable d = Single.just("Hello World")
.delay(10, TimeUnit.SECONDS, Schedulers.io())
.subscribeWith(new DisposableSingleObserver<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();
}
});
Thread.sleep(5000);
d.dispose();
Note that by design, subscriptions via subscribe(SingleObserver) can't be disposed
from the outside (hence the
void return of the subscribe(SingleObserver) method) and it is the
responsibility of the implementor of the SingleObserver to allow this to happen.
RxJava supports such usage with the standard
DisposableSingleObserver instance.
For convenience, the subscribeWith(SingleObserver) method is provided as well to
allow working with a SingleObserver (or subclass) instance to be applied with in
a fluent manner (such as in the example above).
io.reactivex.rxjava3.observers.DisposableSingleObserver
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static < the value type T> @NonNull Single | Returns: the newSingle instancethe sources)Iterable sequence of sources. A subscription to each source will
occur in the same order as in this Iterable.Runs multiple |
| public static < the value type T> @NonNull Single | Returns: the newSingle instancethe array of sources. A subscription to each source will
occur in the same order as in this array. sources)Runs multiple |
| public final @NonNull Single | Returns: the newSingle instance. A subscription to this provided source will occur after subscribing
to the current source.the other other)SingleSource to race for the first emission of success or errorSignals the event of this or the other |
| public final T | Returns: the success valueWaits in a blocking fashion until the current |
| public final void | blockingSubscribe()
Subscribes to the current |
| public final void | blockingSubscribe(@NonNull Consumer<? super T>
the onSuccess)Consumer to call if the current Single succeedsSubscribes to the current |
| public final void | blockingSubscribe(@NonNull Consumer<? super T>
the onSuccess, @NonNull Consumer<? super Throwable> Consumer to call if the current Single succeedsthe onError)Consumer to call if the current Single signals an errorSubscribes to the current |
| public final void | blockingSubscribe(@NonNull SingleObserver<? super T>
the observer)SingleObserver to call methods on the current threadSubscribes to the current |
| public final @NonNull Single | Returns: the newSingle instanceStores the success value or exception from the current |
| public final < the target type U> @NonNull Single | Returns: the newSingle instancethe type token to use for casting the success result from the current clazz)SingleCasts the success value of the current |
| public final < the value type of the single returned by the transformer function R> @NonNull Single | Returns: the newSingle instancethe transformer function, not transformer)nullTransform a |
| public static < the value type T> @NonNull Flowable | Returns: the newFlowable instancethe sources)Iterable sequence of SingleSource instancesConcatenate the single values, in a non-overlapping fashion, of the |
| public static < the value type T> @NonNull Observable | Returns: the newObservable instancethe sources)ObservableSource of SingleSource instancesConcatenate the single values, in a non-overlapping fashion, of the |
| public static < the value type T> @NonNull Flowable | Returns: the newFlowable instancethe sources)Publisher of SingleSource instancesConcatenate the single values, in a non-overlapping fashion, of the |
| public static < the value type T> @NonNull Flowable | Returns: the newFlowable instancethe sources, int Publisher of SingleSource instancesthe number of prefetch)SingleSources to prefetch from the PublisherConcatenate the single values, in a non-overlapping fashion, of the |
| public static < the common value type T> @NonNull Flowable | Returns: the newFlowable instancea source1, @NonNull SingleSource<? extends T> SingleSource to be concatenateda source2)SingleSource to be concatenatedReturns a |
| public static < the common value type T> @NonNull Flowable | Returns: the newFlowable instancea source1, @NonNull SingleSource<? extends T> SingleSource to be concatenateda source2, @NonNull SingleSource<? extends T> SingleSource to be concatenateda source3)SingleSource to be concatenatedReturns a |
| public static < the common value type T> @NonNull Flowable | Returns: the newFlowable instancea source1, @NonNull SingleSource<? extends T> SingleSource to be concatenateda source2, @NonNull SingleSource<? extends T> SingleSource to be concatenateda source3, @NonNull SingleSource<? extends T> SingleSource to be concatenateda source4)SingleSource to be concatenatedReturns a |
| public static < the value type T> @NonNull Flowable | Returns: the newFlowable instancethe array of sources)SingleSource instancesConcatenate the single values, in a non-overlapping fashion, of the |
| public static < the value type T> @NonNull Flowable | Returns: the newFlowable instancethe array of sources)SingleSource instancesConcatenate the single values, in a non-overlapping fashion, of the |
| public static < the value type T> @NonNull Flowable | Returns: the newFlowable instance with the specified concatenation behaviora sequence of sources)SingleSources that need to be eagerly concatenatedConcatenates a sequence of |
| public static < the value type T> @NonNull Flowable | Returns: the newFlowable instance with the specified concatenation behaviora sequence of sources)SingleSources that need to be eagerly concatenatedConcatenates a sequence of |
| public static < the common element base type T> @NonNull Flowable | Returns: the newFlowable with the concatenating behaviorthe sources)Iterable sequence of SingleSourcesConcatenates the |
| public static < the common element base type T> @NonNull Flowable | Returns: the newFlowable with the concatenating behaviorthe sources)Publisher sequence of SingleSourcesConcatenates the |
| public static < the common element base type T> @NonNull Flowable | Returns: the newFlowable with the concatenating behaviorthe sources, int Publisher sequence of SingleSourcesThe number of upstream items to prefetch so that fresh items are
ready to be mapped when a previous prefetch)SingleSource terminates.
The operator replenishes after half of the prefetch amount has been consumed
and turned into SingleSources.Concatenates the |
| public static < the value type T> @NonNull Flowable | Returns: the newFlowable instance with the specified concatenation behavioran sources)Iterable sequence of SingleSource that need to be eagerly concatenatedConcatenates an |
| public static < the value type T> @NonNull Flowable | Returns: the newFlowable instance with the specified concatenation behavioran sources, int Iterable sequence of SingleSource that need to be eagerly concatenatedthe maximum number of concurrently running inner maxConcurrency)SingleSources; Integer#MAX_VALUE
is interpreted as all inner SingleSources can be active at the same timeConcatenates an |
| public static < the value type T> @NonNull Flowable | Returns: the newFlowable instance with the specified concatenation behaviora sequence of sources)SingleSources that need to be eagerly concatenatedConcatenates a |
| public static < the value type T> @NonNull Flowable | Returns: the newFlowable instance with the specified concatenation behaviora sequence of sources, int SingleSources that need to be eagerly concatenatedthe maximum number of concurrently running inner maxConcurrency)SingleSources; Integer#MAX_VALUE
is interpreted as all inner SingleSources can be active at the same timeConcatenates a |
| public static < the value type T> @NonNull Flowable | Returns: the newFlowable instance with the specified concatenation behavioran sources)Iterable sequence of SingleSource that need to be eagerly concatenatedConcatenates an |
| public static < the value type T> @NonNull Flowable | Returns: the newFlowable instance with the specified concatenation behavioran sources, int Iterable sequence of SingleSource that need to be eagerly concatenatedthe maximum number of concurrently running inner maxConcurrency)SingleSources; Integer#MAX_VALUE
is interpreted as all inner SingleSources can be active at the same timeConcatenates an |
| public static < the value type T> @NonNull Flowable | Returns: the newFlowable instance with the specified concatenation behaviora sequence of sources)SingleSources that need to be eagerly concatenatedConcatenates a |
| public static < the value type T> @NonNull Flowable | Returns: the newFlowable instance with the specified concatenation behaviora sequence of sources, int SingleSources that need to be eagerly concatenatedthe number of inner maxConcurrency)SingleSources to run at onceConcatenates a |
| public final < the result value type R> @NonNull Single | Returns: the newSingle returned from mapper when applied to the item emitted by the current Singlea function that, when applied to the item emitted by the current mapper)Single, returns a SingleSourceReturns a |
| public final @NonNull Completable | Returns: the newCompletable instancea function that, when applied to the item emitted by the current mapper)Single, returns a
CompletableSourceReturns a |
| public final < the result value type R> @NonNull Maybe | Returns: the newMaybe returned from mapper when applied to the item emitted by the current Singlea function that, when applied to the item emitted by the current mapper)Single, returns a MaybeSourceReturns a |
| public final @NonNull Flowable | Returns: the newFlowable that emits the item emitted by the current Single, followed by the item emitted by
othera other)SingleSource to be concatenated after the currentReturns a |
| public final @NonNull Single | Returns: the newSingle instancethe value to compare against the success value of this item)SingleSignals |
| public final @NonNull Single | Returns: the newSingle instancethe value to compare against the success value of this item, @NonNull BiPredicate<Object, Object> Singlethe function that receives the success value of this comparer)Single, the value provided
and should return true if they are considered equalSignals |
| public static < the value type T> @NonNull Single | Returns: the newSingle instancethe emitter that is called when a source)SingleObserver subscribes to the returned SingleProvides an API (via a cold |
| public static < the value type T> @NonNull Single | Returns: the newSingle instancethe supplier)Supplier that is called for each individual SingleObserver and
returns a SingleSource instance to subscribe toCalls a |
| public final @NonNull Single | |
| public final @NonNull Single | Returns: the newSingle instancethe amount of time the success or error signal should be delayed for time, @NonNull TimeUnit the time unit unit, boolean if delayError)true, both success and error signals are delayed. if false, only success signals are delayed.Delays the emission of the success or error signal from the current |
| public final @NonNull Single | Returns: the newSingle instancethe amount of time the success signal should be delayed for time, @NonNull TimeUnit the time unit unit, @NonNull Scheduler the target scheduler to use for the non-blocking wait and emission scheduler)Delays the emission of the success signal from the current |
| public final @NonNull Single | Returns: the newSingle instancethe amount of time the success or error signal should be delayed for time, @NonNull TimeUnit the time unit unit, @NonNull Scheduler the target scheduler to use for the non-blocking wait and emission scheduler, boolean if delayError)true, both success and error signals are delayed. if false, only success signals are delayed.Delays the emission of the success or error signal from the current |
| public final @NonNull Single | Returns: the newSingle instancethe subscriptionIndicator)CompletableSource that has to complete before the subscription to the
current Single happensDelays the actual subscription to the current |
| public final < the element type of the other source U> @NonNull Single | Returns: the newSingle instancethe subscriptionIndicator)SingleSource that has to complete before the subscription to the
current Single happensDelays the actual subscription to the current |
| public final < the element type of the other source U> @NonNull Single | Returns: the newSingle instancethe subscriptionIndicator)ObservableSource that has to signal a value or complete before the
subscription to the current Single happensDelays the actual subscription to the current |
| public final < the element type of the other source U> @NonNull Single | Returns: the newSingle instancethe subscriptionIndicator)Publisher that has to signal a value or complete before the
subscription to the current Single happensDelays the actual subscription to the current |
| public final @NonNull Single | Returns: the newSingle instancethe time amount to wait with the subscription time, @NonNull TimeUnit the time unit of the waiting unit)Delays the actual subscription to the current |
| public final @NonNull Single | Returns: the newSingle instancethe time amount to wait with the subscription time, @NonNull TimeUnit the time unit of the waiting unit, @NonNull Scheduler the scheduler)Scheduler to wait on and subscribe on to the current SingleDelays the actual subscription to the current |
| public final < the result type R> @NonNull Maybe | Returns: the newMaybe instancethe function called with the success item and should
return a selector)Notification instance.Maps the |
| public final @NonNull Single | Returns: the newSingle instancethe onAfterSuccess)Consumer that will be called after emitting an item from upstream to the downstreamCalls the specified consumer with the success item after this item has been emitted to the downstream. |
| public final @NonNull Single | Returns: the newSingle that emits the same items as the current Single, then invokes the
Actionan onAfterTerminate)Action to be invoked when the current Single finishesRegisters an |
| public final @NonNull Single | |
| public final @NonNull Single | Returns: the newSingle instancethe action called when the subscription is disposed onDispose)Calls the shared |
| public final @NonNull Single | Returns: the newSingle instancethe consumer called with the success value of onError)onErrorCalls the shared consumer with the error sent via |
| public final @NonNull Single | Returns: the newSingle instancethe consumer called with the success value of onEvent onEvent)Calls the shared consumer with the error sent via |
| public final @NonNull Single | Returns: the newSingle instancecalled when the downstream disposes the onDispose)Disposable via dispose()Calls the appropriate |
| public final @NonNull Single | Returns: the newSingle instancethe consumer called with the onSubscribe)Disposable sent via onSubscribeCalls the shared consumer with the |
| public final @NonNull Single | Returns: the newSingle instancethe consumer called with the success value of onSuccess)onSuccessCalls the shared consumer with the success value sent via |
| public final @NonNull Single | Returns: the newSingle instancethe action to invoke when the consumer calls onTerminate)onSuccess or onErrorReturns a |
| public static < the value type T> @NonNull Single | |
| public static < the type of the item (ostensibly) emitted by the T> @NonNull SingleSingle | |
| public final @NonNull Maybe | Returns: the newMaybe that emit the item emitted by the current Single that the filter
evaluates as truea function that evaluates the item emitted by the current predicate)Single, returning true
if it passes the filterFilters the success item of the |
| public final < the result value type R> @NonNull Single | Returns: the newSingle returned from mapper when applied to the item emitted by the current Singlea function that, when applied to the item emitted by the current mapper)Single, returns a SingleSourceReturns a |
| public final < the type of items emitted by the U, SingleSource returned by the mapper functionthe type of items emitted by the resulting R> @NonNull SingleSingle | Returns: the newSingle instancea function that returns a mapper, @NonNull BiFunction<? super T, ? super U, ? extends R> SingleSource for the item emitted by the current Singlea function that combines one item emitted by each of the source and collection combiner)SingleSource and
returns an item to be emitted by the resulting SingleSourceReturns a |
| public final < the result type R> @NonNull Single | Returns: the newSingle instancea function that returns a onSuccessMapper, @NonNull Function<? super Throwable, ? extends SingleSource<? extends R>> SingleSource to merge for the onSuccess item emitted by this Singlea function that returns a onErrorMapper)SingleSource to merge for an onError notification from this SingleMaps the |
| public final @NonNull Completable | Returns: the newCompletable instancea function that, when applied to the item emitted by the current mapper)Single, returns a
CompletableSourceReturns a |
| public final < the result value type R> @NonNull Maybe | Returns: the newMaybe returned from mapper when applied to the item emitted by the current Singlea function that, when applied to the item emitted by the current mapper)Single, returns a MaybeSourceReturns a |
| public final < the result value type R> @NonNull Observable | Returns: the newObservable instancea function that, when applied to the item emitted by the current mapper)Single, returns an ObservableSourceReturns an |
| public final < the result value type R> @NonNull Flowable | Returns: the newFlowable instancea function that, when applied to the item emitted by the current mapper)Single, returns a
PublisherReturns a |
| public final < the type of item emitted by the resulting U> @NonNull FlowableIterable | Returns: the newFlowable instancea function that returns an mapper)Iterable sequence of values for when given an item emitted by the
current SingleMaps the success value of the current |
| public final < the type of item emitted by the resulting U> @NonNull ObservableIterable | Returns: the newObservable instancea function that returns an mapper)Iterable sequence of values for when given an item emitted by the
current SingleMaps the success value of the current |
| public final < the element type of the R> @NonNull FlowableStream and the output Flowable | Returns: the newFlowable instancethe function that receives the upstream success item and should
return a mapper)Stream of values to emit.Maps the upstream succecss value into a Java |
| public final < the element type of the R> @NonNull ObservableStream and the output Observable | Returns: the newObservable instancethe function that receives the upstream success item and should
return a mapper)Stream of values to emit.Maps the upstream succecss value into a Java |
| public static < the type of the item emitted by the T> @NonNull SingleSingle. | Returns: the newSingle whose SingleObservers' subscriptions trigger an invocation of the given function.function which execution should be deferred, it will be invoked when callable)SingleObserver will subscribe to the Single.Returns a |
| public static < the element type of the T> @NonNull SingleCompletionStage | Returns: the newSingle instancethe stage)CompletionStage to convert to Single and signal its success value or errorSignals the completion value or error of the given (hot) |
| public static < the type of object that the T> @NonNull SingleFuture returns, and also the type of item to be emitted by
the resulting Single | Returns: the newSingle that emits the item from the source Futurethe source future)FutureConverts a |
| public static < the type of object that the T> @NonNull SingleFuture returns, and also the type of item to be emitted by
the resulting Single | Returns: the newSingle that emits the item from the source Futurethe source future, long Futurethe maximum time to wait before calling timeout, @NonNull TimeUnit getthe unit)TimeUnit of the timeout argumentConverts a |
| public static < the value type of the T> @NonNull SingleMaybeSource element | Returns: the newSingle instancethe maybe)MaybeSource instance to subscribe to, not nullReturns a |
| public static < the value type of the T> @NonNull SingleMaybeSource element | Returns: the newSingle instancethe maybe, T MaybeSource instance to subscribe to, not nullthe item to signal if the current defaultItem)MaybeSource is emptyReturns a |
| public static < the type of the item emitted by the T> @NonNull SingleSingle. | Returns: the newSingle instancethe source sequence to wrap, not observable)nullWraps a specific |
| public static < the value type T> @NonNull Single | Returns: the newSingle instancethe source publisher)Publisher instance, not nullWraps a specific |
| public static < the type of the item emitted by the T> @NonNull SingleSingle. | Returns: the newSingle whose SingleObservers' subscriptions trigger an invocation of the given function.function which execution should be deferred, it will be invoked when supplier)SingleObserver subscribes to the Single.Returns a |
| public final @NonNull Single | Returns: the newSingle instanceHides the identity of the current |
| public final @NonNull Completable | Returns: the newCompletable instanceReturns a |
| public static < the type of that item T> @NonNull Single | Returns: the newSingle that emits itemthe item to emit item)Returns a |
| public final < the output value type R> @NonNull Single | Returns: the newSingle instancethe lift)SingleOperator that receives the downstream's SingleObserver and should return
a SingleObserver with custom behavior to be used as the consumer for the current
Single.This method requires advanced knowledge about building operators, please consider
other standard composition methods first;
Returns a |
| public final < the result value type R> @NonNull Single | Returns: the newSingle that emits the item from the current Single, transformed by the specified functiona function to apply to the item emitted by the mapper)SingleReturns a |
| public final < the non- R> @NonNull Maybenull output type | Returns: the newMaybe instancethe function that receives the upstream success item and should return a non-empty mapper)Optional
to emit as the success output or an empty Optional to complete the MaybeMaps the upstream success value into an |
| public final @NonNull Single | Returns: the newSingle instanceMaps the signal types of this |
| public static < the common and resulting value type T> @NonNull Flowable | Returns: the newFlowable instancethe sources)Iterable sequence of SingleSource sourcesMerges an |
| public static < the common and resulting value type T> @NonNull Flowable | Returns: the newFlowable instancethe sources)Publisher emitting a sequence of SingleSourcesMerges a sequence of |
| public static < the value type of the sources and the output T> @NonNull Single | Returns: the newSingle that emits the item that is the result of flattening the Single emitted
by sourcea source)Single that emits a SingleFlattens a |
| public static < the common value type T> @NonNull Flowable | Returns: the newFlowable that emits all of the items emitted by the source SingleSourcesa source1, @NonNull SingleSource<? extends T> SingleSource to be mergeda source2)SingleSource to be mergedFlattens two |
| public static < the common value type T> @NonNull Flowable | Returns: the newFlowable that emits all of the items emitted by the source SingleSourcesa source1, @NonNull SingleSource<? extends T> SingleSource to be mergeda source2, @NonNull SingleSource<? extends T> SingleSource to be mergeda source3)SingleSource to be mergedFlattens three |
| public static < the common value type T> @NonNull Flowable | Returns: the newFlowable that emits all of the items emitted by the source SingleSourcesa source1, @NonNull SingleSource<? extends T> SingleSource to be mergeda source2, @NonNull SingleSource<? extends T> SingleSource to be mergeda source3, @NonNull SingleSource<? extends T> SingleSource to be mergeda source4)SingleSource to be mergedFlattens four |
| public static < the common and resulting value type T> @NonNull Flowable | Returns: the newFlowable instancethe array sequence of sources)SingleSource sourcesMerges an array of |
| public static < the common element base type T> @NonNull Flowable | Returns: the newFlowable instancethe array of sources)SingleSourcesFlattens an array of |
| public static < the common and resulting value type T> @NonNull Flowable | Returns: the newFlowable instancethe sources)Iterable sequence of SingleSourcesMerges an |
| public static < the common and resulting value type T> @NonNull Flowable | Returns: the newFlowable instancethe sources)Flowable sequence of SingleSourcesMerges a sequence of |
| public static < the common value type T> @NonNull Flowable | Returns: the newFlowable that emits all of the items emitted by the source SingleSourcesa source1, @NonNull SingleSource<? extends T> SingleSource to be mergeda source2)SingleSource to be mergedFlattens two |
| public static < the common value type T> @NonNull Flowable | Returns: the newFlowable that emits all of the items emitted by the source SingleSourcesa source1, @NonNull SingleSource<? extends T> SingleSource to be mergeda source2, @NonNull SingleSource<? extends T> SingleSource to be mergeda source3)SingleSource to be mergedFlattens two |
| public static < the common value type T> @NonNull Flowable | Returns: the newFlowable that emits all of the items emitted by the source SingleSourcesa source1, @NonNull SingleSource<? extends T> SingleSource to be mergeda source2, @NonNull SingleSource<? extends T> SingleSource to be mergeda source3, @NonNull SingleSource<? extends T> SingleSource to be mergeda source4)SingleSource to be mergedFlattens two |
| public final @NonNull Flowable | Returns: the newFlowable instancea other)SingleSource to be mergedFlattens this |
| public static < the target value type T> @NonNull Single | Returns: the singleton never instanceReturns a singleton instance of a never-signaling |
| public final @NonNull Single | |
| public final < the output type U> @NonNull Maybe | |
| public final @NonNull Maybe | Returns: the newMaybe instanceReturns a |
| public final @NonNull Maybe | Returns: the newMaybe instancethe predicate to call when an predicate)Throwable is emitted which should return true
if the Throwable should be swallowed and replaced with an onComplete.Returns a |
| public final @NonNull Single | Returns: the newSingle instancea function that returns a fallbackSupplier)SingleSource that will take control if source Single encounters an error.Resumes the flow with a |
| public final @NonNull Single | Returns: the newSingle instancea fallback)Single that will take control if source Single encounters an error.Resumes the flow with the given |
| public final @NonNull Single | Returns: the newSingle instancea function that returns an item that the new itemSupplier)Single will emit if the current Single encounters
an errorEnds the flow with a success item returned by a function for the |
| public final @NonNull Single | Returns: the newSingle instancethe value to signal if the current item)Single failsSignals the specified value as success in case the current |
| public final @NonNull Single | Returns: the newSingle which nulls out references to the upstream producer and downstream SingleObserver if
the sequence is terminated or downstream calls dispose()Nulls out references to the upstream producer and downstream |
| public final @NonNull Flowable | |
| public final @NonNull Flowable | |
| public final @NonNull Flowable | Returns: the newFlowable instancethe stop)BooleanSupplier called after the current Single succeeds and if returns false,
the Single is re-subscribed; otherwise the sequence completes.Re-subscribes to the current |
| public final @NonNull Flowable | Returns: the newFlowable instancethe function that is called with a handler)Flowable that signals a value when the Single
signaled a success value and returns a Publisher that has to signal a value to
trigger a resubscription to the current Single, otherwise the terminal signal of
the Publisher will be the terminal signal of the sequence as well.Re-subscribes to the current |
| public final @NonNull Single | Returns: the newSingle instanceRepeatedly re-subscribes to the current |
| public final @NonNull Single | Returns: the newSingle instancethe number of times to resubscribe if the current times)Single failsRepeatedly re-subscribe at most the specified times to the current |
| public final @NonNull Single | Returns: the newSingle instancethe predicate called with the resubscription count and the failure predicate)Throwable
and should return true if a resubscription should happenRe-subscribe to the current |
| public final @NonNull Single | Returns: the newSingle instancethe number of times to resubscribe if the current times, @NonNull Predicate<? super Throwable> Single failsthe predicate called with the failure predicate)Throwable
and should return true if a resubscription should happenRepeatedly re-subscribe at most times or until the predicate returns |
| public final @NonNull Single | |
| public final @NonNull Single | Returns: the newSingle instancethe function that should return stop)true to stop retryingRetries until the given stop function returns |
| public final @NonNull Single | Returns: the newSingle instancethe function that receives a handler)Flowable of the error the Single emits and should
return a Publisher that should signal a normal value (in response to the
throwable the Flowable emits) to trigger a resubscription or signal an error to
be the output of the resulting SingleRe-subscribes to the current |
| public final void | safeSubscribe(@NonNull SingleObserver<? super T>
the potentially misbehaving observer)SingleObserverWraps the given |
| public static < the common value type T> @NonNull Single | Returns: the newSingle instancethe first source1, @NonNull SingleSource<? extends T> SingleSource instancethe second source2)SingleSource instanceCompares two |
| public final @NonNull Flowable | Returns: the newFlowable instancethe other other)CompletableSource to run firstReturns a |
| public final @NonNull Flowable | Returns: the newFlowable instancethe other other)SingleSource to run firstReturns a |
| public final @NonNull Flowable | Returns: the newFlowable instancethe other other)MaybeSource to run firstReturns a |
| public final @NonNull Observable | Returns: the newObservable instancethe other other)ObservableSource to run firstReturns an |
| public final @NonNull Flowable | |
| public final @NonNull Disposable | Returns: the newDisposable instance that can be used for disposing the subscription at any timeSubscribes to a |
| public final @NonNull Disposable | Returns: the newDisposable instance that can be used for disposing the subscription at any timethe callback that receives either the success value or the failure onCallback)Throwable
(whichever is not null)Subscribes to a |
| public final @NonNull Disposable | Returns: the newDisposable instance that can be used for disposing the subscription at any timethe onSuccess)Consumer<T> you have designed to accept the emission from the SingleSubscribes to a |
| public final @NonNull Disposable | Returns: the newDisposable instance that can be used for disposing the subscription at any timethe onSuccess, @NonNull Consumer<? super Throwable> Consumer<T> you have designed to accept the emission from the Singlethe onError)Consumer<Throwable> you have designed to accept any error notification from the
SingleSubscribes to a |
| public final @NonNull Disposable | Returns: theDisposable that allows disposing the particular subscription.the callback for upstream items onSuccess, @NonNull Consumer<? super Throwable> the callback for an upstream error if any onError, @NonNull DisposableContainer the container)DisposableContainer (such as CompositeDisposable) to add and remove the
created Disposable SingleObserverWraps the given onXXX callbacks into a |
| public final void | |
| protected abstract void | subscribeActual(@NonNull SingleObserver<? super T>
the observer)SingleObserver to handle, not nullImplement this method in subclasses to handle the incoming |
| public final @NonNull Single | Returns: the newSingle instancethe scheduler)Scheduler to perform subscription actions onAsynchronously subscribes |
| public final < the type of the E extends SingleObserverSingleObserver to use and return | Returns: the inputobserverthe observer)SingleObserver (subclass) to use and return, not nullSubscribes a given |
| public static < the element type of the T> @NonNull FlowableSingleSources | Returns: the newFlowable instancethe sources)Publisher sequence of inner SingleSources to switch betweenSwitches between |
| public static < the element type of the T> @NonNull FlowableSingleSources | Returns: the newFlowable instancethe sources)Publisher sequence of inner SingleSources to switch betweenSwitches between |
| public final @NonNull Single | Returns: the newSingle that emits the item emitted by the current Single until such time as other terminates.the other)CompletableSource whose termination will cause takeUntil to emit the item from the current
SingleReturns a |
| public final < the type of items emitted by E> @NonNull Singleother | Returns: the newSingle that emits the item emitted by the current Single until such time as other emits
its first itemthe other)Publisher whose first emitted item or completion will cause takeUntil to emit CancellationException
if the current Single hasn't completed till thenReturns a |
| public final < the type of item emitted by E> @NonNull Singleother | Returns: the newSingle that emits the item emitted by the current Single until such time as other emits its itemthe other)Single whose emitted item will cause takeUntil to emit CancellationException
if the current Single hasn't completed till thenReturns a |
| public final @NonNull TestObserver | Returns: the newTestObserver instanceCreates a |
| public final @NonNull TestObserver | Returns: the newTestObserver instanceif dispose)true, the TestObserver will be cancelled before subscribing to this
Single.Creates a |
| public final @NonNull Single | Returns: the newSingle instanceMeasures the time (in milliseconds) between the subscription and success item emission
of the current |
| public final @NonNull Single | Returns: the newSingle instancethe scheduler)Scheduler used for providing the current timeMeasures the time (in milliseconds) between the subscription and success item emission
of the current |
| public final @NonNull Single | Returns: the newSingle instancethe time unit for measurement unit)Measures the time between the subscription and success item emission
of the current |
| public final @NonNull Single | Returns: the newSingle instancethe time unit for measurement unit, @NonNull Scheduler the scheduler)Scheduler used for providing the current timeMeasures the time between the subscription and success item emission
of the current |
| public final @NonNull Single | Returns: the newSingle instancethe timeout amount timeout, @NonNull TimeUnit the time unit unit)Signals a |
| public final @NonNull Single | Returns: the newSingle instancethe timeout amount timeout, @NonNull TimeUnit the time unit unit, @NonNull Scheduler the target scheduler)Scheduler where the timeout is awaited and the TimeoutException
signaledSignals a |
| public final @NonNull Single | Returns: the newSingle instancethe timeout amount timeout, @NonNull TimeUnit the time unit unit, @NonNull Scheduler the scheduler, @NonNull SingleSource<? extends T> Scheduler where the timeout is awaited and the subscription to other happensthe other fallback)SingleSource that gets subscribed to if the current Single times outRuns the current |
| public final @NonNull Single | Returns: the newSingle instancethe timeout amount timeout, @NonNull TimeUnit the time unit unit, @NonNull SingleSource<? extends T> the other fallback)SingleSource that gets subscribed to if the current Single times outRuns the current |
| private Single | timeout0(final long timeout, final TimeUnit unit, final Scheduler scheduler, final SingleSource<? extends T> fallback)
|
| public static @NonNull Single | Returns: the newSingle instancethe delay amount delay, @NonNull TimeUnit the time unit of the delay unit)Signals success with 0L value after the given delay when a |
| public static @NonNull Single | Returns: the newSingle instancethe delay amount delay, @NonNull TimeUnit the time unit of the delay unit, @NonNull Scheduler the scheduler)Scheduler where the single 0L will be emittedSignals success with 0L value on the specified |
| public final @NonNull Single | |
| public final @NonNull Single | Returns: the newSingle instancethe scheduler)Scheduler used for providing the current timeCombines the success value from the current |
| public final @NonNull Single | |
| public final @NonNull Single | Returns: the newSingle instancethe time unit for measurement unit, @NonNull Scheduler the scheduler)Scheduler used for providing the current timeCombines the success value from the current |
| public final < the resulting object type R> R | Returns: the converted valuethe function that receives the current converter)Single instance and returns a valueCalls the specified converter function during assembly time and returns its resulting value. |
| public final @NonNull CompletionStage | Returns: the newCompletionStage instanceSignals the upstream success item (or error) via a |
| public final @NonNull Flowable | |
| public final @NonNull Future | |
| public final @NonNull Maybe | |
| public final @NonNull Observable | |
| private static <T> @NonNull Single | |
| public static < the value type T> @NonNull Single | Returns: the newSingle instancethe function that is called with the subscribing onSubscribe)SingleObserverAdvanced use only: creates a |
| public final @NonNull Single | Returns: the newSingle instancethe target scheduler where to execute the disposal scheduler)Returns a |
| public static < the value type of the T, SingleSource generatedthe resource type U> @NonNull Single | Returns: the newSingle instancethe resourceSupplier, @NonNull Function<? super U, ? extends SingleSource<? extends T>> Supplier called for each SingleObserver to generate a resource objectthe function called with the returned resource
object from sourceSupplier, @NonNull Consumer<? super U> resourceSupplier and should return a SingleSource instance
to be run by the operatorthe consumer of the generated resource that is called exactly once for
that particular resource when the generated resourceCleanup)SingleSource terminates
(successfully or with an error) or gets disposed.Allows using and disposing a resource while running a |
| public static < the value type of the T, SingleSource generatedthe resource type U> @NonNull Single | Returns: the newSingle instancethe resourceSupplier, @NonNull Function<? super U, ? extends SingleSource<? extends T>> Supplier called for each SingleObserver to generate a resource objectthe function called with the returned resource
object from sourceSupplier, @NonNull Consumer<? super U> resourceSupplier and should return a SingleSource instance
to be run by the operatorthe consumer of the generated resource that is called exactly once for
that particular resource when the generated resourceCleanup, boolean SingleSource terminates
(successfully or with an error) or gets disposed.If eager)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 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 or onError).Allows using and disposing a resource while running a |
| public static < the value type T> @NonNull Single | Returns: the newSingle instancethe source to wrap source)Wraps a |
| public static < the common value type T, the result value type R> @NonNull Single | Returns: the newSingle instancethe sources, @NonNull Function<? super Object[], ? extends R> Iterable sequence of SingleSource instances. An empty sequence will result in an
onError signal of NoSuchElementException.the function that receives an array with values from each zipper)SingleSource
and should return a value to be emitted to downstreamWaits until all |
| public static < the first source T1, SingleSource's value typethe second source T2, SingleSource's value typethe result value type R> @NonNull Single | Returns: the newSingle that emits the zipped resultsthe first source source1, @NonNull SingleSource<? extends T2> SingleSourcea second source source2, @NonNull BiFunction<? super T1, ? super T2, ? extends R> SingleSourcea function that, when applied to the item emitted by each of the source zipper)SingleSources, results in an
item that will be emitted by the resulting SingleReturns a |
| public static < the first source T1, SingleSource's value typethe second source T2, SingleSource's value typethe third source T3, SingleSource's value typethe result value type R> @NonNull Single | Returns: the newSingle that emits the zipped resultsthe first source source1, @NonNull SingleSource<? extends T2> SingleSourcea second source source2, @NonNull SingleSource<? extends T3> SingleSourcea third source source3, @NonNull Function3<? super T1, ? super T2, ? super T3, ? extends R> SingleSourcea function that, when applied to the item emitted by each of the source zipper)SingleSources, results in an
item that will be emitted by the resulting SingleReturns a |
| public static < the first source T1, SingleSource's value typethe second source T2, SingleSource's value typethe third source T3, SingleSource's value typethe fourth source T4, SingleSource's value typethe result value type R> @NonNull Single | Returns: the newSingle that emits the zipped resultsthe first source source1, @NonNull SingleSource<? extends T2> SingleSourcea second source source2, @NonNull SingleSource<? extends T3> SingleSourcea third source source3, @NonNull SingleSource<? extends T4> SingleSourcea fourth source source4, @NonNull Function4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> SingleSourcea function that, when applied to the item emitted by each of the source zipper)SingleSources, results in an
item that will be emitted by the resulting SingleReturns a |
| public static < the first source T1, SingleSource's value typethe second source T2, SingleSource's value typethe third source T3, SingleSource's value typethe fourth source T4, SingleSource's value typethe fifth source T5, SingleSource's value typethe result value type R> @NonNull Single | Returns: the newSingle that emits the zipped resultsthe first source source1, @NonNull SingleSource<? extends T2> SingleSourcea second source source2, @NonNull SingleSource<? extends T3> SingleSourcea third source source3, @NonNull SingleSource<? extends T4> SingleSourcea fourth source source4, @NonNull SingleSource<? extends T5> SingleSourcea fifth source source5, @NonNull Function5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> SingleSourcea function that, when applied to the item emitted by each of the source zipper)SingleSources, results in an
item that will be emitted by the resulting SingleReturns a |
| public static < the first source T1, SingleSource's value typethe second source T2, SingleSource's value typethe third source T3, SingleSource's value typethe fourth source T4, SingleSource's value typethe fifth source T5, SingleSource's value typethe sixth source T6, SingleSource's value typethe result value type R> @NonNull Single | Returns: the newSingle that emits the zipped resultsthe first source source1, @NonNull SingleSource<? extends T2> SingleSourcea second source source2, @NonNull SingleSource<? extends T3> SingleSourcea third source source3, @NonNull SingleSource<? extends T4> SingleSourcea fourth source source4, @NonNull SingleSource<? extends T5> SingleSourcea fifth source source5, @NonNull SingleSource<? extends T6> SingleSourcea sixth source source6, @NonNull Function6<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? extends R> SingleSourcea function that, when applied to the item emitted by each of the source zipper)SingleSources, results in an
item that will be emitted by the resulting SingleReturns a |
| public static < the first source T1, SingleSource's value typethe second source T2, SingleSource's value typethe third source T3, SingleSource's value typethe fourth source T4, SingleSource's value typethe fifth source T5, SingleSource's value typethe sixth source T6, SingleSource's value typethe seventh source T7, SingleSource's value typethe result value type R> @NonNull Single | Returns: the newSingle that emits the zipped resultsthe first source source1, @NonNull SingleSource<? extends T2> SingleSourcea second source source2, @NonNull SingleSource<? extends T3> SingleSourcea third source source3, @NonNull SingleSource<? extends T4> SingleSourcea fourth source source4, @NonNull SingleSource<? extends T5> SingleSourcea fifth source source5, @NonNull SingleSource<? extends T6> SingleSourcea sixth source source6, @NonNull SingleSource<? extends T7> SingleSourcea seventh source source7, @NonNull Function7<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? extends R> SingleSourcea function that, when applied to the item emitted by each of the source zipper)SingleSources, results in an
item that will be emitted by the resulting SingleReturns a |
| public static < the first source T1, SingleSource's value typethe second source T2, SingleSource's value typethe third source T3, SingleSource's value typethe fourth source T4, SingleSource's value typethe fifth source T5, SingleSource's value typethe sixth source T6, SingleSource's value typethe seventh source T7, SingleSource's value typethe eighth source T8, SingleSource's value typethe result value type R> @NonNull Single | Returns: the newSingle that emits the zipped resultsthe first source source1, @NonNull SingleSource<? extends T2> SingleSourcea second source source2, @NonNull SingleSource<? extends T3> SingleSourcea third source source3, @NonNull SingleSource<? extends T4> SingleSourcea fourth source source4, @NonNull SingleSource<? extends T5> SingleSourcea fifth source source5, @NonNull SingleSource<? extends T6> SingleSourcea sixth source source6, @NonNull SingleSource<? extends T7> SingleSourcea seventh source source7, @NonNull SingleSource<? extends T8> SingleSourcean eighth source source8, @NonNull Function8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R> SingleSourcea function that, when applied to the item emitted by each of the source zipper)SingleSources, results in an
item that will be emitted by the resulting SingleReturns a |
| public static < the first source T1, SingleSource's value typethe second source T2, SingleSource's value typethe third source T3, SingleSource's value typethe fourth source T4, SingleSource's value typethe fifth source T5, SingleSource's value typethe sixth source T6, SingleSource's value typethe seventh source T7, SingleSource's value typethe eighth source T8, SingleSource's value typethe ninth source T9, SingleSource's value typethe result value type R> @NonNull Single | Returns: the newSingle that emits the zipped resultsthe first source source1, @NonNull SingleSource<? extends T2> SingleSourcea second source source2, @NonNull SingleSource<? extends T3> SingleSourcea third source source3, @NonNull SingleSource<? extends T4> SingleSourcea fourth source source4, @NonNull SingleSource<? extends T5> SingleSourcea fifth source source5, @NonNull SingleSource<? extends T6> SingleSourcea sixth source source6, @NonNull SingleSource<? extends T7> SingleSourcea seventh source source7, @NonNull SingleSource<? extends T8> SingleSourcean eighth source source8, @NonNull SingleSource<? extends T9> SingleSourcea ninth source source9, @NonNull Function9<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? extends R> SingleSourcea function that, when applied to the item emitted by each of the source zipper)SingleSources, results in an
item that will be emitted by the resulting SingleReturns a |
| public static < the common value type T, the result value type R> @NonNull Single | Returns: the newSingle instancethe function that receives an array with values from each zipper, @NonNull SingleSource<? extends T>... SingleSource
and should return a value to be emitted to downstreamthe array of sources)SingleSource instances. An empty sequence will result in an
onError signal of NoSuchElementException.Waits until all |
| public final < the type of items emitted by the U, other Singlethe type of items emitted by the resulting R> @NonNull SingleSingle | Returns: the newSingle that pairs up values from the current Single and the other SingleSource
and emits the results of zipFunction applied to these pairsthe other other, @NonNull BiFunction<? super T, ? super U, ? extends R> SingleSourcea function that combines the pairs of items from the two zipper)SingleSources to generate the items to
be emitted by the resulting SingleReturns a |