Top Description Inners Fields Constructors Methods
rx

public Class Single<T>

extends Object
Class Inheritance
Known Direct Subclasses
rx.internal.util.ScalarSynchronousSingle
Type Parameters
<T>
the type of the item emitted by the Single
Imports
java.util.Collection, java.util.concurrent.*, rx.Observable.Operator, rx.annotations.*, rx.exceptions.*, rx.functions.*, rx.internal.observers.AssertableSubscriberObservable, rx.internal.operators.*, rx.internal.util.*, rx.observables.ConnectableObservable, rx.observers.*, rx.plugins.RxJavaHooks, rx.schedulers.Schedulers, rx.singles.BlockingSingle, rx.subscriptions.Subscriptions

The Single class implements the Reactive Pattern for a single value response. See Observable for the implementation of the Reactive Pattern for a stream or vector of values.

Single behaves the same as Observable except that it can only emit either a single successful value, or an error (there is no "onComplete" notification as there is for Observable)

Like an Observable, a Single is lazy, can be either "hot" or "cold", synchronous or asynchronous.

The documentation for this class makes use of marble diagrams. The following legend explains these diagrams:

For more information see the ReactiveX documentation.

Since
1.2

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
Single.OnSubscribe<
the output value type
T
>

Invoked when Single.execute is called.

public static interface
Single.Transformer<
the source Single's value type
T
,
the transformed Single's value type
R
>

Convenience type that allows a function to fluently transform a Single into another Single via compose.

Field Summary

Modifier and TypeField and Description
pack-priv final Single.OnSubscribe<T>

Constructor Summary

AccessConstructor and Description
protected
Single(Single.OnSubscribe<T>
f to be executed when execute(SingleSubscriber) or subscribe(Subscriber) is called
f
)

Creates a Single with a Function to execute when it is subscribed to (executed).

protected
Single(final Observable.OnSubscribe<T>
f to be executed when execute(SingleSubscriber) or subscribe(Subscriber) is called
f
)

Deprecated 1.2.1: Not recommended, use Single(OnSubscribe) to avoid wrapping and conversion between the Observable and Single protocols.
Creates a Single with a Function to execute when it is subscribed to (executed).

Method Summary

Modifier and TypeMethod and Description
private static <T> Observable<T>
asObservable(Single<T> t)

Hides the identity of this Single.

public final Single<T>

Returns:

a Single that, when first subscribed to, caches its response for the benefit of subsequent subscribers
cache
()

Returns a Single that subscribes to this Single lazily, caches its success or error event and replays it to all the downstream subscribers.

public final <
the target type
R
>
Single<R>

Returns:

the new Single instance
cast
(final Class<R>
the type token to use for casting the success result from the current Single
klass
)

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

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

Returns:

the source Single, transformed by the transformer function
compose
(Single.Transformer<? super T, ? extends R>
implements the function that transforms the source Single
transformer
)

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

public static <
the common value type
T
>
Observable<T>

Returns:

an Observable that emits items emitted by the two source Singles, one after the other.
concat
(Single<? extends T>
a Single to be concatenated
t1
,
Single<? extends T>
a Single to be concatenated
t2
)

Returns an Observable that emits the items emitted by two Singles, one after the other.

public static <
the common value type
T
>
Observable<T>

Returns:

an Observable that emits items emitted by the three source Singles, one after the other.
concat
(Single<? extends T>
a Single to be concatenated
t1
,
Single<? extends T>
a Single to be concatenated
t2
,
Single<? extends T>
a Single to be concatenated
t3
)

Returns an Observable that emits the items emitted by three Singles, one after the other.

public static <
the common value type
T
>
Observable<T>

Returns:

an Observable that emits items emitted by the four source Singles, one after the other.
concat
(Single<? extends T>
a Single to be concatenated
t1
,
Single<? extends T>
a Single to be concatenated
t2
,
Single<? extends T>
a Single to be concatenated
t3
,
Single<? extends T>
a Single to be concatenated
t4
)

Returns an Observable that emits the items emitted by four Singles, one after the other.

public static <
the common value type
T
>
Observable<T>

Returns:

an Observable that emits items emitted by the five source Singles, one after the other.
concat
(Single<? extends T>
a Single to be concatenated
t1
,
Single<? extends T>
a Single to be concatenated
t2
,
Single<? extends T>
a Single to be concatenated
t3
,
Single<? extends T>
a Single to be concatenated
t4
,
Single<? extends T>
a Single to be concatenated
t5
)

Returns an Observable that emits the items emitted by five Singles, one after the other.

public static <
the common value type
T
>
Observable<T>

Returns:

an Observable that emits items emitted by the six source Singles, one after the other.
concat
(Single<? extends T>
a Single to be concatenated
t1
,
Single<? extends T>
a Single to be concatenated
t2
,
Single<? extends T>
a Single to be concatenated
t3
,
Single<? extends T>
a Single to be concatenated
t4
,
Single<? extends T>
a Single to be concatenated
t5
,
Single<? extends T>
a Single to be concatenated
t6
)

Returns an Observable that emits the items emitted by six Singles, one after the other.

public static <
the common value type
T
>
Observable<T>

Returns:

an Observable that emits items emitted by the seven source Singles, one after the other.
concat
(Single<? extends T>
a Single to be concatenated
t1
,
Single<? extends T>
a Single to be concatenated
t2
,
Single<? extends T>
a Single to be concatenated
t3
,
Single<? extends T>
a Single to be concatenated
t4
,
Single<? extends T>
a Single to be concatenated
t5
,
Single<? extends T>
a Single to be concatenated
t6
,
Single<? extends T>
a Single to be concatenated
t7
)

Returns an Observable that emits the items emitted by seven Singles, one after the other.

public static <
the common value type
T
>
Observable<T>

Returns:

an Observable that emits items emitted by the eight source Singles, one after the other.
concat
(Single<? extends T>
a Single to be concatenated
t1
,
Single<? extends T>
a Single to be concatenated
t2
,
Single<? extends T>
a Single to be concatenated
t3
,
Single<? extends T>
a Single to be concatenated
t4
,
Single<? extends T>
a Single to be concatenated
t5
,
Single<? extends T>
a Single to be concatenated
t6
,
Single<? extends T>
a Single to be concatenated
t7
,
Single<? extends T>
a Single to be concatenated
t8
)

Returns an Observable that emits the items emitted by eight Singles, one after the other.

public static <
the common value type
T
>
Observable<T>

Returns:

an Observable that emits items emitted by the nine source Singles, one after the other.
concat
(Single<? extends T>
a Single to be concatenated
t1
,
Single<? extends T>
a Single to be concatenated
t2
,
Single<? extends T>
a Single to be concatenated
t3
,
Single<? extends T>
a Single to be concatenated
t4
,
Single<? extends T>
a Single to be concatenated
t5
,
Single<? extends T>
a Single to be concatenated
t6
,
Single<? extends T>
a Single to be concatenated
t7
,
Single<? extends T>
a Single to be concatenated
t8
,
Single<? extends T>
a Single to be concatenated
t9
)

Returns an Observable that emits the items emitted by nine Singles, one after the other.

public final Observable<T>

Returns:

an Observable that emits the item emitted by the source Single, followed by the item emitted by t1
concatWith
(Single<? extends T>
a Single to be concatenated after the current
t1
)

Returns an Observable that emits the item emitted by the source Single, then the item emitted by the specified Single.

public static <
the type of the item that this Single emits
T
>
Single<T>

Returns:

a Single that, when a Subscriber subscribes to it, will execute the specified function
create
(Single.OnSubscribe<T>
a function that accepts an SingleSubscriber<T>, and invokes its onSuccess or onError methods as appropriate
f
)

Returns a Single that will execute the specified function when a SingleSubscriber executes it or a Subscriber subscribes to it.

public static <
the type of the items emitted by the Single.
T
>
Single<T>

Returns:

a Single whose Observers' subscriptions trigger an invocation of the given Single factory function.
defer
(final Callable<Single<T>>
the Single factory function to invoke for each Observer that subscribes to the resulting Single.
singleFactory
)

Returns a Single that calls a Single factory to create a Single for each new Observer that subscribes.

public final Single<T>

Returns:

the source Single shifted in time by the specified delay
delay
(long
the delay to shift the source by
delay
,
TimeUnit
the time unit of delay
unit
,
Scheduler
the Scheduler to use for delaying
scheduler
)

Returns a Single that emits the items emitted by the source Single shifted forward in time by a specified delay.

public final Single<T>

Returns:

the source Single shifted in time by the specified delay
delay
(long
the delay to shift the source by
delay
,
TimeUnit
the TimeUnit in which period is defined
unit
)

Returns a Single that emits the items emitted by the source Single shifted forward in time by a specified delay.

public final Single<T>

Returns:

a Single that delays the subscription to this Single until the Observable emits an element or completes normally.
delaySubscription
(Observable<?>
the Observable that should trigger the subscription to this Single.
other
)

Returns a Single that delays the subscription to this Single until the Observable completes.

public final Single<T>

Returns:

a Single that emits the same item or error as the source Single, then invokes the Action0
doAfterTerminate
(Action0
an Action0 to be invoked when the source Single finishes.
action
)

Registers an Action0 to be called when this Single invokes either SingleSubscriber#onSuccess(Object) onSuccess} or onError.

public final Single<T>

Returns:

the source Single with the side-effecting behavior applied
doOnEach
(final Action1<Notification<? extends T>>
the action to invoke when the source Single calls onSuccess or onError.
onNotification
)

Modifies the source Single so that it invokes an action when it calls onSuccess or onError.

public final Single<T>

Returns:

the source Single with the side-effecting behavior applied
doOnError
(final Action1<Throwable>
the action to invoke if the source Single calls onError
onError
)

Modifies the source Single so that it invokes an action if it calls onError.

public final Single<T>

Returns:

the source Single modified so as to call this Action when appropriate
doOnSubscribe
(final Action0
the action that gets called when an observer subscribes to this Single
subscribe
)

Modifies the source Single so that it invokes the given action when it is subscribed from its subscribers.

public final Single<T>

Returns:

the source Single with the side-effecting behavior applied
doOnSuccess
(final Action1<? super T>
the action to invoke when the source Single calls onSuccess
onSuccess
)

Modifies the source Single so that it invokes an action when it calls onSuccess.

public final Single<T>

Returns:

the source Single modified so as to call this Action when appropriate.
doOnUnsubscribe
(final Action0
the action that gets called when this Single is unsubscribed.
action
)

Modifies the source Single so that it invokes the given action when it is unsubscribed from its subscribers.

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

Returns:

a Single that invokes the subscriber's onError method when the subscriber subscribes to it
error
(final Throwable
the particular Throwable to pass to onError
exception
)

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

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

Returns:

the Single returned from func when applied to the item emitted by the source Single
flatMap
(final Func1<? super T, ? extends Single<? extends R>>
a function that, when applied to the item emitted by the source Single, returns a Single
func
)

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

public final Completable

Returns:

the Completable returned from func when applied to the item emitted by the source Single
flatMapCompletable
(final Func1<? super T, ? extends Completable>
a function that, when applied to the item emitted by the source Single, returns a Completable
func
)

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

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

Returns:

the Observable returned from func when applied to the item emitted by the source Single
flatMapObservable
(Func1<? super T, ? extends Observable<? extends R>>
a function that, when applied to the item emitted by the source Single, returns an Observable
func
)

Returns an Observable that emits items based on applying a specified function to the item emitted by the source Observable, where that function returns an Observable.

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

Returns:

a Single that emits the item from the source Future
from
(Future<? extends T>
the source Future
future
)

Converts a Future into a Single.

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

Returns:

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

Converts a Future into a Single, with a timeout on the Future.

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

Returns:

a Single that emits the item from the source Future
from
(Future<? extends T>
the source Future
future
,
Scheduler
the Scheduler to wait for the Future on. Use a Scheduler such as Schedulers#io() that can block and wait on the Future
scheduler
)

Converts a Future, operating on a specified Scheduler, into a Single.

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

Returns:

a Single whose Observers' subscriptions trigger an invocation of the given function.
fromCallable
(final Callable<? extends T>
function which execution should be deferred, it will be invoked when Observer will subscribe to the Single.
func
)

Returns a Single that invokes passed function and emits its result for each new Observer that subscribes.

public static <
the success value type
T
>
Single<T>

Returns:

the new Single instance
fromEmitter
(Action1<SingleEmitter<T>>
the callback invoked for each incoming SingleSubscriber
producer
)

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

pack-priv static <T> Single<? extends T>[]

Returns:

array of Single with same length as passed iterable.
iterableToArray
(final Iterable<? extends Single<? extends T>>
non null iterable of Single.
singlesIterable
)

FOR INTERNAL USE ONLY.

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

Returns:

a Single that emits value
just
(final T
the item to emit
value
)

Returns a Single that emits a specified item.

public final <
the downstream's value type (output)
R
>
Single<R>

Returns:

a Single that is the result of applying the lifted Operator to the source Single
lift
(final Observable.Operator<? extends R, ? super T>
the Operator that implements the Single-operating function to be applied to the source Single
lift
)

Lifts a function to the current Single and returns a new Single that when subscribed to will pass the values of the current Single through the Operator function.

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

Returns:

a Single that emits the item from the source Single, transformed by the specified function
map
(Func1<? super T, ? extends R>
a function to apply to the item emitted by the Single
func
)

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 static <
the value type of the sources and the output
T
>
Single<T>

Returns:

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

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

public static <
the common value type
T
>
Observable<T>

Returns:

an Observable that emits all of the items emitted by the source Singles
merge
(Single<? extends T>
a Single to be merged
t1
,
Single<? extends T>
a Single to be merged
t2
)

Flattens two Singles into a single Observable, without any transformation.

public static <
the common value type
T
>
Observable<T>

Returns:

an Observable that emits all of the items emitted by the source Singles
merge
(Single<? extends T>
a Single to be merged
t1
,
Single<? extends T>
a Single to be merged
t2
,
Single<? extends T>
a Single to be merged
t3
)

Flattens three Singles into a single Observable, without any transformation.

public static <
the common value type
T
>
Observable<T>

Returns:

an Observable that emits all of the items emitted by the source Singles
merge
(Single<? extends T>
a Single to be merged
t1
,
Single<? extends T>
a Single to be merged
t2
,
Single<? extends T>
a Single to be merged
t3
,
Single<? extends T>
a Single to be merged
t4
)

Flattens four Singles into a single Observable, without any transformation.

public static <
the common value type
T
>
Observable<T>

Returns:

an Observable that emits all of the items emitted by the source Singles
merge
(Single<? extends T>
a Single to be merged
t1
,
Single<? extends T>
a Single to be merged
t2
,
Single<? extends T>
a Single to be merged
t3
,
Single<? extends T>
a Single to be merged
t4
,
Single<? extends T>
a Single to be merged
t5
)

Flattens five Singles into a single Observable, without any transformation.

public static <
the common value type
T
>
Observable<T>

Returns:

an Observable that emits all of the items emitted by the source Singles
merge
(Single<? extends T>
a Single to be merged
t1
,
Single<? extends T>
a Single to be merged
t2
,
Single<? extends T>
a Single to be merged
t3
,
Single<? extends T>
a Single to be merged
t4
,
Single<? extends T>
a Single to be merged
t5
,
Single<? extends T>
a Single to be merged
t6
)

Flattens six Singles into a single Observable, without any transformation.

public static <
the common value type
T
>
Observable<T>

Returns:

an Observable that emits all of the items emitted by the source Singles
merge
(Single<? extends T>
a Single to be merged
t1
,
Single<? extends T>
a Single to be merged
t2
,
Single<? extends T>
a Single to be merged
t3
,
Single<? extends T>
a Single to be merged
t4
,
Single<? extends T>
a Single to be merged
t5
,
Single<? extends T>
a Single to be merged
t6
,
Single<? extends T>
a Single to be merged
t7
)

Flattens seven Singles into a single Observable, without any transformation.

public static <
the common value type
T
>
Observable<T>

Returns:

an Observable that emits all of the items emitted by the source Singles
merge
(Single<? extends T>
a Single to be merged
t1
,
Single<? extends T>
a Single to be merged
t2
,
Single<? extends T>
a Single to be merged
t3
,
Single<? extends T>
a Single to be merged
t4
,
Single<? extends T>
a Single to be merged
t5
,
Single<? extends T>
a Single to be merged
t6
,
Single<? extends T>
a Single to be merged
t7
,
Single<? extends T>
a Single to be merged
t8
)

Flattens eight Singles into a single Observable, without any transformation.

public static <
the common value type
T
>
Observable<T>

Returns:

an Observable that emits all of the items emitted by the source Singles
merge
(Single<? extends T>
a Single to be merged
t1
,
Single<? extends T>
a Single to be merged
t2
,
Single<? extends T>
a Single to be merged
t3
,
Single<? extends T>
a Single to be merged
t4
,
Single<? extends T>
a Single to be merged
t5
,
Single<? extends T>
a Single to be merged
t6
,
Single<? extends T>
a Single to be merged
t7
,
Single<? extends T>
a Single to be merged
t8
,
Single<? extends T>
a Single to be merged
t9
)

Flattens nine Singles into a single Observable, without any transformation.

public static <
the value type of the inner Singles and the resulting Observable
T
>
Observable<T>

Returns:

the new Observable instance
merge
(Observable<? extends Single<? extends T>>
the Observable that emits Singles to be merged
sources
)

Merges all Singles emitted by the Observable and runs them together until the source Observable and all inner Singles complete normally.

public static <
the value type of the inner Singles and the resulting Observable
T
>
Observable<T>

Returns:

the new Observable instance
merge
(Observable<? extends Single<? extends T>>
the Observable that emits Singles to be merged
sources
,
int
the maximum number of inner Singles to run at a time
maxConcurrency
)

Merges the Singles emitted by the Observable and runs up to the given number of them together at a time, until the Observable and all inner Singles terminate.

public static <
the value type of the inner Singles and the resulting Observable
T
>
Observable<T>

Returns:

the new Observable instance
mergeDelayError
(Observable<? extends Single<? extends T>>
the Observable that emits Singles to be merged
sources
)

Merges all Singles emitted by the Observable and runs them together, delaying errors from them and the Observable, until the source Observable and all inner Singles complete normally.

public static <
the value type of the inner Singles and the resulting Observable
T
>
Observable<T>

Returns:

the new Observable instance
mergeDelayError
(Observable<? extends Single<? extends T>>
the Observable that emits Singles to be merged
sources
,
int
the maximum number of inner Singles to run at a time
maxConcurrency
)

Merges the Singles emitted by the Observable and runs up to the given number of them together at a time, delaying errors from them and the Observable, until the Observable and all inner Singles terminate.

public final Observable<T>

Returns:

an Observable that emits all of the items emitted by the source Singles
mergeWith
(Single<? extends T>
a Single to be merged
t1
)

Flattens this and another Single into a single Observable, without any transformation.

public final Single<T>

Returns:

the source Single modified so that its subscribers are notified on the specified Scheduler
observeOn
(Scheduler
the Scheduler to notify subscribers on
scheduler
)

Modifies a Single to emit its item (or notify of its error) on a specified Scheduler, asynchronously.

public final Single<T>

Returns:

