Top Description Constructors Methods
io.reactivex.rxjava3.core

public abstract Class Single<T>

extends Object
implements SingleSource<T>
Class Inheritance
All Implemented Interfaces
io.reactivex.rxjava3.core.SingleSource
Known Direct Subclasses
io.reactivex.rxjava3.internal.jdk8.FlowableCollectWithCollectorSingle, io.reactivex.rxjava3.internal.jdk8.ObservableCollectWithCollectorSingle, io.reactivex.rxjava3.internal.jdk8.SingleFromCompletionStage, io.reactivex.rxjava3.internal.operators.completable.CompletableMaterialize, io.reactivex.rxjava3.internal.operators.completable.CompletableToSingle, io.reactivex.rxjava3.internal.operators.flowable.FlowableAllSingle, io.reactivex.rxjava3.internal.operators.flowable.FlowableAnySingle, io.reactivex.rxjava3.internal.operators.flowable.FlowableLastSingle, io.reactivex.rxjava3.internal.operators.flowable.FlowableSequenceEqualSingle, io.reactivex.rxjava3.internal.operators.flowable.FlowableSingleSingle, io.reactivex.rxjava3.internal.operators.flowable.FlowableElementAtSingle, io.reactivex.rxjava3.internal.operators.flowable.FlowableToListSingle, io.reactivex.rxjava3.internal.operators.flowable.FlowableReduceSeedSingle, io.reactivex.rxjava3.internal.operators.flowable.FlowableReduceWithSingle, io.reactivex.rxjava3.internal.operators.flowable.FlowableCollectSingle, io.reactivex.rxjava3.internal.operators.flowable.FlowableCountSingle, io.reactivex.rxjava3.internal.operators.maybe.MaybeContains, io.reactivex.rxjava3.internal.operators.maybe.MaybeCount, io.reactivex.rxjava3.internal.operators.maybe.MaybeIsEmptySingle, io.reactivex.rxjava3.internal.operators.maybe.MaybeMaterialize, io.reactivex.rxjava3.internal.operators.maybe.MaybeEqualSingle, io.reactivex.rxjava3.internal.operators.maybe.MaybeSwitchIfEmptySingle, io.reactivex.rxjava3.internal.operators.maybe.MaybeToSingle, io.reactivex.rxjava3.internal.operators.observable.ObservableAllSingle, io.reactivex.rxjava3.internal.operators.observable.ObservableAnySingle, io.reactivex.rxjava3.internal.operators.observable.ObservableReduceSeedSingle, io.reactivex.rxjava3.internal.operators.observable.ObservableReduceWithSingle, io.reactivex.rxjava3.internal.operators.observable.ObservableSequenceEqualSingle, io.reactivex.rxjava3.internal.operators.observable.ObservableSingleSingle, io.reactivex.rxjava3.internal.operators.observable.ObservableElementAtSingle, io.reactivex.rxjava3.internal.operators.observable.ObservableLastSingle, io.reactivex.rxjava3.internal.operators.observable.ObservableToListSingle, io.reactivex.rxjava3.internal.operators.observable.ObservableCollectSingle, io.reactivex.rxjava3.internal.operators.observable.ObservableCountSingle, io.reactivex.rxjava3.internal.operators.single.SingleFlatMap, io.reactivex.rxjava3.internal.operators.single.SingleMaterialize, io.reactivex.rxjava3.internal.operators.single.SingleAmb, io.reactivex.rxjava3.internal.operators.single.SingleCache, io.reactivex.rxjava3.internal.operators.single.SingleContains, io.reactivex.rxjava3.internal.operators.single.SingleCreate, io.reactivex.rxjava3.internal.operators.single.SingleDefer, io.reactivex.rxjava3.internal.operators.single.SingleDelay, io.reactivex.rxjava3.internal.operators.single.SingleDelayWithCompletable, io.reactivex.rxjava3.internal.operators.single.SingleDelayWithObservable, io.reactivex.rxjava3.internal.operators.single.SingleDelayWithPublisher, io.reactivex.rxjava3.internal.operators.single.SingleDelayWithSingle, io.reactivex.rxjava3.internal.operators.single.SingleDetach, io.reactivex.rxjava3.internal.operators.single.SingleDoAfterSuccess, io.reactivex.rxjava3.internal.operators.single.SingleDoAfterTerminate, io.reactivex.rxjava3.internal.operators.single.SingleDoFinally, io.reactivex.rxjava3.internal.operators.single.SingleDoOnDispose, io.reactivex.rxjava3.internal.operators.single.SingleDoOnError, io.reactivex.rxjava3.internal.operators.single.SingleDoOnEvent, io.reactivex.rxjava3.internal.operators.single.SingleDoOnLifecycle, io.reactivex.rxjava3.internal.operators.single.SingleDoOnSubscribe, io.reactivex.rxjava3.internal.operators.single.SingleDoOnSuccess, io.reactivex.rxjava3.internal.operators.single.SingleDoOnTerminate, io.reactivex.rxjava3.internal.operators.single.SingleEquals, io.reactivex.rxjava3.internal.operators.single.SingleError, io.reactivex.rxjava3.internal.operators.single.SingleFlatMapBiSelector, io.reactivex.rxjava3.internal.operators.single.SingleFlatMapNotification, io.reactivex.rxjava3.internal.operators.single.SingleFromCallable, io.reactivex.rxjava3.internal.operators.single.SingleFromPublisher, io.reactivex.rxjava3.internal.operators.single.SingleFromSupplier, io.reactivex.rxjava3.internal.operators.single.SingleFromUnsafeSource, io.reactivex.rxjava3.internal.operators.single.SingleHide, io.reactivex.rxjava3.internal.operators.single.SingleJust, io.reactivex.rxjava3.internal.operators.single.SingleLift, io.reactivex.rxjava3.internal.operators.single.SingleMap, io.reactivex.rxjava3.internal.operators.single.SingleNever, io.reactivex.rxjava3.internal.operators.single.SingleObserveOn, io.reactivex.rxjava3.internal.operators.single.SingleOnErrorReturn, io.reactivex.rxjava3.internal.operators.single.SingleResumeNext, io.reactivex.rxjava3.internal.operators.single.SingleSubscribeOn, io.reactivex.rxjava3.internal.operators.single.SingleTakeUntil, io.reactivex.rxjava3.internal.operators.single.SingleTimeInterval, io.reactivex.rxjava3.internal.operators.single.SingleTimeout, io.reactivex.rxjava3.internal.operators.single.SingleTimer, io.reactivex.rxjava3.internal.operators.single.SingleUnsubscribeOn, io.reactivex.rxjava3.internal.operators.single.SingleUsing, io.reactivex.rxjava3.internal.operators.single.SingleZipArray, io.reactivex.rxjava3.internal.operators.single.SingleZipIterable, io.reactivex.rxjava3.subjects.SingleSubject
Type Parameters
<T>
the type of the item emitted by the Single
Imports
java.util.*, java.util.concurrent.*, java.util.stream.*, org.reactivestreams.*, io.reactivex.rxjava3.annotations.*, io.reactivex.rxjava3.disposables.*, io.reactivex.rxjava3.exceptions.*, io.reactivex.rxjava3.functions.*, io.reactivex.rxjava3.internal.functions.*, io.reactivex.rxjava3.internal.fuseable.*, io.reactivex.rxjava3.internal.jdk8.*, io.reactivex.rxjava3.internal.observers.*, io.reactivex.rxjava3.internal.operators.completable.*, io.reactivex.rxjava3.internal.operators.flowable.*, io.reactivex.rxjava3.internal.operators.maybe.*, io.reactivex.rxjava3.internal.operators.mixed.*, io.reactivex.rxjava3.internal.operators.observable.ObservableSingleSingle, io.reactivex.rxjava3.internal.operators.single.*, io.reactivex.rxjava3.internal.util.ErrorMode, io.reactivex.rxjava3.observers.TestObserver, io.reactivex.rxjava3.plugins.RxJavaPlugins, io.reactivex.rxjava3.schedulers.*

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

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

Constructor Summary

AccessConstructor and Description
public

Method Summary

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

Returns:

the new Single instance
amb
(@NonNull Iterable<@NonNull ? extends SingleSource<? extends T>>
the 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
>
@NonNull Single<T>

Returns:

the new Single instance
ambArray
(@NonNull SingleSource<? extends T>...
the 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 @NonNull Single<T>

Returns:

the new Single instance. A subscription to this provided source will occur after subscribing to the current source.
ambWith
(@NonNull SingleSource<? extends T>
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 T

Returns:

the success value
blockingGet
()

Waits in a blocking fashion until the current Single signals a success value (which is returned) or an exception (which is propagated).

public final void
blockingSubscribe()

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

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

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

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

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

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

Subscribes to the current Single and calls the appropriate SingleObserver method on the current thread.

public final @NonNull Single<T>

Returns:

the new Single instance
cache
()

Stores the success value or exception from the current Single and replays it to late SingleObservers.

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

Returns:

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

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

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

Returns:

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

Transform a Single by applying a particular SingleTransformer function to it.

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

Returns:

the new Flowable instance
concat
(@NonNull Iterable<@NonNull ? extends SingleSource<? extends T>>
the 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
>
@NonNull Observable<T>

Returns:

the new Observable instance
concat
(@NonNull ObservableSource<? extends SingleSource<? extends T>>
the ObservableSource of SingleSource instances
sources
)

Concatenate the single values, in a non-overlapping fashion, of the SingleSources provided by an ObservableSource sequence.

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

Returns:

the new Flowable instance
concat
(@NonNull Publisher<@NonNull ? extends SingleSource<? extends T>>
the 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
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
concat
(@NonNull Publisher<@NonNull ? extends SingleSource<? extends T>>
the 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
>
@NonNull Flowable<T>

Returns:

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

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

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

Returns:

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

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

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

Returns:

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

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

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

Returns:

the new Flowable instance
concatArray
(@NonNull SingleSource<? extends T>...
the 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
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
concatArrayDelayError
(@NonNull SingleSource<? extends T>...
the 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
>
@NonNull Flowable<T>

Returns:

the new Flowable instance with the specified concatenation behavior
concatArrayEager
(@NonNull SingleSource<? extends T>...
a sequence of SingleSources 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
>
@NonNull Flowable<T>

Returns:

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

Concatenates a sequence of SingleSource eagerly into a single stream of values.

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

Returns:

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

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

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

Returns:

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

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

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

Returns:

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

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

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

Returns:

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

Concatenates an Iterable sequence of SingleSources eagerly into a single stream of values.

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

Returns:

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

Concatenates an Iterable sequence of SingleSources eagerly into a single stream of values and runs a limited number of the inner sources at once.

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

Returns:

the new Flowable instance with the specified concatenation behavior
concatEager
(@NonNull Publisher<@NonNull ? extends SingleSource<? extends T>>
a sequence of SingleSources 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
>
@NonNull Flowable<T>

Returns:

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

Concatenates a Publisher sequence of SingleSources eagerly into a single stream of values and runs a limited number of those inner SingleSources at once.

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

Returns:

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

Concatenates an Iterable sequence of SingleSources eagerly into a single stream of values, delaying errors until all the inner sources terminate.

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

Returns:

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

Concatenates an Iterable sequence of SingleSources eagerly into a single stream of values, delaying errors until all the inner sources terminate.

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

Returns:

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

Concatenates a Publisher sequence of SingleSources eagerly into a single stream of values, delaying errors until all the inner and the outer sequence terminate.

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

Returns:

the new Flowable instance with the specified concatenation behavior
concatEagerDelayError
(@NonNull Publisher<@NonNull ? extends SingleSource<? extends T>>
a sequence of SingleSources that need to be eagerly concatenated
sources
,
int
the number of inner SingleSources to run at once
maxConcurrency
)

Concatenates a Publisher sequence of SingleSources eagerly into a single stream of values, running at most the specified number of those inner SingleSources at once and delaying errors until all the inner and the outer sequence terminate.

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

Returns:

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

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

public final @NonNull Completable

Returns:

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

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

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

Returns:

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

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

public final @NonNull Flowable<T>

Returns:

the new Flowable that emits the item emitted by the current Single, followed by the item emitted by other
concatWith
(@NonNull SingleSource<? extends T>
a SingleSource to be concatenated after the current
other
)

Returns a Flowable that emits the item emitted by the current Single, then the item emitted by the specified SingleSource.

public final @NonNull Single<Boolean>

Returns:

the new Single instance
contains
(@NonNull Object
the value to compare against the success value of this Single
item
)

Signals true if the current Single signals a success value that is Object#equals(Object) with the value provided.

public final @NonNull Single<Boolean>

Returns:

the new Single instance
contains
(@NonNull Object
the value to compare against the success value of this Single
item
,
@NonNull 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 BiPredicate.

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

Returns:

the new Single instance
create
(@NonNull SingleOnSubscribe<T>
the emitter that is called when a SingleObserver subscribes to the returned Single
source
)

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

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

Returns:

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

Calls a Supplier for each individual SingleObserver to return the actual SingleSource to be subscribed to.

public final @NonNull Single<T>

Returns:

the new Single instance
delay
(long
the amount of time the success signal should be delayed for
time
,
@NonNull TimeUnit
the time unit
unit
)

Delays the emission of the success signal from the current Single by the specified amount.

public final @NonNull Single<T>

Returns:

the new Single instance
delay
(long
the amount of time the success or error signal should be delayed for
time
,
@NonNull 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 @NonNull Single<T>

Returns:

the new Single instance
delay
(long
the 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 Single by the specified amount.

public final @NonNull Single<T>

Returns:

the new Single instance
delay
(long
the 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 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 @NonNull Single<T>

Returns:

the new Single instance
delaySubscription
(@NonNull CompletableSource
the CompletableSource that has to complete before the subscription to the current Single happens
subscriptionIndicator
)

Delays the actual subscription to the current Single until the given other CompletableSource completes.

public final <
the element type of the other source
U
>
@NonNull Single<T>

Returns:

the new Single instance
delaySubscription
(@NonNull SingleSource<U>
the SingleSource that has to complete before the subscription to the current Single happens
subscriptionIndicator
)

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
>
@NonNull Single<T>

Returns:

the new Single instance
delaySubscription
(@NonNull ObservableSource<U>
the ObservableSource that has to signal a value or complete before the subscription to the current Single happens
subscriptionIndicator
)

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
>
@NonNull Single<T>

Returns:

the new Single instance
delaySubscription
(@NonNull Publisher<U>
the Publisher that has to signal a value or complete before the subscription to the current Single happens
subscriptionIndicator
)

Delays the actual subscription to the current Single until the given other Publisher signals its first value or completes.

public final @NonNull Single<T>

Returns:

the new Single instance
delaySubscription
(long
the time amount to wait with the subscription
time
,
@NonNull TimeUnit
the time unit of the waiting
unit
)

Delays the actual subscription to the current Single until the given time delay elapsed.

public final @NonNull Single<T>

Returns:

the new Single instance
delaySubscription
(long
the time amount to wait with the subscription
time
,
@NonNull TimeUnit
the time unit of the waiting
unit
,
@NonNull 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
>
@NonNull Maybe<R>

Returns:

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

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

public final @NonNull Single<T>

Returns:

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

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

public final @NonNull Single<T>

Returns:

the new Single that emits the same items as the current Single, then invokes the Action
doAfterTerminate
(@NonNull Action
an Action to be invoked when the current Single finishes
onAfterTerminate
)

Registers an Action to be called after this Single invokes either onSuccess or onError.

public final @NonNull Single<T>

Returns:

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

Calls the specified action after this Single signals onSuccess or onError or gets disposed by the downstream.

public final @NonNull Single<T>

Returns:

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

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

public final @NonNull Single<T>

Returns:

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

Calls the shared consumer with the error sent via onError for each SingleObserver that subscribes to the current Single.

public final @NonNull Single<T>

Returns:

the new Single instance
doOnEvent
(@NonNull BiConsumer<@Nullable ? super T, @Nullable ? super Throwable>
the 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 @NonNull Single<T>

Returns:

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

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

public final @NonNull Single<T>

Returns:

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

Calls the shared consumer with the Disposable sent through the onSubscribe for each SingleObserver that subscribes to the current Single.

public final @NonNull Single<T>

Returns:

the new Single instance
doOnSuccess
(@NonNull Consumer<? super T>
the 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 @NonNull Single<T>

Returns:

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

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

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

Returns:

the new Single instance
error
(@NonNull Supplier<? extends @NonNull Throwable>
the Supplier that is called for each individual SingleObserver and returns a Throwable instance to be emitted.
supplier
)

Signals a Throwable returned by the callback function for each individual SingleObserver.

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

Returns:

the new Single that invokes the subscriber's onError method when the subscriber subscribes to it
error
(@NonNull Throwable
the particular Throwable to pass to onError
throwable
)

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

public final @NonNull Maybe<T>

Returns:

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

Filters 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
>
@NonNull Single<R>

Returns:

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

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

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

Returns:

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

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

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

Returns:

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

Maps the onSuccess or onError signals of the current Single into a SingleSource and emits that SingleSource's signals.

public final @NonNull Completable

Returns:

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

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

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

Returns:

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

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

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

Returns:

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

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

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

Returns:

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

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

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

Returns:

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

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

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

Returns:

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

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

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

Returns:

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

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

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

Returns:

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

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

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

Returns:

the new Single whose SingleObservers' subscriptions trigger an invocation of the given function.
fromCallable
(@NonNull Callable<? extends T>
function which execution should be deferred, it will be invoked when SingleObserver will subscribe to the Single.
callable
)

Returns a Single that invokes the given Callable for each incoming SingleObserver and emits its value or exception to them.

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

Returns:

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

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

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

Returns:

the new Single that emits the item from the source Future
fromFuture
(@NonNull Future<? extends T>
the source Future
future
)

Converts a Future into a Single and awaits its outcome in a blocking fashion.

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

Returns:

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

Converts a Future into a Single and awaits its outcome, or timeout, in a blocking fashion.

public static <
the value type of the MaybeSource element
T
>
@NonNull Single<T>

Returns:

the new Single instance
fromMaybe
(@NonNull MaybeSource<T>
the MaybeSource instance to subscribe to, not null
maybe
)

Returns a Single instance that when subscribed to, subscribes to the MaybeSource instance and emits onSuccess as a single item, turns an onComplete into NoSuchElementException error signal or forwards the onError signal.

public static <
the value type of the MaybeSource element
T
>
@NonNull Single<T>

Returns:

the new Single instance
fromMaybe
(@NonNull MaybeSource<T>
the MaybeSource instance to subscribe to, not null
maybe
,
T
the item to signal if the current MaybeSource is empty
defaultItem
)

Returns a Single instance that when subscribed to, subscribes to the MaybeSource instance and emits onSuccess as a single item, emits the defaultItem for an onComplete signal or forwards the onError signal.

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

Returns:

the new Single instance
fromObservable
(@NonNull ObservableSource<? extends T>
the source sequence to wrap, not null
observable
)

Wraps a specific ObservableSource into a Single and signals its single element or error.

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

Returns:

the new Single instance
fromPublisher
(@NonNull Publisher<? extends T>
the source Publisher instance, not null
publisher
)

Wraps a specific Publisher into a Single and signals its single element or error.

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

Returns:

the new Single whose SingleObservers' subscriptions trigger an invocation of the given function.
fromSupplier
(@NonNull Supplier<? extends T>
function which execution should be deferred, it will be invoked when SingleObserver subscribes to the Single.
supplier
)

Returns a Single that invokes passed supplier and emits its result for each individual SingleObserver that subscribes.

public final @NonNull Single<T>

Returns:

the new Single instance
hide
()

Hides the identity of the current Single, including the Disposable that is sent to the downstream via onSubscribe().

public final @NonNull Completable

Returns:

the new Completable instance
ignoreElement
()

Returns a Completable that ignores the success value of this Single and signals onComplete instead.

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

Returns:

the new Single that emits item
just
(T
the item to emit
item
)

Returns a Single that emits a specified item.

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

Returns:

the new Single instance
lift
(@NonNull SingleOperator<? extends R, ? super T>
the 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.
lift
)

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

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

Returns:

the new Single that emits the item from the current Single, transformed by the specified function
map
(@NonNull Function<? super T, ? extends R>
a 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 current Single and emits the result of this function application.

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

Returns:

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

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

public final @NonNull Single<Notification<T>>

Returns:

the new Single instance
materialize
()

Maps the signal types of this Single into a Notification of the same kind and emits it as a single success value to downstream.

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

Returns:

the new Flowable instance
merge
(@NonNull Iterable<@NonNull ? extends SingleSource<? extends T>>
the 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
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
merge
(@NonNull Publisher<@NonNull ? extends SingleSource<? extends T>>
the Publisher emitting a sequence of SingleSources
sources
)

Merges a sequence of SingleSource instances emitted by a Publisher into a single Flowable sequence, running all SingleSources at once.

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

Returns:

the new Single that emits the item that is the result of flattening the Single emitted by source
merge
(@NonNull SingleSource<? extends SingleSource<? extends T>>
a Single that emits a Single
source
)

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

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

Returns:

the new Flowable that emits all of the items emitted by the source SingleSources
merge
(@NonNull SingleSource<? extends T>
a SingleSource to be merged
source1
,
@NonNull SingleSource<? extends T>
a SingleSource to be merged
source2
)

Flattens two SingleSources into one Flowable sequence, without any transformation.

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

Returns:

the new Flowable that emits all of the items emitted by the source SingleSources
merge
(@NonNull SingleSource<? extends T>
a SingleSource to be merged
source1
,
@NonNull SingleSource<? extends T>
a SingleSource to be merged
source2
,
@NonNull SingleSource<? extends T>
a SingleSource to be merged
source3
)

Flattens three SingleSources into one Flowable sequence, without any transformation.

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

Returns:

the new Flowable that emits all of the items emitted by the source SingleSources
merge
(@NonNull SingleSource<? extends T>
a SingleSource to be merged
source1
,
@NonNull SingleSource<? extends T>
a SingleSource to be merged
source2
,
@NonNull SingleSource<? extends T>
a SingleSource to be merged
source3
,
@NonNull SingleSource<? extends T>
a SingleSource to be merged
source4
)

Flattens four SingleSources into one Flowable sequence, without any transformation.

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

Returns:

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

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

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

Returns:

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

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

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

Returns:

the new Flowable instance
mergeDelayError
(@NonNull Iterable<@NonNull ? extends SingleSource<? extends T>>
the Iterable sequence of SingleSources
sources
)

Merges an Iterable sequence of SingleSource instances into one 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
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
mergeDelayError
(@NonNull Publisher<@NonNull ? extends SingleSource<? extends T>>
the Flowable sequence of SingleSources
sources
)

Merges a sequence of SingleSource instances emitted by a Publisher into a 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
>
@NonNull Flowable<T>

Returns:

the new Flowable that emits all of the items emitted by the source SingleSources
mergeDelayError
(@NonNull SingleSource<? extends T>
a SingleSource to be merged
source1
,
@NonNull SingleSource<? extends T>
a SingleSource to be merged
source2
)

Flattens two SingleSources into one Flowable, without any transformation, delaying any error(s) until all sources succeed or fail.

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

Returns:

the new Flowable that emits all of the items emitted by the source SingleSources
mergeDelayError
(@NonNull SingleSource<? extends T>
a SingleSource to be merged
source1
,
@NonNull SingleSource<? extends T>
a SingleSource to be merged
source2
,
@NonNull SingleSource<? extends T>
a SingleSource to be merged
source3
)

Flattens two SingleSources into one Flowable, without any transformation, delaying any error(s) until all sources succeed or fail.

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

Returns:

the new Flowable that emits all of the items emitted by the source SingleSources
mergeDelayError
(@NonNull SingleSource<? extends T>
a SingleSource to be merged
source1
,
@NonNull SingleSource<? extends T>
a SingleSource to be merged
source2
,
@NonNull SingleSource<? extends T>
a SingleSource to be merged
source3
,
@NonNull SingleSource<? extends T>
a SingleSource to be merged
source4
)

Flattens two SingleSources into one Flowable, without any transformation, delaying any error(s) until all sources succeed or fail.

public final @NonNull Flowable<T>

Returns:

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

Flattens this Single and another SingleSource into one Flowable, without any transformation.

public static <
the target value type
T
>
@NonNull Single<T>

Returns:

the singleton never instance
never
()

Returns a singleton instance of a never-signaling Single (only calls onSubscribe).

public final @NonNull Single<T>

Returns:

the new Single instance
observeOn
(@NonNull Scheduler
the Scheduler to notify subscribers on
scheduler
)

Signals the success item or the terminal signals of the current Single on the specified Scheduler, asynchronously.

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

Returns:

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

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

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
onErrorComplete
()

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

public final @NonNull Maybe<T>

Returns:

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

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

public final @NonNull Single<T>

Returns:

the new Single instance
onErrorResumeNext
(@NonNull Function<? super Throwable, ? extends SingleSource<? extends T>>
a function that returns a SingleSource that will take control if source Single encounters an error.
fallbackSupplier
)

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

public final @NonNull Single<T>

Returns:

the new Single instance
onErrorResumeWith
(@NonNull SingleSource<? extends T>
a Single that will take control if source Single encounters an error.
fallback
)

Resumes the flow with the given SingleSource when the current Single fails instead of signaling the error via onError.

public final @NonNull Single<T>

Returns:

the new Single instance
onErrorReturn
(@NonNull Function<Throwable, ? extends T>
a function that returns an item that the new Single will emit if the current Single encounters an error
itemSupplier
)

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

public final @NonNull Single<T>

Returns:

the new Single instance
onErrorReturnItem
(T
the value to signal if the current Single fails
item
)

Signals the specified value as success in case the current Single signals an error.

public final @NonNull Single<T>

Returns:

the new Single which nulls out references to the upstream producer and downstream SingleObserver if the sequence is terminated or downstream calls dispose()
onTerminateDetach
()

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

public final @NonNull Flowable<T>

Returns:

the new Flowable instance
repeat
()

Repeatedly re-subscribes to the current Single and emits each success value as a Flowable sequence.

public final @NonNull Flowable<T>

Returns:

the new Flowable instance
repeat
(long
the 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 as a Flowable sequence.

public final @NonNull Flowable<T>

Returns:

the new Flowable instance
repeatUntil
(@NonNull BooleanSupplier
the 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 and emits the success items as a Flowable sequence.

public final @NonNull Flowable<T>

Returns:

the new Flowable instance
repeatWhen
(@NonNull Function<? super Flowable<Object>, @NonNull ? extends Publisher<@NonNull ?>>
the function that is called with a 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.
handler
)

Re-subscribes to the current Single if the Publisher returned by the handler function signals a value in response to a value signaled through the Flowable the handler receives.

public final @NonNull Single<T>

Returns:

the new Single instance
retry
()

Repeatedly re-subscribes to the current Single indefinitely if it fails with an onError.

public final @NonNull Single<T>

Returns:

the new Single instance
retry
(long
the 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 @NonNull Single<T>

Returns:

the new Single instance
retry
(@NonNull BiPredicate<? super Integer, ? super Throwable>
the 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 @NonNull Single<T>

Returns:

the new Single instance
retry
(long
the number of times to resubscribe if the current Single fails
times
,
@NonNull 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 @NonNull Single<T>

Returns:

the new Single instance
retry
(@NonNull Predicate<? super Throwable>
the predicate called with 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 @NonNull Single<T>

Returns:

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

Retries until the given stop function returns true.

public final @NonNull Single<T>

Returns:

the new Single instance
retryWhen
(@NonNull Function<? super Flowable<Throwable>, @NonNull ? extends Publisher<@NonNull ?>>
the 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 void
safeSubscribe(@NonNull SingleObserver<? super T>
the potentially misbehaving SingleObserver
observer
)

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

public static <
the common value type
T
>
@NonNull Single<Boolean>

Returns:

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

Compares two SingleSources and emits true if they emit the same value (compared via Object#equals(Object)).

public final @NonNull Flowable<T>

Returns:

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

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

public final @NonNull Flowable<T>

Returns:

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

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

public final @NonNull Flowable<T>

Returns:

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

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

public final @NonNull Observable<T>

Returns:

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

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

public final @NonNull Flowable<T>

Returns:

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

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

public final @NonNull Disposable

Returns:

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

Subscribes to a Single but ignore its emission or notification.

public final @NonNull Disposable

Returns:

the new Disposable instance that can be used for disposing the subscription at any time
subscribe
(@NonNull BiConsumer<@Nullable ? super T, @Nullable ? 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 @NonNull Disposable

Returns:

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

Subscribes to a Single and provides a callback to handle the item it emits.

public final @NonNull Disposable

Returns:

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

Subscribes to a Single and provides callbacks to handle the item it emits or any error notification it issues.

public final @NonNull Disposable

Returns:

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

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

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

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

Implement this method in subclasses to handle the incoming SingleObservers.

public final @NonNull Single<T>

Returns:

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

Asynchronously subscribes SingleObservers to this Single on the specified Scheduler.

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

Returns:

the input observer
subscribeWith
(E
the 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 static <
the element type of the SingleSources
T
>
@NonNull Flowable<T>

Returns:

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

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

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

Returns:

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

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

public final @NonNull Single<T>

Returns:

the new Single that emits the item emitted by the current Single until such time as other terminates.
takeUntil
(@NonNull CompletableSource
the CompletableSource whose termination will cause takeUntil to emit the item from the current Single
other
)

Returns a Single that emits the item emitted by the current Single until a CompletableSource terminates.

public final <
the type of items emitted by other
E
>
@NonNull Single<T>

Returns:

the new Single that emits the item emitted by the current Single until such time as other emits its first item
takeUntil
(@NonNull Publisher<E>
the Publisher whose first emitted item or completion will cause takeUntil to emit CancellationException if the current Single hasn't completed till then
other
)

Returns a Single that emits the item emitted by the current Single until a Publisher emits an item or completes.

public final <
the type of item emitted by other
E
>
@NonNull Single<T>

Returns:

the new Single that emits the item emitted by the current Single until such time as other emits its item
takeUntil
(@NonNull SingleSource<? extends E>
the Single whose emitted item will cause takeUntil to emit CancellationException if the current Single hasn't completed till then
other
)

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

public final @NonNull TestObserver<T>

Returns:

the new TestObserver instance
test
()

Creates a TestObserver and subscribes it to this Single.

public final @NonNull TestObserver<T>

Returns:

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

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

public final @NonNull Single<Timed<T>>

Returns:

the new Single instance
timeInterval
()

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

public final @NonNull Single<Timed<T>>

Returns:

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

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

public final @NonNull Single<Timed<T>>

Returns:

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

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

public final @NonNull Single<Timed<T>>

Returns:

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

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

public final @NonNull Single<T>

Returns:

the new Single instance
timeout
(long
the timeout amount
timeout
,
@NonNull TimeUnit
the time unit
unit
)

Signals a TimeoutException if the current Single doesn't signal a success value within the specified timeout window.

public final @NonNull Single<T>

Returns:

the new Single instance
timeout
(long
the timeout amount
timeout
,
@NonNull TimeUnit
the time unit
unit
,
@NonNull Scheduler
the target Scheduler where the timeout is awaited and the TimeoutException signaled
scheduler
)

Signals a TimeoutException if the current Single doesn't signal a success value within the specified timeout window.

public final @NonNull Single<T>

Returns:

the new Single instance
timeout
(long
the timeout amount
timeout
,
@NonNull TimeUnit
the time unit
unit
,
@NonNull Scheduler
the Scheduler where the timeout is awaited and the subscription to other happens
scheduler
,
@NonNull SingleSource<? extends T>
the other SingleSource that gets subscribed to if the current Single times out
fallback
)

Runs the current Single and if it doesn't signal within the specified timeout window, it is disposed and the other SingleSource subscribed to.

public final @NonNull Single<T>

Returns:

the new Single instance
timeout
(long
the timeout amount
timeout
,
@NonNull TimeUnit
the time unit
unit
,
@NonNull SingleSource<? extends T>
the other SingleSource that gets subscribed to if the current Single times out
fallback
)

Runs the current Single and if it doesn't signal within the specified timeout window, it is disposed and the other SingleSource subscribed to.

private Single<T>
timeout0(final long timeout, final TimeUnit unit, final Scheduler scheduler, final SingleSource<? extends T> fallback)

public static @NonNull Single<Long>

Returns:

the new Single instance
timer
(long
the delay amount
delay
,
@NonNull TimeUnit
the time unit of the delay
unit
)

Signals success with 0L value after the given delay when a SingleObserver subscribes.

public static @NonNull Single<Long>

Returns:

the new Single instance
timer
(long
the delay amount
delay
,
@NonNull TimeUnit
the time unit of the delay
unit
,
@NonNull Scheduler
the Scheduler where the single 0L will be emitted
scheduler
)

Signals success with 0L value on the specified Scheduler after the given delay when a SingleObserver subscribes.

public final @NonNull Single<Timed<T>>

Returns:

the new Single instance
timestamp
()

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

public final @NonNull Single<Timed<T>>

Returns:

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

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

public final @NonNull Single<Timed<T>>

Returns:

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

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

public final @NonNull Single<Timed<T>>

Returns:

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

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

public final <
the resulting object type
R
>
R

Returns:

the converted value
to
(@NonNull SingleConverter<T, ? extends R>
the 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 @NonNull CompletionStage<T>

Returns:

the new CompletionStage instance
toCompletionStage
()

Signals the upstream success item (or error) via a CompletionStage.

public final @NonNull Flowable<T>

Returns:

the new Flowable instance
toFlowable
()

Converts this Single into a Flowable.

public final @NonNull Future<T>

Returns:

the new Future instance
toFuture
()

Returns a Future representing the single value emitted by this Single.

public final @NonNull Maybe<T>

Returns:

the new Maybe instance
toMaybe
()

Converts this Single into a Maybe.

public final @NonNull Observable<T>

Returns:

the new Observable instance
toObservable
()

Converts this Single into an Observable.

private static <T> @NonNull Single<T>
public static <
the value type
T
>
@NonNull Single<T>

Returns:

the new Single instance
unsafeCreate
(@NonNull SingleSource<T>
the 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 @NonNull Single<T>

Returns:

the new Single instance
unsubscribeOn
(@NonNull Scheduler
the 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
>
@NonNull Single<T>

Returns:

the new Single instance
using
(@NonNull Supplier<U>
the Supplier called for each SingleObserver to generate a resource object
resourceSupplier
,
@NonNull Function<? super U, ? extends SingleSource<? extends T>>
the function called with the returned resource object from resourceSupplier and should return a SingleSource instance to be run by the operator
sourceSupplier
,
@NonNull Consumer<? super U>
the 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.
resourceCleanup
)

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
>
@NonNull Single<T>

Returns:

the new Single instance
using
(@NonNull Supplier<U>
the Supplier called for each SingleObserver to generate a resource object
resourceSupplier
,
@NonNull Function<? super U, ? extends SingleSource<? extends T>>
the function called with the returned resource object from resourceSupplier and should return a SingleSource instance to be run by the operator
sourceSupplier
,
@NonNull Consumer<? super U>
the 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.
resourceCleanup
,
boolean
If true then resource disposal will happen either on a dispose() call before the upstream is disposed or just before the emission of a terminal event (onSuccess 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).
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
>
@NonNull Single<T>

Returns:

the new Single instance
wrap
(@NonNull SingleSource<T>
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
>
@NonNull Single<R>

Returns:

the new Single instance
zip
(@NonNull Iterable<@NonNull ? extends SingleSource<? extends T>>
the Iterable sequence of SingleSource instances. An empty sequence will result in an onError signal of NoSuchElementException.
sources
,
@NonNull Function<? super Object[], ? extends R>
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 the downstream.

public static <
the first source SingleSource's value type
T1
,
the second source SingleSource's value type
T2
,
the result value type
R
>
@NonNull Single<R>

Returns:

the new Single that emits the zipped results
zip
(@NonNull SingleSource<? extends T1>
the first source SingleSource
source1
,
@NonNull SingleSource<? extends T2>
a second source SingleSource
source2
,
@NonNull BiFunction<? super T1, ? super T2, ? extends R>
a function that, when applied to the item emitted by each of the source SingleSources, 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 SingleSources.

public static <
the first source SingleSource's value type
T1
,
the second source SingleSource's value type
T2
,
the third source SingleSource's value type
T3
,
the result value type
R
>
@NonNull Single<R>

Returns:

the new Single that emits the zipped results
zip
(@NonNull SingleSource<? extends T1>
the first source SingleSource
source1
,
@NonNull SingleSource<? extends T2>
a second source SingleSource
source2
,
@NonNull SingleSource<? extends T3>
a third source SingleSource
source3
,
@NonNull Function3<? super T1, ? super T2, ? super T3, ? extends R>
a function that, when applied to the item emitted by each of the source SingleSources, 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 SingleSources.

public static <
the first source SingleSource's value type
T1
,
the second source SingleSource's value type
T2
,
the third source SingleSource's value type
T3
,
the fourth source SingleSource's value type
T4
,
the result value type
R
>
@NonNull Single<R>

Returns:

the new Single that emits the zipped results
zip
(@NonNull SingleSource<? extends T1>
the first source SingleSource
source1
,
@NonNull SingleSource<? extends T2>
a second source SingleSource
source2
,
@NonNull SingleSource<? extends T3>
a third source SingleSource
source3
,
@NonNull SingleSource<? extends T4>
a fourth source SingleSource
source4
,
@NonNull 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 SingleSources, 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 SingleSources.

public static <
the first source SingleSource's value type
T1
,
the second source SingleSource's value type
T2
,
the third source SingleSource's value type
T3
,
the fourth source SingleSource's value type
T4
,
the fifth source SingleSource's value type
T5
,
the result value type
R
>
@NonNull Single<R>

Returns:

the new Single that emits the zipped results
zip
(@NonNull SingleSource<? extends T1>
the first source SingleSource
source1
,
@NonNull SingleSource<? extends T2>
a second source SingleSource
source2
,
@NonNull SingleSource<? extends T3>
a third source SingleSource
source3
,
@NonNull SingleSource<? extends T4>
a fourth source SingleSource
source4
,
@NonNull SingleSource<? extends T5>
a fifth source SingleSource
source5
,
@NonNull 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 SingleSources, 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 SingleSources.

public static <
the first source SingleSource's value type
T1
,
the second source SingleSource's value type
T2
,
the third source SingleSource's value type
T3
,
the fourth source SingleSource's value type
T4
,
the fifth source SingleSource's value type
T5
,
the sixth source SingleSource's value type
T6
,
the result value type
R
>
@NonNull Single<R>

Returns:

the new Single that emits the zipped results
zip
(@NonNull SingleSource<? extends T1>
the first source SingleSource
source1
,
@NonNull SingleSource<? extends T2>
a second source SingleSource
source2
,
@NonNull SingleSource<? extends T3>
a third source SingleSource
source3
,
@NonNull SingleSource<? extends T4>
a fourth source SingleSource
source4
,
@NonNull SingleSource<? extends T5>
a fifth source SingleSource
source5
,
@NonNull SingleSource<? extends T6>
a sixth source SingleSource
source6
,
@NonNull 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 SingleSources, 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 SingleSources.

public static <
the first source SingleSource's value type
T1
,
the second source SingleSource's value type
T2
,
the third source SingleSource's value type
T3
,
the fourth source SingleSource's value type
T4
,
the fifth source SingleSource's value type
T5
,
the sixth source SingleSource's value type
T6
,
the seventh source SingleSource's value type
T7
,
the result value type
R
>
@NonNull Single<R>

Returns:

the new Single that emits the zipped results
zip
(@NonNull SingleSource<? extends T1>
the first source SingleSource
source1
,
@NonNull SingleSource<? extends T2>
a second source SingleSource
source2
,
@NonNull SingleSource<? extends T3>
a third source SingleSource
source3
,
@NonNull SingleSource<? extends T4>
a fourth source SingleSource
source4
,
@NonNull SingleSource<? extends T5>
a fifth source SingleSource
source5
,
@NonNull SingleSource<? extends T6>
a sixth source SingleSource
source6
,
@NonNull SingleSource<? extends T7>
a seventh source SingleSource
source7
,
@NonNull Function7<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? extends R>
a function that, when applied to the item emitted by each of the source SingleSources, 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 SingleSources.

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

Returns:

the new Single that emits the zipped results
zip
(@NonNull SingleSource<? extends T1>
the first source SingleSource
source1
,
@NonNull SingleSource<? extends T2>
a second source SingleSource
source2
,
@NonNull SingleSource<? extends T3>
a third source SingleSource
source3
,
@NonNull SingleSource<? extends T4>
a fourth source SingleSource
source4
,
@NonNull SingleSource<? extends T5>
a fifth source SingleSource
source5
,
@NonNull SingleSource<? extends T6>
a sixth source SingleSource
source6
,
@NonNull SingleSource<? extends T7>
a seventh source SingleSource
source7
,
@NonNull SingleSource<? extends T8>
an eighth source SingleSource
source8
,
@NonNull Function8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R>
a function that, when applied to the item emitted by each of the source SingleSources, 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 SingleSources.

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

Returns:

the new Single that emits the zipped results
zip
(@NonNull SingleSource<? extends T1>
the first source SingleSource
source1
,
@NonNull SingleSource<? extends T2>
a second source SingleSource
source2
,
@NonNull SingleSource<? extends T3>
a third source SingleSource
source3
,
@NonNull SingleSource<? extends T4>
a fourth source SingleSource
source4
,
@NonNull SingleSource<? extends T5>
a fifth source SingleSource
source5
,
@NonNull SingleSource<? extends T6>
a sixth source SingleSource
source6
,
@NonNull SingleSource<? extends T7>
a seventh source SingleSource
source7
,
@NonNull SingleSource<? extends T8>
an eighth source SingleSource
source8
,
@NonNull SingleSource<? extends T9>
a ninth source SingleSource
source9
,
@NonNull Function9<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9, ? extends R>
a function that, when applied to the item emitted by each of the source SingleSources, 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 SingleSources.

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

Returns:

the new Single instance
zipArray
(@NonNull Function<? super Object[], ? extends R>
the function that receives an array with values from each SingleSource and should return a value to be emitted to downstream
zipper
,
@NonNull SingleSource<? extends T>...
the array of SingleSource instances. An empty sequence will result in an onError signal of NoSuchElementException.
sources
)

Waits until all SingleSource sources provided via an array signal a success value and calls a zipper function with an array of these values to return a result to be emitted to downstream.

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

Returns:

the new Single that pairs up values from the current Single and the other SingleSource and emits the results of zipFunction applied to these pairs
zipWith
(@NonNull SingleSource<U>
the other SingleSource
other
,
@NonNull 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 current Single and another specified SingleSource.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait