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.observers.DisposableSingleObserver
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static < the value type T> Single | Returns: the new Single instancethe Iterable sequence of sources. A subscription to each source will
occur in the same order as in this Iterable. sources)Runs multiple SingleSources and signals the events of the first one that signals (disposing the rest). |
| public static < the value type T> Single | Returns: the new Single instancethe array of sources. A subscription to each source will
occur in the same order as in this array. sources)Runs multiple SingleSources and signals the events of the first one that signals (disposing the rest). |
| public final Single | Returns: the new Single instance. A subscription to this provided source will occur after subscribing to the current source.the other SingleSource to race for the first emission of success or error other)Signals the event of this or the other SingleSource whichever signals first. |
| public final < the resulting object type R> R | Returns: the converted valuethe function that receives the current Single instance and returns a value converter)Calls the specified converter function during assembly time and returns its resulting value. |
| public final T | Returns: the success valueWaits in a blocking fashion until the current Single signals a success value (which is returned) or an exception (which is propagated). |
| public final Single | Returns: the new Single instanceStores the success value or exception from the current Single and replays it to late SingleObservers. |
| public final < the target type U> Single | |
| public final < the value type of the single returned by the transformer function R> Single | Returns: the source Single, transformed by the transformer functionthe transformer function, not null transformer)Transform a Single by applying a particular Transformer function to it. |
| public static < the value type T> Flowable | Returns: the new Flowable instancethe Iterable sequence of SingleSource instances sources)Concatenate the single values, in a non-overlapping fashion, of the SingleSources provided by an Iterable sequence. |
| public static < the value type T> Observable | Returns: the new Observable instancethe ObservableSource of SingleSource instances sources)Concatenate the single values, in a non-overlapping fashion, of the SingleSources provided by an Observable sequence. |
| public static < the value type T> Flowable | Returns: the new Flowable instancethe Publisher of SingleSource instances sources)Concatenate the single values, in a non-overlapping fashion, of the SingleSources provided by a Publisher sequence. |
| public static < the value type T> Flowable | Returns: the new Flowable instancethe Publisher of SingleSource instances sources, int the number of SingleSources to prefetch from the Publisher prefetch)Concatenate the single values, in a non-overlapping fashion, of the SingleSources provided by a Publisher sequence and prefetched by the specified amount. |
| public static < the common value type T> Flowable | Returns: a Flowable that emits items emitted by the two source Singles, one after the other.a Single to be concatenated source1, SingleSource<? extends T> a Single to be concatenated source2)Returns a Flowable that emits the items emitted by two Singles, one after the other. |
| public static < the common value type T> Flowable | Returns: a Flowable that emits items emitted by the three source Singles, one after the other.a Single to be concatenated source1, SingleSource<? extends T> a Single to be concatenated source2, SingleSource<? extends T> a Single to be concatenated source3)Returns a Flowable that emits the items emitted by three Singles, one after the other. |
| public static < the common value type T> Flowable | Returns: a Flowable that emits items emitted by the four source Singles, one after the other.a Single to be concatenated source1, SingleSource<? extends T> a Single to be concatenated source2, SingleSource<? extends T> a Single to be concatenated source3, SingleSource<? extends T> a Single to be concatenated source4)Returns a Flowable that emits the items emitted by four Singles, one after the other. |
| public static < the value type T> Flowable | Returns: the new Flowable instancethe array of SingleSource instances sources)Concatenate the single values, in a non-overlapping fashion, of the SingleSources provided in an array. |
| public static < the value type T> Flowable | Returns: the new Flowable instance with the specified concatenation behaviora sequence of Single that need to be eagerly concatenated sources)Concatenates a sequence of SingleSource eagerly into a single stream of values. |
| public static < the value type T> Flowable | Returns: the new Publisher instance with the specified concatenation behaviora sequence of Publishers that need to be eagerly concatenated sources)Concatenates a Publisher sequence of SingleSources eagerly into a single stream of values. |
| public static < the value type T> Flowable | Returns: the new Flowable instance with the specified concatenation behaviora sequence of SingleSource that need to be eagerly concatenated sources)Concatenates a sequence of SingleSources eagerly into a single stream of values. |
| public final Flowable | Returns: a Flowable that emits the item emitted by the source Single, followed by the item emitted byt1a Single to be concatenated after the current other)Returns a Flowable that emits the item emitted by the source Single, then the item emitted by the specified Single. |
| public final Single | |
| public final Single | Returns: the new Single instancethe value to compare against the success value of this Single value, final BiPredicate<Object, Object> the function that receives the success value of this Single, the value provided
and should return true if they are considered equal comparer)Signals true if the current Single signals a success value that is equal with the value provided by calling a bi-predicate. |
| public static < the value type T> Single | Returns: the new Single instancethe emitter that is called when a SingleObserver subscribes to the returned source)SingleProvides an API (via a cold Single) that bridges the reactive world with the callback-style world. |
| public static < the value type T> Single | Returns: the new Single instancethe singleSupplier)Callable that is called for each individual SingleObserver and
returns a SingleSource instance to subscribe toCalls a |
| public final Single | |
| public final Single | Returns: the new Single instancethe amount of time the success or error signal should be delayed for time, TimeUnit the time unit unit, boolean if true, both success and error signals are delayed. if false, only success signals are delayed. delayError)Delays the emission of the success or error signal from the current Single by the specified amount. |
| public final Single | Returns: the new Single instancethe amount of time the success signal should be delayed for time, final TimeUnit the time unit unit, final Scheduler the target scheduler to use for the non-blocking wait and emission scheduler)Delays the emission of the success signal from the current Single by the specified amount. |
| public final Single | Returns: the new Single instancethe amount of time the success or error signal should be delayed for time, final TimeUnit the time unit unit, final Scheduler the target scheduler to use for the non-blocking wait and emission scheduler, boolean if true, both success and error signals are delayed. if false, only success signals are delayed. delayError)Delays the emission of the success or error signal from the current Single by the specified amount. |
| public final Single | Returns: the new Single instancethe CompletableSource that has to complete before the subscription to the
current Single happens other)Delays the actual subscription to the current Single until the given other CompletableSource completes. |
| public final < the element type of the other source U> Single | Returns: the new Single instancethe SingleSource that has to complete before the subscription to the
current Single happens other)Delays the actual subscription to the current Single until the given other SingleSource signals success. |
| public final < the element type of the other source U> Single | Returns: the new Single instancethe ObservableSource that has to signal a value or complete before the
subscription to the current Single happens other)Delays the actual subscription to the current Single until the given other ObservableSource signals its first value or completes. |
| public final < the element type of the other source U> Single | Returns: the new Single instancethe Publisher that has to signal a value or complete before the
subscription to the current Single happens other)Delays the actual subscription to the current Single until the given other Publisher signals its first value or completes. |
| public final Single | Returns: the new Single instancethe time amount to wait with the subscription time, TimeUnit the time unit of the waiting unit)Delays the actual subscription to the current Single until the given time delay elapsed. |
| public final Single | Returns: the new Single instancethe time amount to wait with the subscription time, TimeUnit the time unit of the waiting unit, Scheduler the scheduler to wait on and subscribe on to the current Single scheduler)Delays the actual subscription to the current Single until the given time delay elapsed. |
| public final < the result type R> Maybe | Returns: the new Maybe instancethe function called with the success item and should
return a selector)Notification instance.Maps the |
| public final Single | Returns: the new Single instancethe Consumer that will be called after emitting an item from upstream to the downstream onAfterSuccess)Calls the specified consumer with the success item after this item has been emitted to the downstream. |
| public final Single | Returns: a Single that emits the same items as the source Single, then invokes theActionan onAfterTerminate)Action to be invoked when the source Single finishesRegisters an |
| public final Single | |
| public final Single | Returns: the new Single instancethe action called when the subscription is disposed onDispose)Calls the shared |
| public final Single | |
| public final Single | Returns: the new Single instancethe consumer called with the success value of onEvent 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. |
| public final Single | Returns: the new Single instancethe consumer called with the Disposable sent via onSubscribe onSubscribe)Calls the shared consumer with the Disposable sent through the onSubscribe for each SingleObserver that subscribes to the current Single. |
| public final Single | Returns: the new Single instancethe consumer called with the success value of onSuccess onSuccess)Calls the shared consumer with the success value sent via onSuccess for each SingleObserver that subscribes to the current Single. |
| public final Single | Returns: the new Single instancethe action to invoke when the consumer calls onTerminate)onSuccess or onErrorReturns a Single instance that calls the given onTerminate callback just before this Single completes normally or with an exception. |
| public static < the common value type T> Single | Returns: the new Single instancethe first SingleSource instance first, final SingleSource<? extends T> the second SingleSource instance second)Compares two SingleSources and emits true if they emit the same value (compared via Object.equals). |
| public static < the value type T> Single | |
| public static < the type of the item (ostensibly) emitted by the Single T> Single | |
| public final Maybe | Returns: a Maybe that emit the item emitted by the source Maybe that the filter evaluates astruea function that evaluates the item emitted by the source Maybe, returning predicate)true
if it passes the filterFilters the success item of the Single via a predicate function and emitting it if the predicate returns true, completing otherwise. |
| public final < the result value type R> Single | Returns: the Single returned frommapper when applied to the item emitted by the source Singlea function that, when applied to the item emitted by the source Single, returns a SingleSource mapper)Returns a Single that is based on applying a specified function to the item emitted by the source Single, where that function returns a SingleSource. |
| public final Completable | Returns: the Completable returned fromfunc when applied to the item emitted by the source Singlea function that, when applied to the item emitted by the source Single, returns a
Completable mapper)Returns a |
| public final < the result value type R> Maybe | Returns: the Maybe returned frommapper when applied to the item emitted by the source Singlea function that, when applied to the item emitted by the source Single, returns a MaybeSource mapper)Returns a Maybe that is based on applying a specified function to the item emitted by the source Single, where that function returns a MaybeSource. |
| public final < the result value type R> Observable | Returns: the Observable returned fromfunc when applied to the item emitted by the source Singlea function that, when applied to the item emitted by the source Single, returns an ObservableSource mapper)Returns an Observable that is based on applying a specified function to the item emitted by the source Single, where that function returns an ObservableSource. |
| public final < the result value type R> Flowable | Returns: the Flowable returned fromfunc when applied to the item emitted by the source Singlea function that, when applied to the item emitted by the source Single, returns a
Flowable mapper)Returns a Flowable that emits items based on applying a specified function to the item emitted by the source Single, where that function returns a Publisher. |
| public final < the type of item emitted by the resulting Iterable U> Flowable | Returns: the new Flowable instancea function that returns an Iterable sequence of values for when given an item emitted by the
source Single mapper)Maps the success value of the upstream |
| public final < the type of item emitted by the resulting Iterable U> Observable | Returns: the new Observable instancea function that returns an Iterable sequence of values for when given an item emitted by the
source Single mapper)Maps the success value of the upstream |
| public static < the type of the item emitted by the T> SingleSingle. | fromCallable(final Callable<? extends T>
function which execution should be deferred, it will be invoked when SingleObserver will subscribe to the callable)Single.Returns a |
| public static < the type of object that the T> SingleFuture returns, and also the type of item to be emitted by
the resulting Single | |
| public static < the type of object that the T> SingleFuture returns, and also the type of item to be emitted by
the resulting Single | |
| public static < the type of object that the T> SingleFuture returns, and also the type of item to be emitted by
the resulting Single | |
| public static < the type of object that the T> SingleFuture returns, and also the type of item to be emitted by
the resulting Single | fromFuture(Future<? extends T>
the source future, Scheduler Futurethe scheduler)Scheduler to wait for the Future on. Use a Scheduler such as
Schedulers#io() that can block and wait on the FutureConverts a |
| public static < the type of the item emitted by the T> SingleSingle. | Returns: the new Single instancethe source Observable, not null observableSource)Wraps a specific ObservableSource into a Single and signals its single element or error. |
| public static < the value type T> Single | Returns: the new Single instancethe source Publisher instance, not null publisher)Wraps a specific Publisher into a Single and signals its single element or error. |
| public final Single | Returns: the new Single instanceHides the identity of the current Single, including the Disposable that is sent
to the downstream via |
| public final Completable | Returns: aCompletable that calls onComplete on it's observer when the source Single
calls onSuccess.Returns a |
| public static < the type of that item T> Single | Returns: aSingle that emits itemthe item to emit item)Returns a |
| public final < the output value type R> Single | Returns: the new Single 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> Single | Returns: a Single that emits the item from the source Single, transformed by the specified functiona function to apply to the item emitted by the Single mapper)Returns a Single that applies a specified function to the item emitted by the source Single and emits the result of this function application. |
| public final Single | Returns: the new Single instanceMaps the signal types of this Single into a |
| public static < the common and resulting value type T> Flowable | Returns: the new Flowable instancethe Iterable sequence of SingleSource sources sources)Merges an Iterable sequence of SingleSource instances into a single Flowable sequence, running all SingleSources at once. |
| public static < the common and resulting value type T> Flowable | Returns: the new Flowable instancethe Flowable sequence of SingleSource sources sources)Merges a Flowable sequence of SingleSource instances into a single Flowable sequence, running all SingleSources at once. |
| public static < the value type of the sources and the output T> Single | Returns: aSingle 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> Flowable | Returns: a Flowable that emits all of the items emitted by the source Singlesa SingleSource to be merged source1, SingleSource<? extends T> a SingleSource to be merged source2)Flattens two Singles into a single Flowable, without any transformation. |
| public static < the common value type T> Flowable | Returns: a Flowable that emits all of the items emitted by the source Singlesa SingleSource to be merged source1, SingleSource<? extends T> a SingleSource to be merged source2, SingleSource<? extends T> a SingleSource to be merged source3)Flattens three Singles into a single Flowable, without any transformation. |
| public static < the common value type T> Flowable | Returns: a Flowable that emits all of the items emitted by the source Singlesa SingleSource to be merged source1, SingleSource<? extends T> a SingleSource to be merged source2, SingleSource<? extends T> a SingleSource to be merged source3, SingleSource<? extends T> a SingleSource to be merged source4)Flattens four Singles into a single Flowable, without any transformation. |
| public static < the common and resulting value type T> Flowable | Returns: the new Flowable instancethe Iterable sequence of SingleSource sources sources)Merges an Iterable sequence of SingleSource instances into a single Flowable sequence, running all SingleSources at once and delaying any error(s) until all sources succeed or fail. |
| public static < the common and resulting value type T> Flowable | Returns: the new Flowable instancethe Flowable sequence of SingleSource sources sources)Merges a Flowable sequence of SingleSource instances into a single Flowable sequence, running all SingleSources at once and delaying any error(s) until all sources succeed or fail. |
| public static < the common value type T> Flowable | Returns: a Flowable that emits all of the items emitted by the source Singlesa SingleSource to be merged source1, SingleSource<? extends T> a SingleSource to be merged source2)Flattens two Singles into a single Flowable, without any transformation, delaying any error(s) until all sources succeed or fail. |
| public static < the common value type T> Flowable | Returns: a Flowable that emits all of the items emitted by the source Singlesa SingleSource to be merged source1, SingleSource<? extends T> a SingleSource to be merged source2, SingleSource<? extends T> a SingleSource to be merged source3)Flattens three Singles into a single Flowable, without any transformation, delaying any error(s) until all sources succeed or fail. |
| public static < the common value type T> Flowable | Returns: a Flowable that emits all of the items emitted by the source Singlesa SingleSource to be merged source1, SingleSource<? extends T> a SingleSource to be merged source2, SingleSource<? extends T> a SingleSource to be merged source3, SingleSource<? extends T> a SingleSource to be merged source4)Flattens four Singles into a single Flowable, without any transformation, delaying any error(s) until all sources succeed or fail. |
| public final Flowable | Returns: that emits all of the items emitted by the source Singlesa SingleSource to be merged other)Flattens this and another Single into a single Flowable, without any transformation. |
| public static < the target value type T> Single | Returns: the singleton never instanceReturns a singleton instance of a never-signalling Single (only calls onSubscribe). |
| public final Single | |
| public final Single | Returns: the original Single, with appropriately modified behavior.a Single that will take control if source Single encounters an error. resumeSingleInCaseOfError)Instructs a Single to pass control to another Single rather than invoking
|
| public final Single | Returns: the original Single, with appropriately modified behavior.a function that returns a Single that will take control if source Single encounters an error. resumeFunctionInCaseOfError)Instructs a Single to pass control to another Single rather than invoking
|
| public final Single | Returns: the original Single with appropriately modified behaviora function that returns an item that the new Single will emit if the source Single encounters
an error resumeFunction)Instructs a Single to emit an item (returned by a specified function) rather than invoking
|
| public final Single | Returns: the new Single instancethe value to signal if the current Single fails value)Signals the specified value as success in case the current Single signals an error. |
| public final Single | Returns: a Single 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 SingleObserver if the sequence is terminated or downstream calls dispose(). |
| public final Flowable | Returns: the new Flowable instanceRepeatedly re-subscribes to the current Single and emits each success value. |
| public final Flowable | Returns: the new Flowable instancethe number of times to re-subscribe to the current Single times)Re-subscribes to the current Single at most the given number of times and emits each success value. |
| public final Flowable | Returns: the new Flowable instancethe BooleanSupplier called after the current Single succeeds and if returns false,
the Single is re-subscribed; otherwise the sequence completes. stop)Re-subscribes to the current Single until the given BooleanSupplier returns true. |
| public final Flowable | Returns: the new Flowable instancethe function that is called with a Flowable that signals a value when the Single
signalled 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. handler)Re-subscribes to the current Single if the Publisher returned by the handler function signals a value in response to a value signalled through the Flowable the handle receives. |
| public final Single | Returns: the new Single instanceRepeatedly re-subscribes to the current Single indefinitely if it fails with an onError. |
| public final Single | Returns: the new Single instancethe number of times to resubscribe if the current Single fails times)Repeatedly re-subscribe at most the specified times to the current Single if it fails with an onError. |
| public final Single | Returns: the new Single instancethe predicate called with the resubscription count and the failure Throwable
and should return true if a resubscription should happen predicate)Re-subscribe to the current Single if the given predicate returns true when the Single fails with an onError. |
| public final Single | Returns: the new Single instancethe number of times to resubscribe if the current Single fails times, Predicate<? super Throwable> the predicate called with the failure Throwable
and should return true if a resubscription should happen predicate)Repeatedly re-subscribe at most times or until the predicate returns false, whichever happens first if it fails with an onError. |
| public final Single | |
| public final Single | Returns: the new Single instancethe function that receives a 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 Single handler)Re-subscribes to the current Single if and when the Publisher returned by the handler function signals a value. |
| public final Disposable | |
| public final Disposable | subscribe(final BiConsumer<? super T, ? super Throwable>
the callback that receives either the success value or the failure Throwable
(whichever is not null) onCallback)Subscribes to a Single and provides a composite callback to handle the item it emits or any error notification it issues. |
| public final Disposable | |
| public final Disposable | subscribe(final Consumer<? super T>
the onSuccess, final 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 Single and provides callbacks to handle the item it emits or any error notification it issues. |
| public final void | subscribe(SingleObserver<? super T>
the SingleObserver, not null observer)Implements io. |
| protected abstract void | subscribeActual(SingleObserver<? super T>
the SingleObserver to handle, not null observer)Implement this method in subclasses to handle the incoming |
| public final Single | Returns: the source Single modified so that its subscriptions happen on the specifiedSchedulerthe scheduler)Scheduler to perform subscription actions onAsynchronously subscribes subscribers to this Single on the specified |
| public final < the type of the SingleObserver to use and return E extends SingleObserver | Returns: the inputobserverthe SingleObserver (subclass) to use and return, not null observer)Subscribes a given SingleObserver (subclass) to this Single and returns the given SingleObserver as is. |
| public final Single | Returns: a Single that emits the item emitted by the source Single until such time asother terminates.the Completable whose termination will cause other)takeUntil to emit the item from the source
SingleReturns a Single that emits the item emitted by the source Single until a Completable terminates. |
| public final < the type of items emitted by E> Singleother | Returns: a Single that emits the item emitted by the source Single until such time asother emits
its first itemthe Publisher whose first emitted item will cause other)takeUntil to emit the item from the source
SingleReturns a Single that emits the item emitted by the source Single until a Publisher emits an item. |
| public final < the type of item emitted by E> Singleother | Returns: a Single that emits the item emitted by the source Single until such time asother emits its itemthe Single whose emitted item will cause other)takeUntil to emit the item from the source SingleReturns a Single that emits the item emitted by the source Single until a second Single emits an item. |
| public final TestObserver | Returns: the new TestObserver instanceCreates a TestObserver and subscribes it to this Single. |
| public final TestObserver | Returns: the new TestObserver instanceif true, the TestObserver will be cancelled before subscribing to this
Single. cancelled)Creates a TestObserver optionally in cancelled state, then subscribes it to this Single. |
| public final Single | |
| public final Single | Returns: the new Single instancethe timeout amount timeout, TimeUnit the time unit unit, Scheduler the target scheduler where the timeout is awaited and the TimeoutException
signalled scheduler)Signals a TimeoutException if the current Single doesn't signal a success value within the specified timeout window. |
| public final Single | Returns: the new Single instancethe timeout amount timeout, TimeUnit the time unit unit, Scheduler the scheduler where the timeout is awaited and the subscription to other happens scheduler, SingleSource<? extends T> the other SingleSource that gets subscribed to if the current Single times out other)Runs the current Single and if it doesn't signal within the specified timeout window, it is disposed and the other SingleSource subscribed to. |
| public final Single | Returns: the new Single instancethe timeout amount timeout, TimeUnit the time unit unit, SingleSource<? extends T> the other SingleSource that gets subscribed to if the current Single times out other)Runs the current Single and if it doesn't signal within the specified timeout window, it is disposed and the other SingleSource subscribed to. |
| private Single | timeout0(final long timeout, final TimeUnit unit, final Scheduler scheduler, final SingleSource<? extends T> other)
|
| public static Single | |
| public static Single | |
| public final < the result type R> R | Returns: the value returned by the convert functionthe function that is called with the current Single instance during
assembly time that should return some value to be the result convert)Calls the specified converter function with the current Single instance during assembly time and returns its result. |
| public final Completable | Returns: aCompletable that calls onComplete on it's subscriber when the source Single
calls onSuccess.
Deprecated
see
Returns a ignoreElement() instead, will be removed in 3.0
Completable that discards result of the Single
and calls onComplete when this source Single calls
onSuccess.
|
| public final Flowable | Returns: aFlowable that emits a single item T or an error.Converts this Single into a |
| public final Future | |
| public final Maybe | |
| public final Observable | Returns: anObservable that emits a single item T or an error.Converts this Single into an |
| private static <T> Single | |
| public static < the value type T> Single | Returns: the new Single instancethe function that is called with the subscribing SingleObserver onSubscribe)Advanced use only: creates a Single instance without any safeguards by using a callback that is called with a SingleObserver. |
| public final Single | Returns: the new Single instancethe target scheduler where to execute the disposal scheduler)Returns a Single which makes sure when a SingleObserver disposes the Disposable, that call is propagated up on the specified scheduler. |
| public static < the value type of the SingleSource generated T, the resource type U> Single | Returns: the new Single instancethe Callable called for each SingleObserver to generate a resource Object resourceSupplier, Function<? super U, ? extends SingleSource<? extends T>> the function called with the returned resource
Object from singleFunction, 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 SingleSource terminates
(successfully or with an error) or gets disposed. disposer)Allows using and disposing a resource while running a SingleSource instance generated from that resource (similar to a try-with-resources). |
| public static < the value type of the SingleSource generated T, the resource type U> Single | Returns: the new Single instancethe Callable called for each SingleObserver to generate a resource Object resourceSupplier, final Function<? super U, ? extends SingleSource<? extends T>> the function called with the returned resource
Object from singleFunction, final 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 SingleSource terminates
(successfully or with an error) or gets disposed. disposer, final boolean if true, the disposer is called before the terminal event is signalled
if false, the disposer is called after the terminal event is delivered to downstream eager)Allows using and disposing a resource while running a SingleSource instance generated from that resource (similar to a try-with-resources). |
| public static < the value type T> Single | Returns: the Single wrapper or the source cast to Single (if possible)the source to wrap source)Wraps a SingleSource instance into a new Single instance if not already a Single instance. |
| public static < the common value type T, the result value type R> Single | Returns: the new Single instancethe Iterable sequence of SingleSource instances. An empty sequence will result in an
sources, Function<? super Object[], ? extends R> onError signal of NoSuchElementException.the function that receives an array with values from each SingleSource
and should return a value to be emitted to downstream 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 downstream. |
| public static < the first source Single's value type T1, the second source Single's value type T2, the result value type R> Single | Returns: a Single that emits the zipped resultsthe first source Single source1, SingleSource<? extends T2> a second source Single source2, BiFunction<? super T1, ? super T2, ? extends R> a function that, when applied to the item emitted by each of the source Singles, results in an
item that will be emitted by the resulting Single zipper)Returns a Single that emits the results of a specified combiner function applied to two items emitted by two other Singles. |
| public static < the first source Single's value type T1, the second source Single's value type T2, the third source Single's value type T3, the result value type R> Single | Returns: a Single that emits the zipped resultsthe first source Single source1, SingleSource<? extends T2> a second source Single source2, SingleSource<? extends T3> a third source Single source3, Function3<? super T1, ? super T2, ? super T3, ? extends R> a function that, when applied to the item emitted by each of the source Singles, results in an
item that will be emitted by the resulting Single zipper)Returns a Single that emits the results of a specified combiner function applied to three items emitted by three other Singles. |
| public static < the first source Single's value type T1, the second source Single's value type T2, the third source Single's value type T3, the fourth source Single's value type T4, the result value type R> Single | Returns: a Single that emits the zipped resultsthe first source Single source1, SingleSource<? extends T2> a second source Single source2, SingleSource<? extends T3> a third source Single source3, SingleSource<? extends T4> a fourth source Single source4, Function4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> a function that, when applied to the item emitted by each of the source Singles, results in an
item that will be emitted by the resulting Single zipper)Returns a Single that emits the results of a specified combiner function applied to four items emitted by four other Singles. |
| public static < the first source Single's value type T1, the second source Single's value type T2, the third source Single's value type T3, the fourth source Single's value type T4, the fifth source Single's value type T5, the result value type R> Single | Returns: a Single that emits the zipped resultsthe first source Single source1, SingleSource<? extends T2> a second source Single source2, SingleSource<? extends T3> a third source Single source3, SingleSource<? extends T4> a fourth source Single source4, SingleSource<? extends T5> a fifth source Single source5, Function5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> a function that, when applied to the item emitted by each of the source Singles, results in an
item that will be emitted by the resulting Single zipper)Returns a Single that emits the results of a specified combiner function applied to five items emitted by five other Singles. |
| public static < the first source Single's value type T1, the second source Single's value type T2, the third source Single's value type T3, the fourth source Single's value type T4, the fifth source Single's value type T5, the sixth source Single's value type T6, the result value type R> Single | Returns: a Single that emits the zipped resultsthe first source Single source1, SingleSource<? extends T2> a second source Single source2, SingleSource<? extends T3> a third source Single source3, SingleSource<? extends T4> a fourth source Single source4, SingleSource<? extends T5> a fifth source Single source5, SingleSource<? extends T6> a sixth source Single source6, Function6<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? extends R> a function that, when applied to the item emitted by each of the source Singles, results in an
item that will be emitted by the resulting Single zipper)Returns a Single that emits the results of a specified combiner function applied to six items emitted by six other Singles. |
| public static < the first source Single's value type T1, the second source Single's value type T2, the third source Single's value type T3, the fourth source Single's value type T4, the fifth source Single's value type T5, the sixth source Single's value type T6, the seventh source Single's value type T7, the result value type R> Single | Returns: a Single that emits the zipped resultsthe first source Single source1, SingleSource<? extends T2> a second source Single source2, SingleSource<? extends T3> a third source Single source3, SingleSource<? extends T4> a fourth source Single source4, SingleSource<? extends T5> a fifth source Single source5, SingleSource<? extends T6> a sixth source Single source6, SingleSource<? extends T7> a seventh source Single source7, Function7<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? extends R> a function that, when applied to the item emitted by each of the source Singles, results in an
item that will be emitted by the resulting Single zipper)Returns a Single that emits the results of a specified combiner function applied to seven items emitted by seven other Singles. |
| public static < the first source Single's value type T1, the second source Single's value type T2, the third source Single's value type T3, the fourth source Single's value type T4, the fifth source Single's value type T5, the sixth source Single's value type T6, the seventh source Single's value type T7, the eighth source Single's value type T8, the result value type R> Single | Returns: a Single that emits the zipped resultsthe first source Single source1, SingleSource<? extends T2> a second source Single source2, SingleSource<? extends T3> a third source Single source3, SingleSource<? extends T4> a fourth source Single source4, SingleSource<? extends T5> a fifth source Single source5, SingleSource<? extends T6> a sixth source Single source6, SingleSource<? extends T7> a seventh source Single source7, SingleSource<? extends T8> an eighth source Single source8, Function8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R> a function that, when applied to the item emitted by each of the source Singles, results in an
item that will be emitted by the resulting Single zipper)Returns a Single that emits the results of a specified combiner function applied to eight items emitted by eight other Singles. |
| public static < the first source Single's value type T1, the second source Single's value type T2, the third source Single's value type T3, the fourth source Single's value type T4, the fifth source Single's value type T5, the sixth source Single's value type T6, the seventh source Single's value type T7, the eighth source Single's value type T8, the ninth source Single's value type T9, the result value type R> Single | Returns: a Single that emits the zipped resultsthe first source Single source1, SingleSource<? extends T2> a second source Single source2, SingleSource<? extends T3> a third source Single source3, SingleSource<? extends T4> a fourth source Single source4, SingleSource<? extends T5> a fifth source Single source5, SingleSource<? extends T6> a sixth source Single source6, SingleSource<? extends T7> a seventh source Single source7, SingleSource<? extends T8> an eighth source Single source8, SingleSource<? extends T9> a ninth source Single source9, Function9<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? extends R> a function that, when applied to the item emitted by each of the source Singles, results in an
item that will be emitted by the resulting Single zipper)Returns a Single that emits the results of a specified combiner function applied to nine items emitted by nine other Singles. |
| public static < the common value type T, the result value type R> Single | Returns: the new Single instancethe function that receives an array with values from each SingleSource
and should return a value to be emitted to downstream zipper, SingleSource<? extends T>... the array of SingleSource instances. An empty sequence will result in an
sources)onError signal of NoSuchElementException.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. |
| public final < the type of items emitted by the U, other Singlethe type of items emitted by the resulting Single R> Single | Returns: a Single that pairs up values from the source Single and theother SingleSource
and emits the results of zipFunction applied to these pairsthe other SingleSource other, BiFunction<? super T, ? super U, ? extends R> a function that combines the pairs of items from the two SingleSources to generate the items to
be emitted by the resulting Single zipper)Returns a Single that emits the result of applying a specified function to the pair of items emitted by the source Single and another specified Single. |