the original Single, with appropriately modified behavior.
onErrorResumeNext
(Single<? extends T>
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 Observer#onError(Throwable) if it encounters an error.

public final Single<T>

Returns:

the original Single, with appropriately modified behavior.
onErrorResumeNext
(final Func1<Throwable, ? extends Single<? extends T>>
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 Observer#onError(Throwable) if it encounters an error.

public final Single<T>

Returns:

the original Single with appropriately modified behavior
onErrorReturn
(Func1<Throwable, ? extends T>
a 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 onError if it encounters an error.

public final Single<T>

Returns:

the source Single modified with retry logic
retry
()

Returns a Single that mirrors the source Single, resubscribing to it if it calls onError (infinite retry count).

public final Single<T>

Returns:

the source Single modified with retry logic
retry
(final long
number of retry attempts before failing
count
)

Returns a Single that mirrors the source Single, resubscribing to it if it calls onError up to a specified number of retries.

public final Single<T>

Returns:

the source Single modified with retry logic
retry
(Func2<Integer, Throwable, Boolean>
the predicate that determines if a resubscription may happen in case of a specific exception and retry count
predicate
)

Returns a Single that mirrors the source Single, resubscribing to it if it calls onError and the predicate returns true for that specific exception and retry count.

public final Single<T>

Returns:

the source Single modified with retry logic
retryWhen
(final Func1<Observable<? extends Throwable>, ? extends Observable<?>>
receives an Observable of notifications with which a user can complete or error, aborting the retry
notificationHandler
)

Returns a Single that emits the same values as the source Single with the exception of an onError.

public final Subscription

Returns:

a Subscription reference can request the Single stop work.
subscribe
()

Subscribes to a Single but ignore its emission or notification.

public final Subscription

Returns:

a Subscription reference can request the Single stop work.
subscribe
(final Action1<? super T>
the Action1<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 Subscription

Returns:

a Subscription reference can request the Single stop work.
subscribe
(final Action1<? super T>
the Action1<T> you have designed to accept the emission from the Single
onSuccess
,
final Action1<Throwable>
the Action1<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 Subscription

Returns:

the Subscription that allows unsubscription
subscribe
(final Observer<? super T>
the Observer to subscribe
observer
)

Subscribes an Observer to this single and returns a Subscription that allows unsubscription.

public final Subscription

Returns:

a Subscription reference can request the Single stop work.
subscribe
(Subscriber<? super T>
the Subscriber that will handle the emission or notification from the Single
subscriber
)

Subscribes to a Single and provides a Subscriber that implements functions to handle the item the Single emits or any error notification it issues.

public final Subscription

Returns:

a Subscription reference can request the Single stop work.
subscribe
(final SingleSubscriber<? super T>
the SingleSubscriber that will handle the emission or notification from the Single
te
)

Subscribes to a Single and provides a SingleSubscriber that implements functions to handle the item the Single emits or any error notification it issues.

public final Single<T>

Returns:

the source Single modified so that its subscriptions happen on the specified Scheduler
subscribeOn
(final Scheduler
the Scheduler to perform subscription actions on
scheduler
)

Asynchronously subscribes subscribers to this Single on the specified Scheduler.

public final Single<T>

Returns:

a Single that emits the item emitted by the source Single until such time as other terminates.
takeUntil
(final Completable
the Completable whose termination will cause takeUntil to emit the item from the source Single
other
)

Returns a Single that emits the item emitted by the source Single until a Completable terminates.

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

Returns:

a Single that emits the item emitted by the source Single until such time as other emits its first item
takeUntil
(final Observable<? extends E>
the Observable whose first emitted item will cause takeUntil to emit the item from the source Single
other
)

Returns a Single that emits the item emitted by the source Single until an Observable emits an item.

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

Returns:

a Single that emits the item emitted by the source Single until such time as other emits its item
takeUntil
(final Single<? extends E>
the Single whose emitted item will cause takeUntil to emit the item from the source Single
other
)

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

public final AssertableSubscriber<T>

Returns:

the new AssertableSubscriber instance
test
()

Creates an AssertableSubscriber that requests Long.MAX_VALUE and subscribes it to this Observable.

public final Single<T>

Returns:

the source Single modified to notify subscribers of a TimeoutException in case of a timeout
timeout
(long
maximum duration before the Single times out
timeout
,
TimeUnit
the unit of time that applies to the timeout argument.
timeUnit
)

Returns a Single that mirrors the source Single but applies a timeout policy for its emitted item.

public final Single<T>

Returns:

the source Single modified to notify subscribers of a TimeoutException in case of a timeout
timeout
(long
maximum duration before the Single times out
timeout
,
TimeUnit
the unit of time that applies to the timeout argument
timeUnit
,
Scheduler
the Scheduler to run the timeout timers on
scheduler
)

Returns a Single that mirrors the source Single but applies a timeout policy for its emitted item, where this policy is governed on a specified Scheduler.

public final Single<T>

Returns:

the source Single modified to switch to the fallback Single in case of a timeout
timeout
(long
maximum time before a timeout occurs
timeout
,
TimeUnit
the unit of time that applies to the timeout argument
timeUnit
,
Single<? extends T>
the fallback Single to use in case of a timeout
other
)

Returns a Single that mirrors the source Single but applies a timeout policy for its emitted item.

public final Single<T>

Returns:

the source Single modified so that it will switch to the fallback Single in case of a timeout
timeout
(long
maximum duration before a timeout occurs
timeout
,
TimeUnit
the unit of time that applies to the timeout argument
timeUnit
,
Single<? extends T>
the Single to use as the fallback in case of a timeout
other
,
Scheduler
the Scheduler to run the timeout timers on
scheduler
)

Returns a Single that mirrors the source Single but applies a timeout policy for its emitted item, using a specified Scheduler.

public final <
the resulting object type
R
>
R

Returns:

the value returned by the function
to
(Func1<? super Single<T>, 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 BlockingSingle<T>

Returns:

a BlockingSingle version of this Single.
toBlocking
()

Converts a Single into a BlockingSingle (a Single with blocking operators).

public final Completable

Returns:

a Completable that calls onCompleted on it's subscriber when the source Single calls onSuccess.
toCompletable
()

Returns a Completable that discards result of the Single (similar to Observable#ignoreElements()) and calls onCompleted when this source Single calls onSuccess.

public final Observable<T>

Returns:

an Observable that emits a single item T.
toObservable
()

Converts this Single into an Observable.

public final Subscription

Returns:

the subscription that allows unsubscribing
unsafeSubscribe
(Subscriber<? super T>
the Subscriber that will handle the emission or notification from the Single
subscriber
)

Subscribes to a Single and invokes the OnSubscribe function without any contract protection, error handling, unsubscribe, or execution hooks.

private Subscription
unsafeSubscribe(Subscriber<? super T> subscriber, boolean start)

public final Single<T>

Returns:

the new Single instance
unsubscribeOn
(final Scheduler
the target scheduler where to execute the cancellation
scheduler
)

Returns a Single which makes sure when a subscriber cancels the subscription, the dispose is called on the specified scheduler

public static <
the value type of the generated source
T
,
the type of the per-subscriber resource
Resource
>
Single<T>

Returns:

the Single whose lifetime controls the lifetime of the dependent resource object
using
(final Func0<Resource>
the factory function to create a resource object that depends on the Single
resourceFactory
,
final Func1<? super Resource, ? extends Single<? extends T>>
the factory function to create a Single
singleFactory
,
final Action1<? super Resource>
the function that will dispose of the resource
disposeAction
)

Constructs a Single that creates a dependent resource object which is disposed of on unsubscription.

public static <
the value type of the generated source
T
,
the type of the per-subscriber resource
Resource
>
Single<T>

Returns:

the Single whose lifetime controls the lifetime of the dependent resource object
using
(final Func0<Resource>
the factory function to create a resource object that depends on the Single
resourceFactory
,
final Func1<? super Resource, ? extends Single<? extends T>>
the factory function to create a Single
singleFactory
,
final Action1<? super Resource>
the function that will dispose of the resource
disposeAction
,
boolean
if true then disposal will happen either on unsubscription or just before emission of a terminal event (onComplete or onError).
disposeEagerly
)

Constructs a Single that creates a dependent resource object which is disposed of just before termination if you have set disposeEagerly to true and unsubscription does not occur before termination.

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

Returns:

a Single that emits the zipped results
zip
(Single<? extends T1>
the first source Single
s1
,
Single<? extends T2>
a second source Single
s2
,
final Func2<? 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
zipFunction
)

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<R>

Returns:

a Single that emits the zipped results
zip
(Single<? extends T1>
the first source Single
s1
,
Single<? extends T2>
a second source Single
s2
,
Single<? extends T3>
a third source Single
s3
,
final Func3<? 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
zipFunction
)

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<R>

Returns:

a Single that emits the zipped results
zip
(Single<? extends T1>
the first source Single
s1
,
Single<? extends T2>
a second source Single
s2
,
Single<? extends T3>
a third source Single
s3
,
Single<? extends T4>
a fourth source Single
s4
,
final Func4<? 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
zipFunction
)

Returns an Observable 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<R>

Returns:

a Single that emits the zipped results
zip
(Single<? extends T1>
the first source Single
s1
,
Single<? extends T2>
a second source Single
s2
,
Single<? extends T3>
a third source Single
s3
,
Single<? extends T4>
a fourth source Single
s4
,
Single<? extends T5>
a fifth source Single
s5
,
final Func5<? 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
zipFunction
)

Returns an Observable 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<R>

Returns:

a Single that emits the zipped results
zip
(Single<? extends T1>
the first source Single
s1
,
Single<? extends T2>
a second source Single
s2
,
Single<? extends T3>
a third source Single
s3
,
Single<? extends T4>
a fourth source Single
s4
,
Single<? extends T5>
a fifth source Single
s5
,
Single<? extends T6>
a sixth source Single
s6
,
final Func6<? 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
zipFunction
)

Returns an Observable 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<R>

Returns:

a Single that emits the zipped results
zip
(Single<? extends T1>
the first source Single
s1
,
Single<? extends T2>
a second source Single
s2
,
Single<? extends T3>
a third source Single
s3
,
Single<? extends T4>
a fourth source Single
s4
,
Single<? extends T5>
a fifth source Single
s5
,
Single<? extends T6>
a sixth source Single
s6
,
Single<? extends T7>
a seventh source Single
s7
,
final Func7<? 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
zipFunction
)

Returns an Observable 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<R>

Returns:

a Single that emits the zipped results
zip
(Single<? extends T1>
the first source Single
s1
,
Single<? extends T2>
a second source Single
s2
,
Single<? extends T3>
a third source Single
s3
,
Single<? extends T4>
a fourth source Single
s4
,
Single<? extends T5>
a fifth source Single
s5
,
Single<? extends T6>
a sixth source Single
s6
,
Single<? extends T7>
a seventh source Single
s7
,
Single<? extends T8>
an eighth source Single
s8
,
final Func8<? 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
zipFunction
)

Returns an Observable 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<R>

Returns:

a Single that emits the zipped results
zip
(Single<? extends T1>
the first source Single
s1
,
Single<? extends T2>
a second source Single
s2
,
Single<? extends T3>
a third source Single
s3
,
Single<? extends T4>
a fourth source Single
s4
,
Single<? extends T5>
a fifth source Single
s5
,
Single<? extends T6>
a sixth source Single
s6
,
Single<? extends T7>
a seventh source Single
s7
,
Single<? extends T8>
an eighth source Single
s8
,
Single<? extends T9>
a ninth source Single
s9
,
final Func9<? 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
zipFunction
)

Returns an Observable that emits the results of a specified combiner function applied to nine items emitted by nine other Singles.

public static <
the result value type
R
>
Single<R>

Returns:

a Single that emits the zipped results
zip
(Iterable<? extends Single<?>>
an Iterable of source Singles. Should not be empty because Single either emits result or error. java.util.NoSuchElementException will be emit as error if Iterable will be empty.
singles
,
FuncN<? extends R>
a function that, when applied to an item emitted by each of the source Singles, results in an item that will be emitted by the resulting Single
zipFunction
)

Returns a Single that emits the result of specified combiner function applied to combination of items emitted, in sequence, by an Iterable of other Singles.

public final <
the type of items emitted by the other Single
T2
,
the type of items emitted by the resulting Single
R
>
Single<R>

Returns:

an Observable that pairs up values from the source Observable and the other Observable and emits the results of zipFunction applied to these pairs
zipWith
(Single<? extends T2>
the other Observable
other
,
Func2<? super T, ? super T2, ? extends R>
a function that combines the pairs of items from the two Observables to generate the items to be emitted by the resulting Single
zipFunction
)

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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait