T
- the type of the items emitted by the Observable
public abstract class Observable<T> extends Object implements ObservableSource<T>
Observable
class is the non-backpressured, optionally multi-valued base reactive class that
offers factory methods, intermediate operators and the ability to consume synchronous
and/or asynchronous reactive dataflows.
Many operators in the class accept ObservableSource
(s), the base reactive interface
for such non-backpressured flows, which Observable
itself implements as well.
The Observable
's operators, by default, run with a buffer size of 128 elements (see Flowable.bufferSize()
),
that can be overridden globally via the system parameter rx3.buffer-size
. Most operators, however, have
overloads that allow setting their internal buffer size explicitly.
The documentation for this class makes use of marble diagrams. The following legend explains these diagrams:
The design of this class was derived from the
Reactive-Streams design and specification
by removing any backpressure-related infrastructure and implementation detail, replacing the
org.reactivestreams.Subscription
with Disposable
as the primary means to dispose of
a flow.
The Observable
follows the protocol
onSubscribe onNext* (onError | onComplete)?
where
the stream can be disposed through the Disposable
instance provided to consumers through
Observer.onSubscribe
.
Unlike the Observable
of version 1.x, subscribe(Observer)
does not allow external disposal
of a subscription and the Observer
instance is expected to expose such capability.
Example:
Disposable d = Observable.just("Hello world!")
.delay(1, TimeUnit.SECONDS)
.subscribeWith(new DisposableObserver<String>() {
@Override public void onStart() {
System.out.println("Start!");
}
@Override public void onNext(String t) {
System.out.println(t);
}
@Override public void onError(Throwable t) {
t.printStackTrace();
}
@Override public void onComplete() {
System.out.println("Done!");
}
});
Thread.sleep(500);
// the sequence can now be disposed via dispose()
d.dispose();
Flowable
,
DisposableObserver
Constructor and Description |
---|
Observable() |
Modifier and Type | Method and Description |
---|---|
@NonNull Single<Boolean> |
all(@NonNull Predicate<? super T> predicate)
|
static <T> @NonNull Observable<T> |
amb(@NonNull Iterable<? extends ObservableSource<? extends T>> sources)
Mirrors the one
ObservableSource in an Iterable of several ObservableSource s that first either emits an item or sends
a termination notification. |
static <T> @NonNull Observable<T> |
ambArray(ObservableSource<? extends T>... sources)
Mirrors the one
ObservableSource in an array of several ObservableSource s that first either emits an item or sends
a termination notification. |
@NonNull Observable<T> |
ambWith(@NonNull ObservableSource<? extends T> other)
Mirrors the current
Observable or the other ObservableSource provided of which the first either emits an item or sends a termination
notification. |
@NonNull Single<Boolean> |
any(@NonNull Predicate<? super T> predicate)
Returns a
Single that emits true if any item emitted by the current Observable satisfies a
specified condition, otherwise false . |
T |
blockingFirst()
Returns the first item emitted by the current
Observable , or throws
NoSuchElementException if it emits no items. |
T |
blockingFirst(T defaultItem)
Returns the first item emitted by the current
Observable , or a default value if it emits no
items. |
void |
blockingForEach(@NonNull Consumer<? super T> onNext)
Consumes the current
Observable in a blocking fashion and invokes the given
Consumer with each upstream item on the current thread until the
upstream terminates. |
void |
blockingForEach(@NonNull Consumer<? super T> onNext,
int capacityHint)
Consumes the current
Observable in a blocking fashion and invokes the given
Consumer with each upstream item on the current thread until the
upstream terminates. |
@NonNull Iterable<T> |
blockingIterable()
Exposes the current
Observable as an Iterable which, when iterated,
subscribes to the current Observable and blocks
until the current Observable emits items or terminates. |
@NonNull Iterable<T> |
blockingIterable(int capacityHint)
Exposes the current
Observable as an Iterable which, when iterated,
subscribes to the current Observable and blocks
until the current Observable emits items or terminates. |
T |
blockingLast()
Returns the last item emitted by the current
Observable , or throws
NoSuchElementException if the current Observable emits no items. |
T |
blockingLast(T defaultItem)
Returns the last item emitted by the current
Observable , or a default value if it emits no
items. |
@NonNull Iterable<T> |
blockingLatest()
Returns an
Iterable that returns the latest item emitted by the current Observable ,
waiting if necessary for one to become available. |
@NonNull Iterable<T> |
blockingMostRecent(T initialItem)
Returns an
Iterable that always returns the item most recently emitted by the current
Observable . |
@NonNull Iterable<T> |
blockingNext()
Returns an
Iterable that blocks until the current Observable emits another item, then
returns that item. |
T |
blockingSingle()
If the current
Observable completes after emitting a single item, return that item, otherwise
throw a NoSuchElementException . |
T |
blockingSingle(T defaultItem)
If the current
Observable completes after emitting a single item, return that item; if it emits
more than one item, throw an IllegalArgumentException ; if it emits no items, return a default
value. |
@NonNull Stream<T> |
blockingStream()
Creates a sequential
Stream to consume or process the current Observable in a blocking manner via
the Java Stream API. |
@NonNull Stream<T> |
blockingStream(int capacityHint)
Creates a sequential
Stream to consume or process the current Observable in a blocking manner via
the Java Stream API. |
void |
blockingSubscribe()
Runs the current
Observable to a terminal event, ignoring any values and rethrowing any exception. |
void |
blockingSubscribe(@NonNull Consumer<? super T> onNext)
Subscribes to the source and calls the given callbacks on the current thread.
|
void |
blockingSubscribe(@NonNull Consumer<? super T> onNext,
@NonNull Consumer<? super Throwable> onError)
Subscribes to the source and calls the given callbacks on the current thread.
|
void |
blockingSubscribe(@NonNull Consumer<? super T> onNext,
@NonNull Consumer<? super Throwable> onError,
@NonNull Action onComplete)
Subscribes to the source and calls the given callbacks on the current thread.
|
void |
blockingSubscribe(@NonNull Observer<? super T> observer)
Subscribes to the source and calls the
Observer methods on the current thread. |
@NonNull Observable<List<T>> |
buffer(int count)
Returns an
Observable that emits buffers of items it collects from the current Observable . |
@NonNull Observable<List<T>> |
buffer(int count,
int skip)
Returns an
Observable that emits buffers of items it collects from the current Observable . |
<U extends Collection<? super T>> |
buffer(int count,
int skip,
@NonNull Supplier<U> bufferSupplier)
Returns an
Observable that emits buffers of items it collects from the current Observable . |
<U extends Collection<? super T>> |
buffer(int count,
@NonNull Supplier<U> bufferSupplier)
Returns an
Observable that emits buffers of items it collects from the current Observable . |
@NonNull Observable<List<T>> |
buffer(long timespan,
long timeskip,
@NonNull TimeUnit unit)
Returns an
Observable that emits buffers of items it collects from the current Observable . |
@NonNull Observable<List<T>> |
buffer(long timespan,
long timeskip,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits buffers of items it collects from the current Observable . |
<U extends Collection<? super T>> |
buffer(long timespan,
long timeskip,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
@NonNull Supplier<U> bufferSupplier)
Returns an
Observable that emits buffers of items it collects from the current Observable . |
@NonNull Observable<List<T>> |
buffer(long timespan,
@NonNull TimeUnit unit)
Returns an
Observable that emits buffers of items it collects from the current Observable . |
@NonNull Observable<List<T>> |
buffer(long timespan,
@NonNull TimeUnit unit,
int count)
Returns an
Observable that emits buffers of items it collects from the current Observable . |
@NonNull Observable<List<T>> |
buffer(long timespan,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits buffers of items it collects from the current Observable . |
@NonNull Observable<List<T>> |
buffer(long timespan,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
int count)
Returns an
Observable that emits buffers of items it collects from the current Observable . |
<U extends Collection<? super T>> |
buffer(long timespan,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
int count,
@NonNull Supplier<U> bufferSupplier,
boolean restartTimerOnMaxSize)
Returns an
Observable that emits buffers of items it collects from the current Observable . |
<TOpening,TClosing> |
buffer(@NonNull ObservableSource<? extends TOpening> openingIndicator,
@NonNull Function<? super TOpening,? extends ObservableSource<? extends TClosing>> closingIndicator)
Returns an
Observable that emits buffers of items it collects from the current Observable . |
<TOpening,TClosing,U extends Collection<? super T>> |
buffer(@NonNull ObservableSource<? extends TOpening> openingIndicator,
@NonNull Function<? super TOpening,? extends ObservableSource<? extends TClosing>> closingIndicator,
@NonNull Supplier<U> bufferSupplier)
Returns an
Observable that emits buffers of items it collects from the current Observable . |
<B> @NonNull Observable<List<T>> |
buffer(@NonNull ObservableSource<B> boundaryIndicator)
Returns an
Observable that emits non-overlapping buffered items from the current Observable each time the
specified boundary ObservableSource emits an item. |
<B> @NonNull Observable<List<T>> |
buffer(@NonNull ObservableSource<B> boundaryIndicator,
int initialCapacity)
Returns an
Observable that emits non-overlapping buffered items from the current Observable each time the
specified boundary ObservableSource emits an item. |
<B,U extends Collection<? super T>> |
buffer(@NonNull ObservableSource<B> boundaryIndicator,
@NonNull Supplier<U> bufferSupplier)
Returns an
Observable that emits non-overlapping buffered items from the current Observable each time the
specified boundary ObservableSource emits an item. |
static int |
bufferSize()
Returns the default 'island' size or capacity-increment hint for unbounded buffers.
|
@NonNull Observable<T> |
cache()
Returns an
Observable that subscribes to the current Observable lazily, caches all of its events
and replays them, in the same order as received, to all the downstream observers. |
@NonNull Observable<T> |
cacheWithInitialCapacity(int initialCapacity)
Returns an
Observable that subscribes to the current Observable lazily, caches all of its events
and replays them, in the same order as received, to all the downstream observers. |
<U> @NonNull Observable<U> |
cast(@NonNull Class<U> clazz)
Returns an
Observable that emits the upstream items while
they can be cast via Class.cast(Object) until the upstream terminates,
or until the upstream signals an item which can't be cast,
resulting in a ClassCastException to be signaled to the downstream. |
<R,A> @NonNull Single<R> |
collect(@NonNull Collector<? super T,A,R> collector)
|
<U> @NonNull Single<U> |
collect(@NonNull Supplier<? extends U> initialItemSupplier,
@NonNull BiConsumer<? super U,? super T> collector)
Collects items emitted by the finite source
Observable into a single mutable data structure and returns
a Single that emits this structure. |
<U> @NonNull Single<U> |
collectInto(U initialItem,
@NonNull BiConsumer<? super U,? super T> collector)
Collects items emitted by the finite source
Observable into a single mutable data structure and returns
a Single that emits this structure. |
static <T,R> @NonNull Observable<R> |
combineLatest(@NonNull Iterable<? extends ObservableSource<? extends T>> sources,
@NonNull Function<? super Object[],? extends R> combiner)
Combines a collection of source
ObservableSource s by emitting an item that aggregates the latest values of each of
the returned ObservableSource s each time an item is received from any of the returned ObservableSource s, where this
aggregation is defined by a specified function. |
static <T,R> @NonNull Observable<R> |
combineLatest(@NonNull Iterable<? extends ObservableSource<? extends T>> sources,
@NonNull Function<? super Object[],? extends R> combiner,
int bufferSize)
Combines an
Iterable of source ObservableSource s by emitting an item that aggregates the latest values of each of
the returned ObservableSource s each time an item is received from any of the returned ObservableSource s, where this
aggregation is defined by a specified function. |
static <T1,T2,R> @NonNull Observable<R> |
combineLatest(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull BiFunction<? super T1,? super T2,? extends R> combiner)
Combines two source
ObservableSource s by emitting an item that aggregates the latest values of each of the
ObservableSource s each time an item is received from either of the ObservableSource s, where this
aggregation is defined by a specified function. |
static <T1,T2,T3,R> |
combineLatest(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull ObservableSource<? extends T3> source3,
@NonNull Function3<? super T1,? super T2,? super T3,? extends R> combiner)
Combines three source
ObservableSource s by emitting an item that aggregates the latest values of each of the
ObservableSource s each time an item is received from any of the ObservableSource s, where this
aggregation is defined by a specified function. |
static <T1,T2,T3,T4,R> |
combineLatest(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull ObservableSource<? extends T3> source3,
@NonNull ObservableSource<? extends T4> source4,
@NonNull Function4<? super T1,? super T2,? super T3,? super T4,? extends R> combiner)
Combines four source
ObservableSource s by emitting an item that aggregates the latest values of each of the
ObservableSource s each time an item is received from any of the ObservableSource s, where this
aggregation is defined by a specified function. |
static <T1,T2,T3,T4,T5,R> |
combineLatest(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull ObservableSource<? extends T3> source3,
@NonNull ObservableSource<? extends T4> source4,
@NonNull ObservableSource<? extends T5> source5,
@NonNull Function5<? super T1,? super T2,? super T3,? super T4,? super T5,? extends R> combiner)
Combines five source
ObservableSource s by emitting an item that aggregates the latest values of each of the
ObservableSource s each time an item is received from any of the ObservableSource s, where this
aggregation is defined by a specified function. |
static <T1,T2,T3,T4,T5,T6,R> |
combineLatest(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull ObservableSource<? extends T3> source3,
@NonNull ObservableSource<? extends T4> source4,
@NonNull ObservableSource<? extends T5> source5,
@NonNull ObservableSource<? extends T6> source6,
@NonNull Function6<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? extends R> combiner)
Combines six source
ObservableSource s by emitting an item that aggregates the latest values of each of the
ObservableSource s each time an item is received from any of the ObservableSource s, where this
aggregation is defined by a specified function. |
static <T1,T2,T3,T4,T5,T6,T7,R> |
combineLatest(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull ObservableSource<? extends T3> source3,
@NonNull ObservableSource<? extends T4> source4,
@NonNull ObservableSource<? extends T5> source5,
@NonNull ObservableSource<? extends T6> source6,
@NonNull ObservableSource<? extends T7> source7,
@NonNull Function7<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? extends R> combiner)
Combines seven source
ObservableSource s by emitting an item that aggregates the latest values of each of the
ObservableSource s each time an item is received from any of the ObservableSource s, where this
aggregation is defined by a specified function. |
static <T1,T2,T3,T4,T5,T6,T7,T8,R> |
combineLatest(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull ObservableSource<? extends T3> source3,
@NonNull ObservableSource<? extends T4> source4,
@NonNull ObservableSource<? extends T5> source5,
@NonNull ObservableSource<? extends T6> source6,
@NonNull ObservableSource<? extends T7> source7,
@NonNull ObservableSource<? extends T8> source8,
@NonNull Function8<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? extends R> combiner)
Combines eight source
ObservableSource s by emitting an item that aggregates the latest values of each of the
ObservableSource s each time an item is received from any of the ObservableSource s, where this
aggregation is defined by a specified function. |
static <T1,T2,T3,T4,T5,T6,T7,T8,T9,R> |
combineLatest(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull ObservableSource<? extends T3> source3,
@NonNull ObservableSource<? extends T4> source4,
@NonNull ObservableSource<? extends T5> source5,
@NonNull ObservableSource<? extends T6> source6,
@NonNull ObservableSource<? extends T7> source7,
@NonNull ObservableSource<? extends T8> source8,
@NonNull ObservableSource<? extends T9> source9,
@NonNull Function9<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? super T9,? extends R> combiner)
Combines nine source
ObservableSource s by emitting an item that aggregates the latest values of each of the
ObservableSource s each time an item is received from any of the ObservableSource s, where this
aggregation is defined by a specified function. |
static <T,R> @NonNull Observable<R> |
combineLatestArray(@NonNull ObservableSource<? extends T>[] sources,
@NonNull Function<? super Object[],? extends R> combiner)
Combines an array of source
ObservableSource s by emitting an item that aggregates the latest values of each of
the ObservableSource s each time an item is received from any of the returned ObservableSource s, where this
aggregation is defined by a specified function. |
static <T,R> @NonNull Observable<R> |
combineLatestArray(@NonNull ObservableSource<? extends T>[] sources,
@NonNull Function<? super Object[],? extends R> combiner,
int bufferSize)
Combines an array of source
ObservableSource s by emitting an item that aggregates the latest values of each of
the ObservableSource s each time an item is received from any of the ObservableSource s, where this
aggregation is defined by a specified function. |
static <T,R> @NonNull Observable<R> |
combineLatestArrayDelayError(@NonNull ObservableSource<? extends T>[] sources,
@NonNull Function<? super Object[],? extends R> combiner)
Combines an array of
ObservableSource s by emitting an item that aggregates the latest values of each of
the ObservableSource s each time an item is received from any of the ObservableSource s, where this
aggregation is defined by a specified function. |
static <T,R> @NonNull Observable<R> |
combineLatestArrayDelayError(@NonNull ObservableSource<? extends T>[] sources,
@NonNull Function<? super Object[],? extends R> combiner,
int bufferSize)
Combines an array of
ObservableSource s by emitting an item that aggregates the latest values of each of
the ObservableSource s each time an item is received from any of the ObservableSource s, where this
aggregation is defined by a specified function and delays any error from the sources until
all source ObservableSource s terminate. |
static <T,R> @NonNull Observable<R> |
combineLatestDelayError(@NonNull Iterable<? extends ObservableSource<? extends T>> sources,
@NonNull Function<? super Object[],? extends R> combiner)
Combines an
Iterable of ObservableSource s by emitting an item that aggregates the latest values of each of
the ObservableSource s each time an item is received from any of the ObservableSource s, where this
aggregation is defined by a specified function and delays any error from the sources until
all source ObservableSource s terminate. |
static <T,R> @NonNull Observable<R> |
combineLatestDelayError(@NonNull Iterable<? extends ObservableSource<? extends T>> sources,
@NonNull Function<? super Object[],? extends R> combiner,
int bufferSize)
Combines an
Iterable of ObservableSource s by emitting an item that aggregates the latest values of each of
the ObservableSource s each time an item is received from any of the ObservableSource s, where this
aggregation is defined by a specified function and delays any error from the sources until
all source ObservableSource s terminate. |
<R> @NonNull Observable<R> |
compose(@NonNull ObservableTransformer<? super T,? extends R> composer)
Transform the current
Observable by applying a particular ObservableTransformer function to it. |
static <T> @NonNull Observable<T> |
concat(@NonNull Iterable<? extends ObservableSource<? extends T>> sources)
Concatenates elements of each
ObservableSource provided via an Iterable sequence into a single sequence
of elements without interleaving them. |
static <T> @NonNull Observable<T> |
concat(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources)
Returns an
Observable that emits the items emitted by each of the ObservableSource s emitted by the
ObservableSource , one after the other, without interleaving them. |
static <T> @NonNull Observable<T> |
concat(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources,
int bufferSize)
Returns an
Observable that emits the items emitted by each of the ObservableSource s emitted by the outer
ObservableSource , one after the other, without interleaving them. |
static <T> @NonNull Observable<T> |
concat(@NonNull ObservableSource<? extends T> source1,
ObservableSource<? extends T> source2)
Returns an
Observable that emits the items emitted by two ObservableSource s, one after the other, without
interleaving them. |
static <T> @NonNull Observable<T> |
concat(@NonNull ObservableSource<? extends T> source1,
@NonNull ObservableSource<? extends T> source2,
@NonNull ObservableSource<? extends T> source3)
Returns an
Observable that emits the items emitted by three ObservableSource s, one after the other, without
interleaving them. |
static <T> @NonNull Observable<T> |
concat(@NonNull ObservableSource<? extends T> source1,
@NonNull ObservableSource<? extends T> source2,
@NonNull ObservableSource<? extends T> source3,
@NonNull ObservableSource<? extends T> source4)
Returns an
Observable that emits the items emitted by four ObservableSource s, one after the other, without
interleaving them. |
static <T> @NonNull Observable<T> |
concatArray(ObservableSource<? extends T>... sources)
Concatenates a variable number of
ObservableSource sources. |
static <T> @NonNull Observable<T> |
concatArrayDelayError(ObservableSource<? extends T>... sources)
Concatenates a variable number of
ObservableSource sources and delays errors from any of them
till all terminate. |
static <T> @NonNull Observable<T> |
concatArrayEager(int maxConcurrency,
int bufferSize,
ObservableSource<? extends T>... sources)
Concatenates an array of
ObservableSource s eagerly into a single stream of values. |
static <T> @NonNull Observable<T> |
concatArrayEager(ObservableSource<? extends T>... sources)
Concatenates an array of
ObservableSource s eagerly into a single stream of values. |
static <T> @NonNull Observable<T> |
concatArrayEagerDelayError(int maxConcurrency,
int bufferSize,
ObservableSource<? extends T>... sources)
Concatenates an array of
ObservableSource s eagerly into a single stream of values
and delaying any errors until all sources terminate. |
static <T> @NonNull Observable<T> |
concatArrayEagerDelayError(ObservableSource<? extends T>... sources)
Concatenates an array of
ObservableSource s eagerly into a single stream of values
and delaying any errors until all sources terminate. |
static <T> @NonNull Observable<T> |
concatDelayError(@NonNull Iterable<? extends ObservableSource<? extends T>> sources)
Concatenates the
Iterable sequence of ObservableSource s into a single Observable sequence
by subscribing to each ObservableSource , one after the other, one at a time and delays any errors till
the all inner ObservableSource s terminate. |
static <T> @NonNull Observable<T> |
concatDelayError(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources)
Concatenates the
ObservableSource sequence of ObservableSource s into a single Observable sequence
by subscribing to each inner ObservableSource , one after the other, one at a time and delays any errors till the
all inner and the outer ObservableSource s terminate. |
static <T> @NonNull Observable<T> |
concatDelayError(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources,
int bufferSize,
boolean tillTheEnd)
Concatenates the
ObservableSource sequence of ObservableSource s into a single sequence by subscribing to each inner ObservableSource ,
one after the other, one at a time and delays any errors till the all inner and the outer ObservableSource s terminate. |
static <T> @NonNull Observable<T> |
concatEager(@NonNull Iterable<? extends ObservableSource<? extends T>> sources)
Concatenates a sequence of
ObservableSource s eagerly into a single stream of values. |
static <T> @NonNull Observable<T> |
concatEager(@NonNull Iterable<? extends ObservableSource<? extends T>> sources,
int maxConcurrency,
int bufferSize)
Concatenates a sequence of
ObservableSource s eagerly into a single stream of values and
runs a limited number of inner sequences at once. |
static <T> @NonNull Observable<T> |
concatEager(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources)
Concatenates an
ObservableSource sequence of ObservableSource s eagerly into a single stream of values. |
static <T> @NonNull Observable<T> |
concatEager(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources,
int maxConcurrency,
int bufferSize)
Concatenates an
ObservableSource sequence of ObservableSource s eagerly into a single stream of values
and runs a limited number of inner sequences at once. |
static <T> @NonNull Observable<T> |
concatEagerDelayError(@NonNull Iterable<? extends ObservableSource<? extends T>> sources)
Concatenates a sequence of
ObservableSource s eagerly into a single stream of values,
delaying errors until all the inner sequences terminate. |
static <T> @NonNull Observable<T> |
concatEagerDelayError(@NonNull Iterable<? extends ObservableSource<? extends T>> sources,
int maxConcurrency,
int bufferSize)
Concatenates a sequence of
ObservableSource s eagerly into a single stream of values,
delaying errors until all the inner sequences terminate and runs a limited number of inner
sequences at once. |
static <T> @NonNull Observable<T> |
concatEagerDelayError(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources)
Concatenates an
ObservableSource sequence of ObservableSource s eagerly into a single stream of values,
delaying errors until all the inner and the outer sequence terminate. |
static <T> @NonNull Observable<T> |
concatEagerDelayError(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources,
int maxConcurrency,
int bufferSize)
Concatenates an
ObservableSource sequence of ObservableSource s eagerly into a single stream of values,
delaying errors until all the inner and the outer sequence terminate and runs a limited number of inner sequences at once. |
<R> @NonNull Observable<R> |
concatMap(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper)
Returns a new
Observable that emits items resulting from applying a function that you supply to each item
emitted by the current Observable , where that function returns an ObservableSource , and then emitting the items
that result from concatenating those returned ObservableSource s. |
<R> @NonNull Observable<R> |
concatMap(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper,
int bufferSize)
Returns a new
Observable that emits items resulting from applying a function that you supply to each item
emitted by the current Observable , where that function returns an ObservableSource , and then emitting the items
that result from concatenating those returned ObservableSource s. |
<R> @NonNull Observable<R> |
concatMap(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper,
int bufferSize,
@NonNull Scheduler scheduler)
Returns a new
Observable that emits items resulting from applying a function that you supply to each item
emitted by the current Observable , where that function returns an ObservableSource , and then emitting the items
that result from concatenating those returned ObservableSource s. |
@NonNull Completable |
concatMapCompletable(@NonNull Function<? super T,? extends CompletableSource> mapper)
Maps each element of the current
Observable into CompletableSource s, subscribes to them one at a time in
order and waits until the upstream and all CompletableSource s complete. |
@NonNull Completable |
concatMapCompletable(@NonNull Function<? super T,? extends CompletableSource> mapper,
int capacityHint)
Maps each element of the current
Observable into CompletableSource s, subscribes to them one at a time in
order and waits until the upstream and all CompletableSource s complete. |
@NonNull Completable |
concatMapCompletableDelayError(@NonNull Function<? super T,? extends CompletableSource> mapper)
Maps the upstream items into
CompletableSource s and subscribes to them one after the
other terminates, delaying all errors till both the current Observable and all
inner CompletableSource s terminate. |
@NonNull Completable |
concatMapCompletableDelayError(@NonNull Function<? super T,? extends CompletableSource> mapper,
boolean tillTheEnd)
Maps the upstream items into
CompletableSource s and subscribes to them one after the
other terminates, optionally delaying all errors till both the current Observable and all
inner CompletableSource s terminate. |
@NonNull Completable |
concatMapCompletableDelayError(@NonNull Function<? super T,? extends CompletableSource> mapper,
boolean tillTheEnd,
int bufferSize)
Maps the upstream items into
CompletableSource s and subscribes to them one after the
other terminates, optionally delaying all errors till both the current Observable and all
inner CompletableSource s terminate. |
<R> @NonNull Observable<R> |
concatMapDelayError(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper)
Maps each of the items into an
ObservableSource , subscribes to them one after the other,
one at a time and emits their values in order
while delaying any error from either this or any of the inner ObservableSource s
till all of them terminate. |
<R> @NonNull Observable<R> |
concatMapDelayError(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper,
boolean tillTheEnd,
int bufferSize)
Maps each of the items into an
ObservableSource , subscribes to them one after the other,
one at a time and emits their values in order
while delaying any error from either this or any of the inner ObservableSource s
till all of them terminate. |
<R> @NonNull Observable<R> |
concatMapDelayError(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper,
boolean tillTheEnd,
int bufferSize,
@NonNull Scheduler scheduler)
Maps each of the items into an
ObservableSource , subscribes to them one after the other,
one at a time and emits their values in order
while delaying any error from either this or any of the inner ObservableSource s
till all of them terminate. |
<R> @NonNull Observable<R> |
concatMapEager(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper)
Maps a sequence of values into
ObservableSource s and concatenates these ObservableSource s eagerly into a single
Observable sequence. |
<R> @NonNull Observable<R> |
concatMapEager(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper,
int maxConcurrency,
int bufferSize)
Maps a sequence of values into
ObservableSource s and concatenates these ObservableSource s eagerly into a single
Observable sequence. |
<R> @NonNull Observable<R> |
concatMapEagerDelayError(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper,
boolean tillTheEnd)
Maps a sequence of values into
ObservableSource s and concatenates these ObservableSource s eagerly into a single
Observable sequence. |
<R> @NonNull Observable<R> |
concatMapEagerDelayError(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper,
boolean tillTheEnd,
int maxConcurrency,
int bufferSize)
Maps a sequence of values into
ObservableSource s and concatenates these ObservableSource s eagerly into a single
Observable sequence. |
<U> @NonNull Observable<U> |
concatMapIterable(@NonNull Function<? super T,? extends Iterable<? extends U>> mapper)
Returns an
Observable that concatenate each item emitted by the current Observable with the values in an
Iterable corresponding to that item that is generated by a selector. |
<R> @NonNull Observable<R> |
concatMapMaybe(@NonNull Function<? super T,? extends MaybeSource<? extends R>> mapper)
Maps the upstream items into
MaybeSource s and subscribes to them one after the
other succeeds or completes, emits their success value if available or terminates immediately if
either the current Observable or the current inner MaybeSource fail. |
<R> @NonNull Observable<R> |
concatMapMaybe(@NonNull Function<? super T,? extends MaybeSource<? extends R>> mapper,
int bufferSize)
Maps the upstream items into
MaybeSource s and subscribes to them one after the
other succeeds or completes, emits their success value if available or terminates immediately if
either the current Observable or the current inner MaybeSource fail. |
<R> @NonNull Observable<R> |
concatMapMaybeDelayError(@NonNull Function<? super T,? extends MaybeSource<? extends R>> mapper)
Maps the upstream items into
MaybeSource s and subscribes to them one after the
other terminates, emits their success value if available and delaying all errors
till both the current Observable and all inner MaybeSource s terminate. |
<R> @NonNull Observable<R> |
concatMapMaybeDelayError(@NonNull Function<? super T,? extends MaybeSource<? extends R>> mapper,
boolean tillTheEnd)
Maps the upstream items into
MaybeSource s and subscribes to them one after the
other terminates, emits their success value if available and optionally delaying all errors
till both the current Observable and all inner MaybeSource s terminate. |
<R> @NonNull Observable<R> |
concatMapMaybeDelayError(@NonNull Function<? super T,? extends MaybeSource<? extends R>> mapper,
boolean tillTheEnd,
int bufferSize)
Maps the upstream items into
MaybeSource s and subscribes to them one after the
other terminates, emits their success value if available and optionally delaying all errors
till both the current Observable and all inner MaybeSource s terminate. |
<R> @NonNull Observable<R> |
concatMapSingle(@NonNull Function<? super T,? extends SingleSource<? extends R>> mapper)
Maps the upstream items into
SingleSource s and subscribes to them one after the
other succeeds, emits their success values or terminates immediately if
either the current Observable or the current inner SingleSource fail. |
<R> @NonNull Observable<R> |
concatMapSingle(@NonNull Function<? super T,? extends SingleSource<? extends R>> mapper,
int bufferSize)
Maps the upstream items into
SingleSource s and subscribes to them one after the
other succeeds, emits their success values or terminates immediately if
either the current Observable or the current inner SingleSource fail. |
<R> @NonNull Observable<R> |
concatMapSingleDelayError(@NonNull Function<? super T,? extends SingleSource<? extends R>> mapper)
Maps the upstream items into
SingleSource s and subscribes to them one after the
other succeeds or fails, emits their success values and delays all errors
till both the current Observable and all inner SingleSource s terminate. |
<R> @NonNull Observable<R> |
concatMapSingleDelayError(@NonNull Function<? super T,? extends SingleSource<? extends R>> mapper,
boolean tillTheEnd)
Maps the upstream items into
SingleSource s and subscribes to them one after the
other succeeds or fails, emits their success values and optionally delays all errors
till both the current Observable and all inner SingleSource s terminate. |
<R> @NonNull Observable<R> |
concatMapSingleDelayError(@NonNull Function<? super T,? extends SingleSource<? extends R>> mapper,
boolean tillTheEnd,
int bufferSize)
Maps the upstream items into
SingleSource s and subscribes to them one after the
other succeeds or fails, emits their success values and optionally delays errors
till both the current Observable and all inner SingleSource s terminate. |
<R> @NonNull Observable<R> |
concatMapStream(@NonNull Function<? super T,? extends Stream<? extends R>> mapper)
Maps each upstream item into a
Stream and emits the Stream 's items to the downstream in a sequential fashion. |
@NonNull Observable<T> |
concatWith(@NonNull CompletableSource other)
Returns an
Observable that emits items from the current Observable and when it completes normally, the
other CompletableSource is subscribed to and the returned Observable emits its terminal events. |
@NonNull Observable<T> |
concatWith(@NonNull MaybeSource<? extends T> other)
Returns an
Observable that emits the items from the current Observable followed by the success item or terminal events
of the other MaybeSource . |
@NonNull Observable<T> |
concatWith(@NonNull ObservableSource<? extends T> other)
Returns an
Observable that first emits the items emitted from the current Observable , then items
from the other ObservableSource without interleaving them. |
@NonNull Observable<T> |
concatWith(@NonNull SingleSource<? extends T> other)
Returns an
Observable that emits the items from the current Observable followed by the success item or error event
of the other SingleSource . |
@NonNull Single<Boolean> |
contains(@NonNull Object item)
|
@NonNull Single<Long> |
count()
|
static <T> @NonNull Observable<T> |
create(@NonNull ObservableOnSubscribe<T> source)
Provides an API (via a cold
Observable ) that bridges the reactive world with the callback-style world. |
<U> @NonNull Observable<T> |
debounce(@NonNull Function<? super T,? extends ObservableSource<U>> debounceIndicator)
Returns an
Observable that mirrors the current Observable , except that it drops items emitted by the
current Observable that are followed by another item within a computed debounce duration
denoted by an item emission or completion from a generated inner ObservableSource for that original item. |
@NonNull Observable<T> |
debounce(long timeout,
@NonNull TimeUnit unit)
Returns an
Observable that mirrors the current Observable , except that it drops items emitted by the
current Observable that are followed by newer items before a timeout value expires. |
@NonNull Observable<T> |
debounce(long timeout,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that mirrors the current Observable , except that it drops items emitted by the
current Observable that are followed by newer items before a timeout value expires on a specified
Scheduler . |
@NonNull Observable<T> |
debounce(long timeout,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
@NonNull Consumer<? super T> onDropped)
Returns an
Observable that mirrors the current Observable , except that it drops items emitted by the
current Observable that are followed by newer items before a timeout value expires on a specified
Scheduler . |
@NonNull Observable<T> |
defaultIfEmpty(T defaultItem)
Returns an
Observable that emits the items emitted by the current Observable or a specified default item
if the current Observable is empty. |
static <T> @NonNull Observable<T> |
defer(@NonNull Supplier<? extends ObservableSource<? extends T>> supplier)
Returns an
Observable that calls an ObservableSource factory to create an ObservableSource for each new Observer
that subscribes. |
<U> @NonNull Observable<T> |
delay(@NonNull Function<? super T,? extends ObservableSource<U>> itemDelayIndicator)
Returns an
Observable that delays the emissions of the current Observable via
a per-item derived ObservableSource 's item emission or termination, on a per source item basis. |
@NonNull Observable<T> |
delay(long time,
@NonNull TimeUnit unit)
Returns an
Observable that emits the items emitted by the current Observable shifted forward in time by a
specified delay. |
@NonNull Observable<T> |
delay(long time,
@NonNull TimeUnit unit,
boolean delayError)
Returns an
Observable that emits the items emitted by the current Observable shifted forward in time by a
specified delay. |
@NonNull Observable<T> |
delay(long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits the items emitted by the current Observable shifted forward in time by a
specified delay. |
@NonNull Observable<T> |
delay(long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
boolean delayError)
Returns an
Observable that emits the items emitted by the current Observable shifted forward in time by a
specified delay. |
<U,V> @NonNull Observable<T> |
delay(@NonNull ObservableSource<U> subscriptionIndicator,
@NonNull Function<? super T,? extends ObservableSource<V>> itemDelayIndicator)
Returns an
Observable that delays the subscription to and emissions from the current Observable via
ObservableSource s for the subscription itself and on a per-item basis. |
@NonNull Observable<T> |
delaySubscription(long time,
@NonNull TimeUnit unit)
Returns an
Observable that delays the subscription to the current Observable by a given amount of time. |
@NonNull Observable<T> |
delaySubscription(long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that delays the subscription to the current Observable by a given amount of time,
both waiting and subscribing on a given Scheduler . |
<U> @NonNull Observable<T> |
delaySubscription(@NonNull ObservableSource<U> subscriptionIndicator)
Returns an
Observable that delays the subscription to the current Observable
until the other ObservableSource emits an element or completes normally. |
<R> @NonNull Observable<R> |
dematerialize(@NonNull Function<? super T,Notification<R>> selector)
Returns an
Observable that reverses the effect of materialize by transforming the
Notification objects extracted from the source items via a selector function
into their respective Observer signal types. |
@NonNull Observable<T> |
distinct()
Returns an
Observable that emits all items emitted by the current Observable that are distinct
based on Object.equals(Object) comparison. |
<K> @NonNull Observable<T> |
distinct(@NonNull Function<? super T,K> keySelector)
Returns an
Observable that emits all items emitted by the current Observable that are distinct according
to a key selector function and based on Object.equals(Object) comparison of the objects
returned by the key selector function. |
<K> @NonNull Observable<T> |
distinct(@NonNull Function<? super T,K> keySelector,
@NonNull Supplier<? extends Collection<? super K>> collectionSupplier)
Returns an
Observable that emits all items emitted by the current Observable that are distinct according
to a key selector function and based on Object.equals(Object) comparison of the objects
returned by the key selector function. |
@NonNull Observable<T> |
distinctUntilChanged()
Returns an
Observable that emits all items emitted by the current Observable that are distinct from their
immediate predecessors based on Object.equals(Object) comparison. |
@NonNull Observable<T> |
distinctUntilChanged(@NonNull BiPredicate<? super T,? super T> comparer)
Returns an
Observable that emits all items emitted by the current Observable that are distinct from their
immediate predecessors when compared with each other via the provided comparator function. |
<K> @NonNull Observable<T> |
distinctUntilChanged(@NonNull Function<? super T,K> keySelector)
Returns an
Observable that emits all items emitted by the current Observable that are distinct from their
immediate predecessors, according to a key selector function and based on Object.equals(Object) comparison
of those objects returned by the key selector function. |
@NonNull Observable<T> |
doAfterNext(@NonNull Consumer<? super T> onAfterNext)
Calls the specified
Consumer with the current item after this item has been emitted to the downstream. |
@NonNull Observable<T> |
doAfterTerminate(@NonNull Action onAfterTerminate)
|
@NonNull Observable<T> |
doFinally(@NonNull Action onFinally)
Calls the specified action after the current
Observable signals onError or onCompleted or gets disposed by
the downstream. |
@NonNull Observable<T> |
doOnComplete(@NonNull Action onComplete)
|
@NonNull Observable<T> |
doOnDispose(@NonNull Action onDispose)
Calls the given shared
Action if the downstream disposes the sequence. |
@NonNull Observable<T> |
doOnEach(@NonNull Consumer<? super Notification<T>> onNotification)
Returns an
Observable that invokes a Consumer with the appropriate Notification
object when the current Observable signals an item or terminates. |
@NonNull Observable<T> |
doOnEach(@NonNull Observer<? super T> observer)
Returns an
Observable that forwards the items and terminal events of the current
Observable to its Observer s and to the given shared Observer instance. |
@NonNull Observable<T> |
doOnError(@NonNull Consumer<? super Throwable> onError)
|
@NonNull Observable<T> |
doOnLifecycle(@NonNull Consumer<? super Disposable> onSubscribe,
@NonNull Action onDispose)
Calls the appropriate
onXXX method (shared between all Observer s) for the lifecycle events of
the sequence (subscription, disposal). |
@NonNull Observable<T> |
doOnNext(@NonNull Consumer<? super T> onNext)
Calls the given
Consumer with the value emitted by the current Observable before forwarding it to the downstream. |
@NonNull Observable<T> |
doOnSubscribe(@NonNull Consumer<? super Disposable> onSubscribe)
|
@NonNull Observable<T> |
doOnTerminate(@NonNull Action onTerminate)
Returns an
Observable so that it invokes an action when the current Observable calls onComplete or
onError . |
@NonNull Maybe<T> |
elementAt(long index)
Returns a
Maybe that emits the single item at a specified index in a sequence of emissions from
the current Observable or completes if the current Observable signals fewer elements than index. |
@NonNull Single<T> |
elementAt(long index,
T defaultItem)
Returns a
Single that emits the item found at a specified index in a sequence of emissions from
the current Observable , or a default item if that index is out of range. |
@NonNull Single<T> |
elementAtOrError(long index)
Returns a
Single that emits the item found at a specified index in a sequence of emissions from the current Observable
or signals a NoSuchElementException if the current Observable signals fewer elements than index. |
static <T> @NonNull Observable<T> |
empty()
Returns an
Observable that emits no items to the Observer and immediately invokes its
onComplete method. |
static <T> @NonNull Observable<T> |
error(@NonNull Supplier<? extends Throwable> supplier)
|
static <T> @NonNull Observable<T> |
error(@NonNull Throwable throwable)
|
@NonNull Observable<T> |
filter(@NonNull Predicate<? super T> predicate)
Filters items emitted by the current
Observable by only emitting those that satisfy a specified Predicate . |
@NonNull Single<T> |
first(T defaultItem)
Returns a
Single that emits only the very first item emitted by the current Observable , or a default item
if the current Observable completes without emitting any items. |
@NonNull Maybe<T> |
firstElement()
Returns a
Maybe that emits only the very first item emitted by the current Observable , or
completes if the current Observable is empty. |
@NonNull Single<T> |
firstOrError()
Returns a
Single that emits only the very first item emitted by the current Observable or
signals a NoSuchElementException if the current Observable is empty. |
@NonNull CompletionStage<T> |
firstOrErrorStage()
Signals the first upstream item or a
NoSuchElementException if the upstream is empty via
a CompletionStage . |
@NonNull CompletionStage<T> |
firstStage(T defaultItem)
Signals the first upstream item (or the default item if the upstream is empty) via
a
CompletionStage . |
<R> @NonNull Observable<R> |
flatMap(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper)
Returns an
Observable that emits items based on applying a function that you supply to each item emitted
by the current Observable , where that function returns an ObservableSource , and then merging those returned
ObservableSource s and emitting the results of this merger. |
<R> @NonNull Observable<R> |
flatMap(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper,
boolean delayErrors)
Returns an
Observable that emits items based on applying a function that you supply to each item emitted
by the current Observable , where that function returns an ObservableSource , and then merging those returned
ObservableSource s and emitting the results of this merger. |
<R> @NonNull Observable<R> |
flatMap(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper,
boolean delayErrors,
int maxConcurrency)
Returns an
Observable that emits items based on applying a function that you supply to each item emitted
by the current Observable , where that function returns an ObservableSource , and then merging those returned
ObservableSource s and emitting the results of this merger, while limiting the maximum number of concurrent
subscriptions to these ObservableSource s. |
<R> @NonNull Observable<R> |
flatMap(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper,
boolean delayErrors,
int maxConcurrency,
int bufferSize)
Returns an
Observable that emits items based on applying a function that you supply to each item emitted
by the current Observable , where that function returns an ObservableSource , and then merging those returned
ObservableSource s and emitting the results of this merger, while limiting the maximum number of concurrent
subscriptions to these ObservableSource s. |
<R> @NonNull Observable<R> |
flatMap(@NonNull Function<? super T,? extends ObservableSource<? extends R>> onNextMapper,
@NonNull Function<? super Throwable,? extends ObservableSource<? extends R>> onErrorMapper,
@NonNull Supplier<? extends ObservableSource<? extends R>> onCompleteSupplier)
Returns an
Observable that applies a function to each item emitted or notification raised by the current
Observable and then flattens the ObservableSource s returned from these functions and emits the resulting items. |
<R> @NonNull Observable<R> |
flatMap(@NonNull Function<? super T,? extends ObservableSource<? extends R>> onNextMapper,
@NonNull Function<Throwable,? extends ObservableSource<? extends R>> onErrorMapper,
@NonNull Supplier<? extends ObservableSource<? extends R>> onCompleteSupplier,
int maxConcurrency)
Returns an
Observable that applies a function to each item emitted or notification raised by the current
Observable and then flattens the ObservableSource s returned from these functions and emits the resulting items,
while limiting the maximum number of concurrent subscriptions to these ObservableSource s. |
<R> @NonNull Observable<R> |
flatMap(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper,
int maxConcurrency)
Returns an
Observable that emits items based on applying a function that you supply to each item emitted
by the current Observable , where that function returns an ObservableSource , and then merging those returned
ObservableSource s and emitting the results of this merger, while limiting the maximum number of concurrent
subscriptions to these ObservableSource s. |
<U,R> @NonNull Observable<R> |
flatMap(@NonNull Function<? super T,? extends ObservableSource<? extends U>> mapper,
@NonNull BiFunction<? super T,? super U,? extends R> combiner)
Returns an
Observable that emits the results of a specified function to the pair of values emitted by the
current Observable and the mapped inner ObservableSource . |
<U,R> @NonNull Observable<R> |
flatMap(@NonNull Function<? super T,? extends ObservableSource<? extends U>> mapper,
@NonNull BiFunction<? super T,? super U,? extends R> combiner,
boolean delayErrors)
Returns an
Observable that emits the results of a specified function to the pair of values emitted by the
current Observable and the mapped inner ObservableSource . |
<U,R> @NonNull Observable<R> |
flatMap(@NonNull Function<? super T,? extends ObservableSource<? extends U>> mapper,
@NonNull BiFunction<? super T,? super U,? extends R> combiner,
boolean delayErrors,
int maxConcurrency)
Returns an
Observable that emits the results of a specified function to the pair of values emitted by the
current Observable and the mapped inner ObservableSource , while limiting the maximum number of concurrent
subscriptions to these ObservableSource s. |
<U,R> @NonNull Observable<R> |
flatMap(@NonNull Function<? super T,? extends ObservableSource<? extends U>> mapper,
@NonNull BiFunction<? super T,? super U,? extends R> combiner,
boolean delayErrors,
int maxConcurrency,
int bufferSize)
Returns an
Observable that emits the results of a specified function to the pair of values emitted by the
current Observable and the mapped inner ObservableSource , while limiting the maximum number of concurrent
subscriptions to these ObservableSource s. |
<U,R> @NonNull Observable<R> |
flatMap(@NonNull Function<? super T,? extends ObservableSource<? extends U>> mapper,
@NonNull BiFunction<? super T,? super U,? extends R> combiner,
int maxConcurrency)
Returns an
Observable that emits the results of a specified function to the pair of values emitted by the
current Observable and the mapped inner ObservableSource , while limiting the maximum number of concurrent
subscriptions to these ObservableSource s. |
@NonNull Completable |
flatMapCompletable(@NonNull Function<? super T,? extends CompletableSource> mapper)
Maps each element of the current
Observable into CompletableSource s, subscribes to them and
waits until the upstream and all CompletableSource s complete. |
@NonNull Completable |
flatMapCompletable(@NonNull Function<? super T,? extends CompletableSource> mapper,
boolean delayErrors)
Maps each element of the current
Observable into CompletableSource s, subscribes to them and
waits until the upstream and all CompletableSource s complete, optionally delaying all errors. |
<U> @NonNull Observable<U> |
flatMapIterable(@NonNull Function<? super T,? extends Iterable<? extends U>> mapper)
|
<U,V> @NonNull Observable<V> |
flatMapIterable(@NonNull Function<? super T,? extends Iterable<? extends U>> mapper,
@NonNull BiFunction<? super T,? super U,? extends V> combiner)
Merges
Iterable s generated by a mapper Function for each individual item emitted by
the current Observable into a single Observable sequence where the resulting items will
be the combination of the original item and each inner item of the respective Iterable as returned
by the resultSelector BiFunction . |
<R> @NonNull Observable<R> |
flatMapMaybe(@NonNull Function<? super T,? extends MaybeSource<? extends R>> mapper)
Maps each element of the current
Observable into MaybeSource s, subscribes to all of them
and merges their onSuccess values, in no particular order, into a single Observable sequence. |
<R> @NonNull Observable<R> |
flatMapMaybe(@NonNull Function<? super T,? extends MaybeSource<? extends R>> mapper,
boolean delayErrors)
Maps each element of the current
Observable into MaybeSource s, subscribes to them
and merges their onSuccess values, in no particular order, into a single Observable sequence,
optionally delaying all errors. |
<R> @NonNull Observable<R> |
flatMapSingle(@NonNull Function<? super T,? extends SingleSource<? extends R>> mapper)
Maps each element of the current
Observable into SingleSource s, subscribes to all of them
and merges their onSuccess values, in no particular order, into a single Observable sequence. |
<R> @NonNull Observable<R> |
flatMapSingle(@NonNull Function<? super T,? extends SingleSource<? extends R>> mapper,
boolean delayErrors)
Maps each element of the current
Observable into SingleSource s, subscribes to them
and merges their onSuccess values, in no particular order, into a single Observable sequence,
optionally delaying all errors. |
<R> @NonNull Observable<R> |
flatMapStream(@NonNull Function<? super T,? extends Stream<? extends R>> mapper)
Maps each upstream item into a
Stream and emits the Stream 's items to the downstream in a sequential fashion. |
@NonNull Disposable |
forEach(@NonNull Consumer<? super T> onNext)
Subscribes to the
ObservableSource and calls a Consumer for each item of the current Observable
on its emission thread. |
@NonNull Disposable |
forEachWhile(@NonNull Predicate<? super T> onNext)
Subscribes to the
ObservableSource and calls a Predicate for each item of the current Observable ,
on its emission thread, until the predicate returns false . |
@NonNull Disposable |
forEachWhile(@NonNull Predicate<? super T> onNext,
@NonNull Consumer<? super Throwable> onError)
Subscribes to the
ObservableSource and calls a Predicate for each item or a Consumer with the error
of the current Observable , on their original emission threads, until the predicate returns false . |
@NonNull Disposable |
forEachWhile(@NonNull Predicate<? super T> onNext,
@NonNull Consumer<? super Throwable> onError,
@NonNull Action onComplete)
Subscribes to the
ObservableSource and calls a Predicate for each item, a Consumer with the error
or an Action upon completion of the current Observable , on their original emission threads,
until the predicate returns false . |
static <T> @NonNull Observable<T> |
fromAction(@NonNull Action action)
|
static <T> @NonNull Observable<T> |
fromArray(T... items)
Converts an array into an
ObservableSource that emits the items in the array. |
static <T> @NonNull Observable<T> |
fromCallable(@NonNull Callable<? extends T> callable)
Returns an
Observable that, when an observer subscribes to it, invokes a function you specify and then
emits the value returned from that function. |
static <T> @NonNull Observable<T> |
fromCompletable(@NonNull CompletableSource completableSource)
Wraps a
CompletableSource into an Observable . |
static <T> @NonNull Observable<T> |
fromCompletionStage(@NonNull CompletionStage<T> stage)
Signals the completion value or error of the given (hot)
CompletionStage -based asynchronous calculation. |
static <T> @NonNull Observable<T> |
fromFuture(@NonNull Future<? extends T> future)
Converts a
Future into an Observable . |
static <T> @NonNull Observable<T> |
fromFuture(@NonNull Future<? extends T> future,
long timeout,
@NonNull TimeUnit unit)
|
static <T> @NonNull Observable<T> |
fromIterable(@NonNull Iterable<? extends T> source)
Converts an
Iterable sequence into an Observable that emits the items in the sequence. |
static <T> @NonNull Observable<T> |
fromMaybe(@NonNull MaybeSource<T> maybe)
Returns an
Observable instance that when subscribed to, subscribes to the MaybeSource instance and
emits onSuccess as a single item or forwards any onComplete or
onError signal. |
static <T> @NonNull Observable<T> |
fromOptional(@NonNull Optional<T> optional)
Converts the existing value of the provided optional into a
just(Object)
or an empty optional into an empty() Observable instance. |
static <T> @NonNull Observable<T> |
fromPublisher(@NonNull Publisher<? extends T> publisher)
Converts an arbitrary Reactive Streams
Publisher into an Observable . |
static <T> @NonNull Observable<T> |
fromRunnable(@NonNull Runnable run)
|
static <T> @NonNull Observable<T> |
fromSingle(@NonNull SingleSource<T> source)
Returns an
Observable instance that when subscribed to, subscribes to the SingleSource instance and
emits onSuccess as a single item or forwards the onError signal. |
static <T> @NonNull Observable<T> |
fromStream(@NonNull Stream<T> stream)
Converts a
Stream into a finite Observable and emits its items in the sequence. |
static <T> @NonNull Observable<T> |
fromSupplier(@NonNull Supplier<? extends T> supplier)
Returns an
Observable that, when an observer subscribes to it, invokes a supplier function you specify and then
emits the value returned from that function. |
static <T> @NonNull Observable<T> |
generate(@NonNull Consumer<Emitter<T>> generator)
Returns a cold, synchronous and stateless generator of values.
|
static <T,S> @NonNull Observable<T> |
generate(@NonNull Supplier<S> initialState,
@NonNull BiConsumer<S,Emitter<T>> generator)
Returns a cold, synchronous and stateful generator of values.
|
static <T,S> @NonNull Observable<T> |
generate(@NonNull Supplier<S> initialState,
@NonNull BiConsumer<S,Emitter<T>> generator,
@NonNull Consumer<? super S> disposeState)
Returns a cold, synchronous and stateful generator of values.
|
static <T,S> @NonNull Observable<T> |
generate(@NonNull Supplier<S> initialState,
@NonNull BiFunction<S,Emitter<T>,S> generator)
Returns a cold, synchronous and stateful generator of values.
|
static <T,S> @NonNull Observable<T> |
generate(@NonNull Supplier<S> initialState,
@NonNull BiFunction<S,Emitter<T>,S> generator,
@NonNull Consumer<? super S> disposeState)
Returns a cold, synchronous and stateful generator of values.
|
<K> @NonNull Observable<GroupedObservable<K,T>> |
groupBy(@NonNull Function<? super T,? extends K> keySelector)
Groups the items emitted by the current
Observable according to a specified criterion, and emits these
grouped items as GroupedObservable s. |
<K> @NonNull Observable<GroupedObservable<K,T>> |
groupBy(@NonNull Function<? super T,? extends K> keySelector,
boolean delayError)
Groups the items emitted by the current
Observable according to a specified criterion, and emits these
grouped items as GroupedObservable s. |
<K,V> @NonNull Observable<GroupedObservable<K,V>> |
groupBy(@NonNull Function<? super T,? extends K> keySelector,
Function<? super T,? extends V> valueSelector)
Groups the items emitted by the current
Observable according to a specified criterion, and emits these
grouped items as GroupedObservable s. |
<K,V> @NonNull Observable<GroupedObservable<K,V>> |
groupBy(@NonNull Function<? super T,? extends K> keySelector,
@NonNull Function<? super T,? extends V> valueSelector,
boolean delayError)
Groups the items emitted by the current
Observable according to a specified criterion, and emits these
grouped items as GroupedObservable s. |
<K,V> @NonNull Observable<GroupedObservable<K,V>> |
groupBy(@NonNull Function<? super T,? extends K> keySelector,
@NonNull Function<? super T,? extends V> valueSelector,
boolean delayError,
int bufferSize)
Groups the items emitted by the current
Observable according to a specified criterion, and emits these
grouped items as GroupedObservable s. |
<TRight,TLeftEnd,TRightEnd,R> |
groupJoin(@NonNull ObservableSource<? extends TRight> other,
@NonNull Function<? super T,? extends ObservableSource<TLeftEnd>> leftEnd,
@NonNull Function<? super TRight,? extends ObservableSource<TRightEnd>> rightEnd,
@NonNull BiFunction<? super T,? super Observable<TRight>,? extends R> resultSelector)
Returns an
Observable that correlates two ObservableSource s when they overlap in time and groups the results. |
@NonNull Observable<T> |
hide()
Hides the identity of the current
Observable and its Disposable . |
@NonNull Completable |
ignoreElements()
Ignores all items emitted by the current
Observable and only calls onComplete or onError . |
static @NonNull Observable<Long> |
interval(long initialDelay,
long period,
@NonNull TimeUnit unit)
Returns an
Observable that emits a 0L after the initialDelay and ever increasing numbers
after each period of time thereafter. |
static @NonNull Observable<Long> |
interval(long initialDelay,
long period,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits a 0L after the initialDelay and ever increasing numbers
after each period of time thereafter, on a specified Scheduler . |
static @NonNull Observable<Long> |
interval(long period,
@NonNull TimeUnit unit)
Returns an
Observable that emits a sequential number every specified interval of time. |
static @NonNull Observable<Long> |
interval(long period,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits a sequential number every specified interval of time, on a
specified Scheduler . |
static @NonNull Observable<Long> |
intervalRange(long start,
long count,
long initialDelay,
long period,
@NonNull TimeUnit unit)
Signals a range of long values, the first after some initial delay and the rest periodically after.
|
static @NonNull Observable<Long> |
intervalRange(long start,
long count,
long initialDelay,
long period,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Signals a range of long values, the first after some initial delay and the rest periodically after.
|
@NonNull Single<Boolean> |
isEmpty()
|
<TRight,TLeftEnd,TRightEnd,R> |
join(@NonNull ObservableSource<? extends TRight> other,
@NonNull Function<? super T,? extends ObservableSource<TLeftEnd>> leftEnd,
@NonNull Function<? super TRight,? extends ObservableSource<TRightEnd>> rightEnd,
@NonNull BiFunction<? super T,? super TRight,? extends R> resultSelector)
Correlates the items emitted by two
ObservableSource s based on overlapping durations. |
static <T> @NonNull Observable<T> |
just(T item)
Returns an
Observable that signals the given (constant reference) item and then completes. |
static <T> @NonNull Observable<T> |
just(T item1,
T item2)
Converts two items into an
Observable that emits those items. |
static <T> @NonNull Observable<T> |
just(T item1,
T item2,
T item3)
Converts three items into an
Observable that emits those items. |
static <T> @NonNull Observable<T> |
just(T item1,
T item2,
T item3,
T item4)
Converts four items into an
Observable that emits those items. |
static <T> @NonNull Observable<T> |
just(T item1,
T item2,
T item3,
T item4,
T item5)
Converts five items into an
Observable that emits those items. |
static <T> @NonNull Observable<T> |
just(T item1,
T item2,
T item3,
T item4,
T item5,
T item6)
Converts six items into an
Observable that emits those items. |
static <T> @NonNull Observable<T> |
just(T item1,
T item2,
T item3,
T item4,
T item5,
T item6,
T item7)
Converts seven items into an
Observable that emits those items. |
static <T> @NonNull Observable<T> |
just(T item1,
T item2,
T item3,
T item4,
T item5,
T item6,
T item7,
T item8)
Converts eight items into an
Observable that emits those items. |
static <T> @NonNull Observable<T> |
just(T item1,
T item2,
T item3,
T item4,
T item5,
T item6,
T item7,
T item8,
T item9)
Converts nine items into an
Observable that emits those items. |
static <T> @NonNull Observable<T> |
just(T item1,
T item2,
T item3,
T item4,
T item5,
T item6,
T item7,
T item8,
T item9,
T item10)
Converts ten items into an
Observable that emits those items. |
@NonNull Single<T> |
last(T defaultItem)
Returns a
Single that emits only the last item emitted by the current Observable , or a default item
if the current Observable completes without emitting any items. |
@NonNull Maybe<T> |
lastElement()
Returns a
Maybe that emits the last item emitted by the current Observable or
completes if the current Observable is empty. |
@NonNull Single<T> |
lastOrError()
Returns a
Single that emits only the last item emitted by the current Observable or
signals a NoSuchElementException if the current Observable is empty. |
@NonNull CompletionStage<T> |
lastOrErrorStage()
Signals the last upstream item or a
NoSuchElementException if the upstream is empty via
a CompletionStage . |
@NonNull CompletionStage<T> |
lastStage(T defaultItem)
Signals the last upstream item (or the default item if the upstream is empty) via
a
CompletionStage . |
<R> @NonNull Observable<R> |
lift(@NonNull ObservableOperator<? extends R,? super T> lifter)
This method requires advanced knowledge about building operators, please consider
other standard composition methods first;
Returns an
Observable which, when subscribed to, invokes the apply(Observer) method
of the provided ObservableOperator for each individual downstream Observer and allows the
insertion of a custom operator by accessing the downstream's Observer during this subscription phase
and providing a new Observer , containing the custom operator's intended business logic, that will be
used in the subscription process going further upstream. |
<R> @NonNull Observable<R> |
map(@NonNull Function<? super T,? extends R> mapper)
Returns an
Observable that applies a specified function to each item emitted by the current Observable and
emits the results of these function applications. |
<R> @NonNull Observable<R> |
mapOptional(@NonNull Function<? super T,Optional<? extends R>> mapper)
Maps each upstream value into an
Optional and emits the contained item if not empty. |
@NonNull Observable<Notification<T>> |
materialize()
Returns an
Observable that represents all of the emissions and notifications from the current
Observable into emissions marked with their original types within Notification objects. |
static <T> @NonNull Observable<T> |
merge(@NonNull Iterable<? extends ObservableSource<? extends T>> sources)
|
static <T> @NonNull Observable<T> |
merge(@NonNull Iterable<? extends ObservableSource<? extends T>> sources,
int maxConcurrency)
Flattens an
Iterable of ObservableSource s into one Observable , without any transformation, while limiting the
number of concurrent subscriptions to these ObservableSource s. |
static <T> @NonNull Observable<T> |
merge(@NonNull Iterable<? extends ObservableSource<? extends T>> sources,
int maxConcurrency,
int bufferSize)
Flattens an
Iterable of ObservableSource s into one Observable , without any transformation, while limiting the
number of concurrent subscriptions to these ObservableSource s. |
static <T> @NonNull Observable<T> |
merge(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources)
Flattens an
ObservableSource that emits ObservableSource s into a single Observable that emits the items emitted by
those ObservableSource s, without any transformation. |
static <T> @NonNull Observable<T> |
merge(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources,
int maxConcurrency)
Flattens an
ObservableSource that emits ObservableSource s into a single Observable that emits the items emitted by
those ObservableSource s, without any transformation, while limiting the maximum number of concurrent
subscriptions to these ObservableSource s. |
static <T> @NonNull Observable<T> |
merge(@NonNull ObservableSource<? extends T> source1,
@NonNull ObservableSource<? extends T> source2)
Flattens two
ObservableSource s into a single Observable , without any transformation. |
static <T> @NonNull Observable<T> |
merge(@NonNull ObservableSource<? extends T> source1,
@NonNull ObservableSource<? extends T> source2,
@NonNull ObservableSource<? extends T> source3)
Flattens three
ObservableSource s into a single Observable , without any transformation. |
static <T> @NonNull Observable<T> |
merge(@NonNull ObservableSource<? extends T> source1,
@NonNull ObservableSource<? extends T> source2,
@NonNull ObservableSource<? extends T> source3,
@NonNull ObservableSource<? extends T> source4)
Flattens four
ObservableSource s into a single Observable , without any transformation. |
static <T> @NonNull Observable<T> |
mergeArray(int maxConcurrency,
int bufferSize,
ObservableSource<? extends T>... sources)
Flattens an array of
ObservableSource s into one Observable , without any transformation, while limiting the
number of concurrent subscriptions to these ObservableSource s. |
static <T> @NonNull Observable<T> |
mergeArray(ObservableSource<? extends T>... sources)
Flattens an array of
ObservableSource s into one Observable , without any transformation. |
static <T> @NonNull Observable<T> |
mergeArrayDelayError(int maxConcurrency,
int bufferSize,
ObservableSource<? extends T>... sources)
Flattens an array of
ObservableSource s into one Observable , in a way that allows an Observer to receive all
successfully emitted items from each of the ObservableSource s without being interrupted by an error
notification from one of them, while limiting the number of concurrent subscriptions to these ObservableSource s. |
static <T> @NonNull Observable<T> |
mergeArrayDelayError(ObservableSource<? extends T>... sources)
Flattens an array of
ObservableSource s into one Observable , in a way that allows an Observer to receive all
successfully emitted items from each of the ObservableSource s without being interrupted by an error
notification from one of them. |
static <T> @NonNull Observable<T> |
mergeDelayError(@NonNull Iterable<? extends ObservableSource<? extends T>> sources)
Flattens an
Iterable of ObservableSource s into one Observable , in a way that allows an Observer to receive all
successfully emitted items from each of the returned ObservableSource s without being interrupted by an error
notification from one of them. |
static <T> @NonNull Observable<T> |
mergeDelayError(@NonNull Iterable<? extends ObservableSource<? extends T>> sources,
int maxConcurrency)
Flattens an
Iterable of ObservableSource s into one Observable , in a way that allows an Observer to receive all
successfully emitted items from each of the returned ObservableSource s without being interrupted by an error
notification from one of them, while limiting the number of concurrent subscriptions to these ObservableSource s. |
static <T> @NonNull Observable<T> |
mergeDelayError(@NonNull Iterable<? extends ObservableSource<? extends T>> sources,
int maxConcurrency,
int bufferSize)
Flattens an
Iterable of ObservableSource s into one Observable , in a way that allows an Observer to receive all
successfully emitted items from each of the returned ObservableSource s without being interrupted by an error
notification from one of them, while limiting the number of concurrent subscriptions to these ObservableSource s. |
static <T> @NonNull Observable<T> |
mergeDelayError(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources)
Flattens an
ObservableSource that emits ObservableSource s into one Observable , in a way that allows an Observer to
receive all successfully emitted items from all of the emitted ObservableSource s without being interrupted by
an error notification from one of them. |
static <T> @NonNull Observable<T> |
mergeDelayError(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources,
int maxConcurrency)
Flattens an
ObservableSource that emits ObservableSource s into one Observable , in a way that allows an Observer to
receive all successfully emitted items from all of the emitted ObservableSource s without being interrupted by
an error notification from one of them, while limiting the
number of concurrent subscriptions to these ObservableSource s. |
static <T> @NonNull Observable<T> |
mergeDelayError(@NonNull ObservableSource<? extends T> source1,
@NonNull ObservableSource<? extends T> source2)
Flattens two
ObservableSource s into one Observable , in a way that allows an Observer to receive all
successfully emitted items from each of the ObservableSource s without being interrupted by an error
notification from one of them. |
static <T> @NonNull Observable<T> |
mergeDelayError(@NonNull ObservableSource<? extends T> source1,
@NonNull ObservableSource<? extends T> source2,
@NonNull ObservableSource<? extends T> source3)
Flattens three
ObservableSource s into one Observable , in a way that allows an Observer to receive all
successfully emitted items from all of the ObservableSource s without being interrupted by an error
notification from one of them. |
static <T> @NonNull Observable<T> |
mergeDelayError(@NonNull ObservableSource<? extends T> source1,
@NonNull ObservableSource<? extends T> source2,
@NonNull ObservableSource<? extends T> source3,
@NonNull ObservableSource<? extends T> source4)
Flattens four
ObservableSource s into one Observable , in a way that allows an Observer to receive all
successfully emitted items from all of the ObservableSource s without being interrupted by an error
notification from one of them. |
@NonNull Observable<T> |
mergeWith(@NonNull CompletableSource other)
Relays the items of the current
Observable and completes only when the other CompletableSource completes
as well. |
@NonNull Observable<T> |
mergeWith(@NonNull MaybeSource<? extends T> other)
Merges the sequence of items of the current
Observable with the success value of the other MaybeSource
or waits both to complete normally if the MaybeSource is empty. |
@NonNull Observable<T> |
mergeWith(@NonNull ObservableSource<? extends T> other)
Flattens the current
Observable and another ObservableSource into a single Observable sequence, without any transformation. |
@NonNull Observable<T> |
mergeWith(@NonNull SingleSource<? extends T> other)
Merges the sequence of items of the current
Observable with the success value of the other SingleSource . |
static <T> @NonNull Observable<T> |
never()
Returns an
Observable that never sends any items or notifications to an Observer . |
@NonNull Observable<T> |
observeOn(@NonNull Scheduler scheduler)
Returns an
Observable to perform the current Observable 's emissions and notifications on a specified Scheduler ,
asynchronously with an unbounded buffer with Flowable.bufferSize() "island size". |
@NonNull Observable<T> |
observeOn(@NonNull Scheduler scheduler,
boolean delayError)
Returns an
Observable to perform the current Observable 's emissions and notifications on a specified Scheduler ,
asynchronously with an unbounded buffer with Flowable.bufferSize() "island size" and optionally delays onError notifications. |
@NonNull Observable<T> |
observeOn(@NonNull Scheduler scheduler,
boolean delayError,
int bufferSize)
Returns an
Observable to perform the current Observable 's emissions and notifications on a specified Scheduler ,
asynchronously with an unbounded buffer of configurable "island size" and optionally delays onError notifications. |
<U> @NonNull Observable<U> |
ofType(@NonNull Class<U> clazz)
Filters the items emitted by the current
Observable , only emitting those of the specified type. |
@NonNull Observable<T> |
onErrorComplete()
Returns an
Observable instance that if the current Observable emits an error, it will emit an onComplete
and swallow the throwable. |
@NonNull Observable<T> |
onErrorComplete(@NonNull Predicate<? super Throwable> predicate)
Returns an
Observable instance that if the current Observable emits an error and the predicate returns
true , it will emit an onComplete and swallow the throwable. |
@NonNull Observable<T> |
onErrorResumeNext(@NonNull Function<? super Throwable,? extends ObservableSource<? extends T>> fallbackSupplier)
Resumes the flow with an
ObservableSource returned for the failure Throwable of the current Observable by a
function instead of signaling the error via onError . |
@NonNull Observable<T> |
onErrorResumeWith(@NonNull ObservableSource<? extends T> fallback)
Resumes the flow with the given
ObservableSource when the current Observable fails instead of
signaling the error via onError . |
@NonNull Observable<T> |
onErrorReturn(@NonNull Function<? super Throwable,? extends T> itemSupplier)
Ends the flow with a last item returned by a function for the
Throwable error signaled by the current
Observable instead of signaling the error via onError . |
@NonNull Observable<T> |
onErrorReturnItem(T item)
Ends the flow with the given last item when the current
Observable fails instead of signaling the error via onError . |
@NonNull Observable<T> |
onTerminateDetach()
Nulls out references to the upstream producer and downstream
Observer if
the sequence is terminated or downstream calls dispose() . |
@NonNull ConnectableObservable<T> |
publish()
Returns a
ConnectableObservable , which is a variety of ObservableSource that waits until its
connect method is called before it begins emitting items to those
Observer s that have subscribed to it. |
<R> @NonNull Observable<R> |
publish(@NonNull Function<? super Observable<T>,? extends ObservableSource<R>> selector)
Returns an
Observable that emits the results of invoking a specified selector on items emitted by a
ConnectableObservable that shares a single subscription to the current Observable sequence. |
static @NonNull Observable<Integer> |
range(int start,
int count)
Returns an
Observable that emits a sequence of Integer s within a specified range. |
static @NonNull Observable<Long> |
rangeLong(long start,
long count)
Returns an
Observable that emits a sequence of Long s within a specified range. |
@NonNull Maybe<T> |
reduce(@NonNull BiFunction<T,T,T> reducer)
Returns a
Maybe that applies a specified accumulator function to the first item emitted by the current
Observable , then feeds the result of that function along with the second item emitted by the current
Observable into the same function, and so on until all items have been emitted by the current and finite Observable ,
and emits the final result from the final call to your function as its sole item. |
<R> @NonNull Single<R> |
reduce(R seed,
@NonNull BiFunction<R,? super T,R> reducer)
Returns a
Single that applies a specified accumulator function to the first item emitted by the current
Observable and a specified seed value, then feeds the result of that function along with the second item
emitted by the current Observable into the same function, and so on until all items have been emitted by the
current and finite Observable , emitting the final result from the final call to your function as its sole item. |
<R> @NonNull Single<R> |
reduceWith(@NonNull Supplier<R> seedSupplier,
@NonNull BiFunction<R,? super T,R> reducer)
Returns a
Single that applies a specified accumulator function to the first item emitted by the current
Observable and a seed value derived from calling a specified seedSupplier , then feeds the result
of that function along with the second item emitted by the current Observable into the same function,
and so on until all items have been emitted by the current and finite Observable , emitting the final result
from the final call to your function as its sole item. |
@NonNull Observable<T> |
repeat()
Returns an
Observable that repeats the sequence of items emitted by the current Observable indefinitely. |
@NonNull Observable<T> |
repeat(long times)
Returns an
Observable that repeats the sequence of items emitted by the current Observable at most
count times. |
@NonNull Observable<T> |
repeatUntil(@NonNull BooleanSupplier stop)
Returns an
Observable that repeats the sequence of items emitted by the current Observable until
the provided stop function returns true . |
@NonNull Observable<T> |
repeatWhen(@NonNull Function<? super Observable<Object>,? extends ObservableSource<?>> handler)
Returns an
Observable that emits the same values as the current Observable with the exception of an
onComplete . |
@NonNull ConnectableObservable<T> |
replay()
Returns a
ConnectableObservable that shares a single subscription to the current Observable
that will replay all of its items and notifications to any future Observer . |
<R> @NonNull Observable<R> |
replay(@NonNull Function<? super Observable<T>,? extends ObservableSource<R>> selector)
Returns an
Observable that emits items that are the results of invoking a specified selector on the items
emitted by a ConnectableObservable that shares a single subscription to the current Observable . |
<R> @NonNull Observable<R> |
replay(@NonNull Function<? super Observable<T>,? extends ObservableSource<R>> selector,
int bufferSize)
Returns an
Observable that emits items that are the results of invoking a specified selector on items
emitted by a ConnectableObservable that shares a single subscription to the current Observable ,
replaying bufferSize notifications. |
<R> @NonNull Observable<R> |
replay(@NonNull Function<? super Observable<T>,? extends ObservableSource<R>> selector,
int bufferSize,
boolean eagerTruncate)
Returns an
Observable that emits items that are the results of invoking a specified selector on items
emitted by a ConnectableObservable that shares a single subscription to the current Observable ,
replaying bufferSize notifications. |
<R> @NonNull Observable<R> |
replay(@NonNull Function<? super Observable<T>,? extends ObservableSource<R>> selector,
int bufferSize,
long time,
@NonNull TimeUnit unit)
Returns an
Observable that emits items that are the results of invoking a specified selector on items
emitted by a ConnectableObservable that shares a single subscription to the current Observable ,
replaying no more than bufferSize items that were emitted within a specified time window. |
<R> @NonNull Observable<R> |
replay(@NonNull Function<? super Observable<T>,? extends ObservableSource<R>> selector,
int bufferSize,
long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits items that are the results of invoking a specified selector on items
emitted by a ConnectableObservable that shares a single subscription to the current Observable ,
replaying no more than bufferSize items that were emitted within a specified time window. |
<R> @NonNull Observable<R> |
replay(@NonNull Function<? super Observable<T>,? extends ObservableSource<R>> selector,
int bufferSize,
long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
boolean eagerTruncate)
Returns an
Observable that emits items that are the results of invoking a specified selector on items
emitted by a ConnectableObservable that shares a single subscription to the current Observable ,
replaying no more than bufferSize items that were emitted within a specified time window. |
<R> @NonNull Observable<R> |
replay(@NonNull Function<? super Observable<T>,? extends ObservableSource<R>> selector,
long time,
@NonNull TimeUnit unit)
Returns an
Observable that emits items that are the results of invoking a specified selector on items
emitted by a ConnectableObservable that shares a single subscription to the current Observable ,
replaying all items that were emitted within a specified time window. |
<R> @NonNull Observable<R> |
replay(@NonNull Function<? super Observable<T>,? extends ObservableSource<R>> selector,
long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits items that are the results of invoking a specified selector on items
emitted by a ConnectableObservable that shares a single subscription to the current Observable ,
replaying all items that were emitted within a specified time window. |
<R> @NonNull Observable<R> |
replay(@NonNull Function<? super Observable<T>,? extends ObservableSource<R>> selector,
long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
boolean eagerTruncate)
Returns an
Observable that emits items that are the results of invoking a specified selector on items
emitted by a ConnectableObservable that shares a single subscription to the current Observable ,
replaying all items that were emitted within a specified time window. |
@NonNull ConnectableObservable<T> |
replay(int bufferSize)
Returns a
ConnectableObservable that shares a single subscription to the current Observable that
replays at most bufferSize items emitted by the current Observable . |
@NonNull ConnectableObservable<T> |
replay(int bufferSize,
boolean eagerTruncate)
Returns a
ConnectableObservable that shares a single subscription to the current Observable that
replays at most bufferSize items emitted by the current Observable . |
@NonNull ConnectableObservable<T> |
replay(int bufferSize,
long time,
@NonNull TimeUnit unit)
Returns a
ConnectableObservable that shares a single subscription to the current Observable and
replays at most bufferSize items that were emitted during a specified time window. |
@NonNull ConnectableObservable<T> |
replay(int bufferSize,
long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns a
ConnectableObservable that shares a single subscription to the current Observable and
that replays a maximum of bufferSize items that are emitted within a specified time window. |
@NonNull ConnectableObservable<T> |
replay(int bufferSize,
long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
boolean eagerTruncate)
Returns a
ConnectableObservable that shares a single subscription to the current Observable and
that replays a maximum of bufferSize items that are emitted within a specified time window. |
@NonNull ConnectableObservable<T> |
replay(long time,
@NonNull TimeUnit unit)
Returns a
ConnectableObservable that shares a single subscription to the current Observable and
replays all items emitted by the current Observable within a specified time window. |
@NonNull ConnectableObservable<T> |
replay(long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns a
ConnectableObservable that shares a single subscription to the current Observable and
replays all items emitted by the current Observable within a specified time window. |
@NonNull ConnectableObservable<T> |
replay(long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
boolean eagerTruncate)
Returns a
ConnectableObservable that shares a single subscription to the current Observable and
replays all items emitted by the current Observable within a specified time window. |
@NonNull Observable<T> |
retry()
Returns an
Observable that mirrors the current Observable , resubscribing to it if it calls onError
(infinite retry count). |
@NonNull Observable<T> |
retry(@NonNull BiPredicate<? super Integer,? super Throwable> predicate)
Returns an
Observable that mirrors the current Observable , resubscribing to it if it calls onError
and the predicate returns true for that specific exception and retry count. |
@NonNull Observable<T> |
retry(long times)
Returns an
Observable that mirrors the current Observable , resubscribing to it if it calls onError
up to a specified number of retries. |
@NonNull Observable<T> |
retry(long times,
@NonNull Predicate<? super Throwable> predicate)
Retries at most times or until the predicate returns
false , whichever happens first. |
@NonNull Observable<T> |
retry(@NonNull Predicate<? super Throwable> predicate)
Retries the current
Observable if the predicate returns true . |
@NonNull Observable<T> |
retryUntil(@NonNull BooleanSupplier stop)
Retries until the given stop function returns
true . |
@NonNull Observable<T> |
retryWhen(@NonNull Function<? super Observable<Throwable>,? extends ObservableSource<?>> handler)
Returns an
Observable that emits the same values as the current Observable with the exception of an
onError . |
void |
safeSubscribe(@NonNull Observer<? super T> observer)
Subscribes to the current
Observable and wraps the given Observer into a SafeObserver
(if not already a SafeObserver ) that
deals with exceptions thrown by a misbehaving Observer (that doesn't follow the
Reactive Streams specification). |
@NonNull Observable<T> |
sample(long period,
@NonNull TimeUnit unit)
Returns an
Observable that emits the most recently emitted item (if any) emitted by the current Observable
within periodic time intervals. |
@NonNull Observable<T> |
sample(long period,
@NonNull TimeUnit unit,
boolean emitLast)
Returns an
Observable that emits the most recently emitted item (if any) emitted by the current Observable
within periodic time intervals and optionally emit the very last upstream item when the upstream completes. |
@NonNull Observable<T> |
sample(long period,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits the most recently emitted item (if any) emitted by the current Observable
within periodic time intervals, where the intervals are defined on a particular Scheduler . |
@NonNull Observable<T> |
sample(long period,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
boolean emitLast)
Returns an
Observable that emits the most recently emitted item (if any) emitted by the current Observable
within periodic time intervals, where the intervals are defined on a particular Scheduler
and optionally emit the very last upstream item when the upstream completes. |
@NonNull Observable<T> |
sample(long period,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
boolean emitLast,
@NonNull Consumer<? super T> onDropped)
Returns an
Observable that emits the most recently emitted item (if any) emitted by the current Observable
within periodic time intervals, where the intervals are defined on a particular Scheduler . |
<U> @NonNull Observable<T> |
sample(@NonNull ObservableSource<U> sampler)
Returns an
Observable that, when the specified sampler ObservableSource emits an item or completes,
emits the most recently emitted item (if any) emitted by the current Observable since the previous
emission from the sampler ObservableSource . |
<U> @NonNull Observable<T> |
sample(@NonNull ObservableSource<U> sampler,
boolean emitLast)
Returns an
Observable that, when the specified sampler ObservableSource emits an item or completes,
emits the most recently emitted item (if any) emitted by the current Observable since the previous
emission from the sampler ObservableSource
and optionally emit the very last upstream item when the upstream or other ObservableSource complete. |
@NonNull Observable<T> |
scan(@NonNull BiFunction<T,T,T> accumulator)
Returns an
Observable that emits the first value emitted by the current Observable , then emits one value
for each subsequent value emitted by the current Observable . |
<R> @NonNull Observable<R> |
scan(R initialValue,
@NonNull BiFunction<R,? super T,R> accumulator)
Returns an
Observable that emits the provided initial (seed) value, then emits one value for each value emitted
by the current Observable . |
<R> @NonNull Observable<R> |
scanWith(@NonNull Supplier<R> seedSupplier,
@NonNull BiFunction<R,? super T,R> accumulator)
Returns an
Observable that emits the provided initial (seed) value, then emits one value for each value emitted
by the current Observable . |
static <T> @NonNull Single<Boolean> |
sequenceEqual(@NonNull ObservableSource<? extends T> source1,
@NonNull ObservableSource<? extends T> source2)
Returns a
Single that emits a Boolean value that indicates whether two ObservableSource sequences are the
same by comparing the items emitted by each ObservableSource pairwise. |
static <T> @NonNull Single<Boolean> |
sequenceEqual(@NonNull ObservableSource<? extends T> source1,
@NonNull ObservableSource<? extends T> source2,
@NonNull BiPredicate<? super T,? super T> isEqual)
Returns a
Single that emits a Boolean value that indicates whether two ObservableSource sequences are the
same by comparing the items emitted by each ObservableSource pairwise based on the results of a specified
equality function. |
static <T> @NonNull Single<Boolean> |
sequenceEqual(@NonNull ObservableSource<? extends T> source1,
@NonNull ObservableSource<? extends T> source2,
@NonNull BiPredicate<? super T,? super T> isEqual,
int bufferSize)
Returns a
Single that emits a Boolean value that indicates whether two ObservableSource sequences are the
same by comparing the items emitted by each ObservableSource pairwise based on the results of a specified
equality function. |
static <T> @NonNull Single<Boolean> |
sequenceEqual(@NonNull ObservableSource<? extends T> source1,
@NonNull ObservableSource<? extends T> source2,
int bufferSize)
Returns a
Single that emits a Boolean value that indicates whether two ObservableSource sequences are the
same by comparing the items emitted by each ObservableSource pairwise. |
@NonNull Observable<T> |
serialize()
Forces the current
Observable 's emissions and notifications to be serialized and for it to obey
the ObservableSource contract in other ways. |
@NonNull Observable<T> |
share()
Returns a new
Observable that multicasts (and shares a single subscription to) the current Observable . |
@NonNull Single<T> |
single(T defaultItem)
Returns a
Single that emits the single item emitted by the current Observable , if the current Observable
emits only a single item, or a default item if the current Observable emits no items. |
@NonNull Maybe<T> |
singleElement()
Returns a
Maybe that completes if the current Observable is empty or emits the single item
emitted by the current Observable , or signals an IllegalArgumentException if the current
Observable emits more than one item. |
@NonNull Single<T> |
singleOrError()
Returns a
Single that emits the single item emitted by the current Observable if it
emits only a single item, otherwise
if the current Observable completes without emitting any items or emits more than one item a
NoSuchElementException or IllegalArgumentException will be signaled respectively. |
@NonNull CompletionStage<T> |
singleOrErrorStage()
Signals the only expected upstream item, a
NoSuchElementException if the upstream is empty
or signals IllegalArgumentException if the upstream has more than one item
via a CompletionStage . |
@NonNull CompletionStage<T> |
singleStage(T defaultItem)
Signals the only expected upstream item (or the default item if the upstream is empty)
or signals
IllegalArgumentException if the upstream has more than one item
via a CompletionStage . |
@NonNull Observable<T> |
skip(long count)
Returns an
Observable that skips the first count items emitted by the current Observable and emits
the remainder. |
@NonNull Observable<T> |
skip(long time,
@NonNull TimeUnit unit)
Returns an
Observable that skips values emitted by the current Observable before a specified time window
elapses. |
@NonNull Observable<T> |
skip(long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that skips values emitted by the current Observable before a specified time window
on a specified Scheduler elapses. |
@NonNull Observable<T> |
skipLast(int count)
Returns an
Observable that drops a specified number of items from the end of the sequence emitted by the
current Observable . |
@NonNull Observable<T> |
skipLast(long time,
@NonNull TimeUnit unit)
Returns an
Observable that drops items emitted by the current Observable during a specified time window
before the source completes. |
@NonNull Observable<T> |
skipLast(long time,
@NonNull TimeUnit unit,
boolean delayError)
Returns an
Observable that drops items emitted by the current Observable during a specified time window
before the source completes. |
@NonNull Observable<T> |
skipLast(long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that drops items emitted by the current Observable during a specified time window
(defined on a specified scheduler) before the source completes. |
@NonNull Observable<T> |
skipLast(long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
boolean delayError)
Returns an
Observable that drops items emitted by the current Observable during a specified time window
(defined on a specified scheduler) before the source completes. |
@NonNull Observable<T> |
skipLast(long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
boolean delayError,
int bufferSize)
Returns an
Observable that drops items emitted by the current Observable during a specified time window
(defined on a specified scheduler) before the source completes. |
<U> @NonNull Observable<T> |
skipUntil(@NonNull ObservableSource<U> other)
Returns an
Observable that skips items emitted by the current Observable until a second ObservableSource emits
an item. |
@NonNull Observable<T> |
skipWhile(@NonNull Predicate<? super T> predicate)
Returns an
Observable that skips all items emitted by the current Observable as long as a specified
condition holds true , but emits all further source items as soon as the condition becomes false . |
@NonNull Observable<T> |
sorted()
Returns an
Observable that emits the events emitted by the current Observable , in a
sorted order. |
@NonNull Observable<T> |
sorted(@NonNull Comparator<? super T> comparator)
Returns an
Observable that emits the events emitted by the current Observable , in a
sorted order based on a specified comparison function. |
@NonNull Observable<T> |
startWith(@NonNull CompletableSource other)
Returns an
Observable which first runs the other CompletableSource
then the current Observable if the other completed normally. |
@NonNull Observable<T> |
startWith(@NonNull MaybeSource<T> other)
Returns an
Observable which first runs the other MaybeSource
then the current Observable if the other succeeded or completed normally. |
@NonNull Observable<T> |
startWith(@NonNull ObservableSource<? extends T> other)
Returns an
Observable that emits the items in a specified ObservableSource before it begins to emit
items emitted by the current Observable . |
@NonNull Observable<T> |
startWith(@NonNull SingleSource<T> other)
Returns an
Observable which first runs the other SingleSource
then the current Observable if the other succeeded normally. |
@NonNull Observable<T> |
startWithArray(T... items)
Returns an
Observable that emits the specified items before it begins to emit items emitted by the current
Observable . |
@NonNull Observable<T> |
startWithItem(T item)
Returns an
Observable that emits a specified item before it begins to emit items emitted by the current
Observable . |
@NonNull Observable<T> |
startWithIterable(@NonNull Iterable<? extends T> items)
Returns an
Observable that emits the items in a specified Iterable before it begins to emit items
emitted by the current Observable . |
@NonNull Disposable |
subscribe()
Subscribes to the current
Observable and ignores onNext and onComplete emissions. |
@NonNull Disposable |
subscribe(@NonNull Consumer<? super T> onNext)
Subscribes to the current
Observable and provides a callback to handle the items it emits. |
@NonNull Disposable |
subscribe(@NonNull Consumer<? super T> onNext,
@NonNull Consumer<? super Throwable> onError)
Subscribes to the current
Observable and provides callbacks to handle the items it emits and any error
notification it signals. |
@NonNull Disposable |
subscribe(@NonNull Consumer<? super T> onNext,
@NonNull Consumer<? super Throwable> onError,
@NonNull Action onComplete)
Subscribes to the current
Observable and provides callbacks to handle the items it emits and any error or
completion notification it signals. |
@NonNull Disposable |
subscribe(@NonNull Consumer<? super T> onNext,
@NonNull Consumer<? super Throwable> onError,
@NonNull Action onComplete,
@NonNull DisposableContainer container)
Wraps the given onXXX callbacks into a
Disposable Observer ,
adds it to the given DisposableContainer and ensures, that if the upstream
terminates or this particular Disposable is disposed, the Observer is removed
from the given container. |
void |
subscribe(@NonNull Observer<? super T> observer)
Subscribes the given
Observer to this ObservableSource instance. |
protected abstract void |
subscribeActual(@NonNull Observer<? super T> observer)
Operator implementations (both source and intermediate) should implement this method that
performs the necessary business logic and handles the incoming
Observer s. |
@NonNull Observable<T> |
subscribeOn(@NonNull Scheduler scheduler)
|
<E extends Observer<? super T>> |
subscribeWith(E observer)
Subscribes a given
Observer (subclass) to the current Observable and returns the given
Observer instance as is. |
@NonNull Observable<T> |
switchIfEmpty(@NonNull ObservableSource<? extends T> other)
Returns an
Observable that emits the items emitted by the current Observable or the items of an alternate
ObservableSource if the current Observable is empty. |
<R> @NonNull Observable<R> |
switchMap(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper)
Returns a new
Observable by applying a function that you supply to each item emitted by the current
Observable that returns an ObservableSource , and then emitting the items emitted by the most recently emitted
of these ObservableSource s. |
<R> @NonNull Observable<R> |
switchMap(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper,
int bufferSize)
Returns a new
Observable by applying a function that you supply to each item emitted by the current
Observable that returns an ObservableSource , and then emitting the items emitted by the most recently emitted
of these ObservableSource s. |
@NonNull Completable |
switchMapCompletable(@NonNull Function<? super T,? extends CompletableSource> mapper)
Maps the items of the current
Observable into CompletableSource s, subscribes to the newer one while
disposing the subscription to the previous CompletableSource , thus keeping at most one
active CompletableSource running. |
@NonNull Completable |
switchMapCompletableDelayError(@NonNull Function<? super T,? extends CompletableSource> mapper)
Maps the upstream values into
CompletableSource s, subscribes to the newer one while
disposing the subscription to the previous CompletableSource , thus keeping at most one
active CompletableSource running and delaying any main or inner errors until all
of them terminate. |
<R> @NonNull Observable<R> |
switchMapDelayError(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper)
Returns a new
Observable by applying a function that you supply to each item emitted by the current
Observable that returns an ObservableSource , and then emitting the items emitted by the most recently emitted
of these ObservableSource s and delays any error until all ObservableSource s terminate. |
<R> @NonNull Observable<R> |
switchMapDelayError(@NonNull Function<? super T,? extends ObservableSource<? extends R>> mapper,
int bufferSize)
Returns a new
Observable by applying a function that you supply to each item emitted by the current
Observable that returns an ObservableSource , and then emitting the items emitted by the most recently emitted
of these ObservableSource s and delays any error until all ObservableSource s terminate. |
<R> @NonNull Observable<R> |
switchMapMaybe(@NonNull Function<? super T,? extends MaybeSource<? extends R>> mapper)
Maps the items of the current
Observable into MaybeSource s and switches (subscribes) to the newer ones
while disposing the older ones (and ignoring their signals) and emits the latest success value of the current one if
available while failing immediately if the current Observable or any of the
active inner MaybeSource s fail. |
<R> @NonNull Observable<R> |
switchMapMaybeDelayError(@NonNull Function<? super T,? extends MaybeSource<? extends R>> mapper)
Maps the upstream items into
MaybeSource s and switches (subscribes) to the newer ones
while disposing the older ones (and ignoring their signals) and emits the latest success value of the current one if
available, delaying errors from the current Observable or the inner MaybeSource s until all terminate. |
<R> @NonNull Observable<R> |
switchMapSingle(@NonNull Function<? super T,? extends SingleSource<? extends R>> mapper)
Returns a new
Observable by applying a function that you supply to each item emitted by the current
Observable that returns a SingleSource , and then emitting the item emitted by the most recently emitted
of these SingleSource s. |
<R> @NonNull Observable<R> |
switchMapSingleDelayError(@NonNull Function<? super T,? extends SingleSource<? extends R>> mapper)
Returns a new
Observable by applying a function that you supply to each item emitted by the current
Observable that returns a SingleSource , and then emitting the item emitted by the most recently emitted
of these SingleSource s and delays any error until all SingleSource s terminate. |
static <T> @NonNull Observable<T> |
switchOnNext(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources)
Converts an
ObservableSource that emits ObservableSource s into an Observable that emits the items emitted by the
most recently emitted of those ObservableSource s. |
static <T> @NonNull Observable<T> |
switchOnNext(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources,
int bufferSize)
Converts an
ObservableSource that emits ObservableSource s into an Observable that emits the items emitted by the
most recently emitted of those ObservableSource s. |
static <T> @NonNull Observable<T> |
switchOnNextDelayError(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources)
Converts an
ObservableSource that emits ObservableSource s into an Observable that emits the items emitted by the
most recently emitted of those ObservableSource s and delays any exception until all ObservableSource s terminate. |
static <T> @NonNull Observable<T> |
switchOnNextDelayError(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources,
int bufferSize)
Converts an
ObservableSource that emits ObservableSource s into an Observable that emits the items emitted by the
most recently emitted of those ObservableSource s and delays any exception until all ObservableSource s terminate. |
@NonNull Observable<T> |
take(long count)
Returns an
Observable that emits only the first count items emitted by the current Observable . |
@NonNull Observable<T> |
take(long time,
@NonNull TimeUnit unit)
Returns an
Observable that emits those items emitted by the current Observable before a specified time runs
out. |
@NonNull Observable<T> |
take(long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits those items emitted by the current Observable before a specified time (on a
specified Scheduler ) runs out. |
@NonNull Observable<T> |
takeLast(int count)
Returns an
Observable that emits at most the last count items emitted by the current Observable . |
@NonNull Observable<T> |
takeLast(long count,
long time,
@NonNull TimeUnit unit)
Returns an
Observable that emits at most a specified number of items from the current Observable that were
emitted in a specified window of time before the current Observable completed. |
@NonNull Observable<T> |
takeLast(long count,
long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits at most a specified number of items from the current Observable that were
emitted in a specified window of time before the current Observable completed, where the timing information is
provided by a given Scheduler . |
@NonNull Observable<T> |
takeLast(long count,
long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
boolean delayError,
int bufferSize)
Returns an
Observable that emits at most a specified number of items from the current Observable that were
emitted in a specified window of time before the current Observable completed, where the timing information is
provided by a given Scheduler . |
@NonNull Observable<T> |
takeLast(long time,
@NonNull TimeUnit unit)
Returns an
Observable that emits the items from the current Observable that were emitted in a specified
window of time before the current Observable completed. |
@NonNull Observable<T> |
takeLast(long time,
@NonNull TimeUnit unit,
boolean delayError)
Returns an
Observable that emits the items from the current Observable that were emitted in a specified
window of time before the current Observable completed. |
@NonNull Observable<T> |
takeLast(long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits the items from the current Observable that were emitted in a specified
window of time before the current Observable completed, where the timing information is provided by a specified
Scheduler . |
@NonNull Observable<T> |
takeLast(long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
boolean delayError)
Returns an
Observable that emits the items from the current Observable that were emitted in a specified
window of time before the current Observable completed, where the timing information is provided by a specified
Scheduler . |
@NonNull Observable<T> |
takeLast(long time,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
boolean delayError,
int bufferSize)
Returns an
Observable that emits the items from the current Observable that were emitted in a specified
window of time before the current Observable completed, where the timing information is provided by a specified
Scheduler . |
<U> @NonNull Observable<T> |
takeUntil(@NonNull ObservableSource<U> other)
Returns an
Observable that emits the items emitted by the current Observable until a second ObservableSource
emits an item or completes. |
@NonNull Observable<T> |
takeUntil(@NonNull Predicate<? super T> stopPredicate)
Returns an
Observable that emits items emitted by the current Observable , checks the specified predicate
for each item, and then completes when the condition is satisfied. |
@NonNull Observable<T> |
takeWhile(@NonNull Predicate<? super T> predicate)
Returns an
Observable that emits items emitted by the current Observable so long as each item satisfied a
specified condition, and then completes as soon as this condition is not satisfied. |
@NonNull TestObserver<T> |
test()
Creates a
TestObserver and subscribes it to the current Observable . |
@NonNull TestObserver<T> |
test(boolean dispose)
Creates a
TestObserver , optionally disposes it and then subscribes
it to the current Observable . |
@NonNull Observable<T> |
throttleFirst(long windowDuration,
@NonNull TimeUnit unit)
Returns an
Observable that emits only the first item emitted by the current Observable during sequential
time windows of a specified duration. |
@NonNull Observable<T> |
throttleFirst(long skipDuration,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits only the first item emitted by the current Observable during sequential
time windows of a specified duration, where the windows are managed by a specified Scheduler . |
@NonNull Observable<T> |
throttleFirst(long skipDuration,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
@NonNull Consumer<? super T> onDropped)
Returns an
Observable that emits only the first item emitted by the current Observable during sequential
time windows of a specified duration, where the windows are managed by a specified Scheduler . |
@NonNull Observable<T> |
throttleLast(long intervalDuration,
@NonNull TimeUnit unit)
Returns an
Observable that emits only the last item emitted by the current Observable during sequential
time windows of a specified duration. |
@NonNull Observable<T> |
throttleLast(long intervalDuration,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits only the last item emitted by the current Observable during sequential
time windows of a specified duration, where the duration is governed by a specified Scheduler . |
@NonNull Observable<T> |
throttleLast(long intervalDuration,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
@NonNull Consumer<? super T> onDropped)
Returns an
Observable that emits only the last item emitted by the current Observable during sequential
time windows of a specified duration, where the duration is governed by a specified Scheduler . |
@NonNull Observable<T> |
throttleLatest(long timeout,
@NonNull TimeUnit unit)
Throttles items from the current
Observable by first emitting the next
item from upstream, then periodically emitting the latest item (if any) when
the specified timeout elapses between them. |
@NonNull Observable<T> |
throttleLatest(long timeout,
@NonNull TimeUnit unit,
boolean emitLast)
Throttles items from the current
Observable by first emitting the next
item from upstream, then periodically emitting the latest item (if any) when
the specified timeout elapses between them. |
@NonNull Observable<T> |
throttleLatest(long timeout,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Throttles items from the current
Observable by first emitting the next
item from upstream, then periodically emitting the latest item (if any) when
the specified timeout elapses between them. |
@NonNull Observable<T> |
throttleLatest(long timeout,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
boolean emitLast)
Throttles items from the current
Observable by first emitting the next
item from upstream, then periodically emitting the latest item (if any) when
the specified timeout elapses between them. |
@NonNull Observable<T> |
throttleLatest(long timeout,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
boolean emitLast,
@NonNull Consumer<? super T> onDropped)
Throttles items from the current
Observable by first emitting the next
item from upstream, then periodically emitting the latest item (if any) when
the specified timeout elapses between them, invoking the consumer for any dropped item. |
@NonNull Observable<T> |
throttleWithTimeout(long timeout,
@NonNull TimeUnit unit)
Returns an
Observable that mirrors the current Observable , except that it drops items emitted by the
current Observable that are followed by newer items before a timeout value expires. |
@NonNull Observable<T> |
throttleWithTimeout(long timeout,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that mirrors the current Observable , except that it drops items emitted by the
current Observable that are followed by newer items before a timeout value expires on a specified
Scheduler . |
@NonNull Observable<T> |
throttleWithTimeout(long timeout,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
@NonNull Consumer<? super T> onDropped)
Returns an
Observable that mirrors the current Observable , except that it drops items emitted by the
current Observable that are followed by newer items before a timeout value expires on a specified
Scheduler . |
@NonNull Observable<Timed<T>> |
timeInterval()
Returns an
Observable that emits records of the time interval between consecutive items emitted by the
current Observable . |
@NonNull Observable<Timed<T>> |
timeInterval(@NonNull Scheduler scheduler)
Returns an
Observable that emits records of the time interval between consecutive items emitted by the
current Observable , where this interval is computed on a specified Scheduler . |
@NonNull Observable<Timed<T>> |
timeInterval(@NonNull TimeUnit unit)
Returns an
Observable that emits records of the time interval between consecutive items emitted by the
current Observable . |
@NonNull Observable<Timed<T>> |
timeInterval(@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits records of the time interval between consecutive items emitted by the
current Observable , where this interval is computed on a specified Scheduler . |
<V> @NonNull Observable<T> |
timeout(@NonNull Function<? super T,? extends ObservableSource<V>> itemTimeoutIndicator)
Returns an
Observable that mirrors the current Observable , but notifies observers of a
TimeoutException if an item emitted by the current Observable doesn't arrive within a window of
time after the emission of the previous item, where that period of time is measured by an ObservableSource that
is a function of the previous item. |
<V> @NonNull Observable<T> |
timeout(@NonNull Function<? super T,? extends ObservableSource<V>> itemTimeoutIndicator,
@NonNull ObservableSource<? extends T> fallback)
Returns an
Observable that mirrors the current Observable , but that switches to a fallback ObservableSource if
an item emitted by the current Observable doesn't arrive within a window of time after the emission of the
previous item, where that period of time is measured by an ObservableSource that is a function of the previous
item. |
@NonNull Observable<T> |
timeout(long timeout,
@NonNull TimeUnit unit)
Returns an
Observable that mirrors the current Observable but applies a timeout policy for each emitted
item. |
@NonNull Observable<T> |
timeout(long timeout,
@NonNull TimeUnit unit,
@NonNull ObservableSource<? extends T> fallback)
Returns an
Observable that mirrors the current Observable but applies a timeout policy for each emitted
item. |
@NonNull Observable<T> |
timeout(long timeout,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that mirrors the current Observable but applies a timeout policy for each emitted
item, where this policy is governed on a specified Scheduler . |
@NonNull Observable<T> |
timeout(long timeout,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
@NonNull ObservableSource<? extends T> fallback)
Returns an
Observable that mirrors the current Observable but applies a timeout policy for each emitted
item using a specified Scheduler . |
<U,V> @NonNull Observable<T> |
timeout(@NonNull ObservableSource<U> firstTimeoutIndicator,
@NonNull Function<? super T,? extends ObservableSource<V>> itemTimeoutIndicator)
Returns an
Observable that mirrors the current Observable , but notifies observers of a
TimeoutException if either the first item emitted by the current Observable or any subsequent item
doesn't arrive within time windows defined by indicator ObservableSource s. |
<U,V> @NonNull Observable<T> |
timeout(@NonNull ObservableSource<U> firstTimeoutIndicator,
@NonNull Function<? super T,? extends ObservableSource<V>> itemTimeoutIndicator,
@NonNull ObservableSource<? extends T> fallback)
Returns an
Observable that mirrors the current Observable , but switches to a fallback ObservableSource if either
the first item emitted by the current Observable or any subsequent item doesn't arrive within time windows
defined by indicator ObservableSource s. |
static @NonNull Observable<Long> |
timer(long delay,
@NonNull TimeUnit unit)
Returns an
Observable that emits 0L after a specified delay, and then completes. |
static @NonNull Observable<Long> |
timer(long delay,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits 0L after a specified delay, on a specified Scheduler , and then
completes. |
@NonNull Observable<Timed<T>> |
timestamp()
Returns an
Observable that emits each item emitted by the current Observable , wrapped in a
Timed object. |
@NonNull Observable<Timed<T>> |
timestamp(@NonNull Scheduler scheduler)
|
@NonNull Observable<Timed<T>> |
timestamp(@NonNull TimeUnit unit)
Returns an
Observable that emits each item emitted by the current Observable , wrapped in a
Timed object. |
@NonNull Observable<Timed<T>> |
timestamp(@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
|
<R> R |
to(@NonNull ObservableConverter<T,? extends R> converter)
Calls the specified converter function during assembly time and returns its resulting value.
|
@NonNull Flowable<T> |
toFlowable(@NonNull BackpressureStrategy strategy)
Converts the current
Observable into a Flowable by applying the specified backpressure strategy. |
@NonNull Future<T> |
toFuture()
Returns a
Future representing the only value emitted by the current Observable . |
@NonNull Single<List<T>> |
toList()
|
@NonNull Single<List<T>> |
toList(int capacityHint)
|
<U extends Collection<? super T>> |
toList(@NonNull Supplier<U> collectionSupplier)
Returns a
Single that emits a single item, a Collection (subclass) composed of all the items emitted by the
finite upstream Observable . |
<K> @NonNull Single<Map<K,T>> |
toMap(@NonNull Function<? super T,? extends K> keySelector)
|
<K,V> @NonNull Single<Map<K,V>> |
toMap(@NonNull Function<? super T,? extends K> keySelector,
@NonNull Function<? super T,? extends V> valueSelector)
|
<K,V> @NonNull Single<Map<K,V>> |
toMap(@NonNull Function<? super T,? extends K> keySelector,
@NonNull Function<? super T,? extends V> valueSelector,
@NonNull Supplier<? extends Map<K,V>> mapSupplier)
|
<K> @NonNull Single<Map<K,Collection<T>>> |
toMultimap(@NonNull Function<? super T,? extends K> keySelector)
|
<K,V> @NonNull Single<Map<K,Collection<V>>> |
toMultimap(@NonNull Function<? super T,? extends K> keySelector,
Function<? super T,? extends V> valueSelector)
|
<K,V> @NonNull Single<Map<K,Collection<V>>> |
toMultimap(@NonNull Function<? super T,? extends K> keySelector,
@NonNull Function<? super T,? extends V> valueSelector,
@NonNull Supplier<? extends Map<K,Collection<V>>> mapSupplier,
@NonNull Function<? super K,? extends Collection<? super V>> collectionFactory)
Returns a
Single that emits a single Map (subclass), returned by a specified mapFactory function, that
contains a custom Collection of values, extracted by a specified valueSelector function from
items emitted by the current and finite Observable , and keyed by the keySelector function. |
<K,V> @NonNull Single<Map<K,Collection<V>>> |
toMultimap(@NonNull Function<? super T,? extends K> keySelector,
@NonNull Function<? super T,? extends V> valueSelector,
@NonNull Supplier<Map<K,Collection<V>>> mapSupplier)
|
@NonNull Single<List<T>> |
toSortedList()
|
@NonNull Single<List<T>> |
toSortedList(@NonNull Comparator<? super T> comparator)
|
@NonNull Single<List<T>> |
toSortedList(@NonNull Comparator<? super T> comparator,
int capacityHint)
|
@NonNull Single<List<T>> |
toSortedList(int capacityHint)
|
static <T> @NonNull Observable<T> |
unsafeCreate(@NonNull ObservableSource<T> onSubscribe)
Create an
Observable by wrapping an ObservableSource which has to be implemented according
to the Observable specification derived from the Reactive Streams specification by handling
disposal correctly; no safeguards are provided by the Observable itself. |
@NonNull Observable<T> |
unsubscribeOn(@NonNull Scheduler scheduler)
|
static <T,D> @NonNull Observable<T> |
using(@NonNull Supplier<? extends D> resourceSupplier,
@NonNull Function<? super D,? extends ObservableSource<? extends T>> sourceSupplier,
@NonNull Consumer<? super D> resourceCleanup)
Constructs an
Observable that creates a dependent resource object, an ObservableSource with
that resource and calls the provided resourceDisposer function if this inner source terminates or the
downstream disposes the flow. |
static <T,D> @NonNull Observable<T> |
using(@NonNull Supplier<? extends D> resourceSupplier,
@NonNull Function<? super D,? extends ObservableSource<? extends T>> sourceSupplier,
@NonNull Consumer<? super D> resourceCleanup,
boolean eager)
Constructs an
Observable that creates a dependent resource object, an ObservableSource with
that resource and calls the provided disposer function if this inner source terminates or the
downstream disposes the flow; doing it before these end-states have been reached if eager == true , after otherwise. |
@NonNull Observable<Observable<T>> |
window(long count)
Returns an
Observable that emits windows of items it collects from the current Observable . |
@NonNull Observable<Observable<T>> |
window(long count,
long skip)
Returns an
Observable that emits windows of items it collects from the current Observable . |
@NonNull Observable<Observable<T>> |
window(long count,
long skip,
int bufferSize)
Returns an
Observable that emits windows of items it collects from the current Observable . |
@NonNull Observable<Observable<T>> |
window(long timespan,
long timeskip,
@NonNull TimeUnit unit)
Returns an
Observable that emits windows of items it collects from the current Observable . |
@NonNull Observable<Observable<T>> |
window(long timespan,
long timeskip,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits windows of items it collects from the current Observable . |
@NonNull Observable<Observable<T>> |
window(long timespan,
long timeskip,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
int bufferSize)
Returns an
Observable that emits windows of items it collects from the current Observable . |
@NonNull Observable<Observable<T>> |
window(long timespan,
@NonNull TimeUnit unit)
Returns an
Observable that emits windows of items it collects from the current Observable . |
@NonNull Observable<Observable<T>> |
window(long timespan,
@NonNull TimeUnit unit,
long count)
Returns an
Observable that emits windows of items it collects from the current Observable . |
@NonNull Observable<Observable<T>> |
window(long timespan,
@NonNull TimeUnit unit,
long count,
boolean restart)
Returns an
Observable that emits windows of items it collects from the current Observable . |
@NonNull Observable<Observable<T>> |
window(long timespan,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler)
Returns an
Observable that emits windows of items it collects from the current Observable . |
@NonNull Observable<Observable<T>> |
window(long timespan,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
long count)
Returns an
Observable that emits windows of items it collects from the current Observable . |
@NonNull Observable<Observable<T>> |
window(long timespan,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
long count,
boolean restart)
Returns an
Observable that emits windows of items it collects from the current Observable . |
@NonNull Observable<Observable<T>> |
window(long timespan,
@NonNull TimeUnit unit,
@NonNull Scheduler scheduler,
long count,
boolean restart,
int bufferSize)
Returns an
Observable that emits windows of items it collects from the current Observable . |
<B> @NonNull Observable<Observable<T>> |
window(@NonNull ObservableSource<B> boundaryIndicator)
Returns an
Observable that emits non-overlapping windows of items it collects from the current Observable
where the boundary of each window is determined by the items emitted from a specified boundary-governing
ObservableSource . |
<B> @NonNull Observable<Observable<T>> |
window(@NonNull ObservableSource<B> boundaryIndicator,
int bufferSize)
Returns an
Observable that emits non-overlapping windows of items it collects from the current Observable
where the boundary of each window is determined by the items emitted from a specified boundary-governing
ObservableSource . |
<U,V> @NonNull Observable<Observable<T>> |
window(@NonNull ObservableSource<U> openingIndicator,
@NonNull Function<? super U,? extends ObservableSource<V>> closingIndicator)
Returns an
Observable that emits windows of items it collects from the current Observable . |
<U,V> @NonNull Observable<Observable<T>> |
window(@NonNull ObservableSource<U> openingIndicator,
@NonNull Function<? super U,? extends ObservableSource<V>> closingIndicator,
int bufferSize)
Returns an
Observable that emits windows of items it collects from the current Observable . |
<R> @NonNull Observable<R> |
withLatestFrom(@NonNull Iterable<? extends ObservableSource<?>> others,
@NonNull Function<? super Object[],R> combiner)
Combines the value emission from the current
Observable with the latest emissions from the
other ObservableSource s via a function to produce the output item. |
<R> @NonNull Observable<R> |
withLatestFrom(@NonNull ObservableSource<?>[] others,
@NonNull Function<? super Object[],R> combiner)
Combines the value emission from the current
Observable with the latest emissions from the
other ObservableSource s via a function to produce the output item. |
<U,R> @NonNull Observable<R> |
withLatestFrom(@NonNull ObservableSource<? extends U> other,
@NonNull BiFunction<? super T,? super U,? extends R> combiner)
Merges the specified
ObservableSource into the current Observable sequence by using the resultSelector
function only when the current Observable emits an item. |
<T1,T2,R> @NonNull Observable<R> |
withLatestFrom(@NonNull ObservableSource<T1> source1,
@NonNull ObservableSource<T2> source2,
@NonNull Function3<? super T,? super T1,? super T2,R> combiner)
Combines the value emission from the current
Observable with the latest emissions from the
other ObservableSource s via a function to produce the output item. |
<T1,T2,T3,R> |
withLatestFrom(@NonNull ObservableSource<T1> source1,
@NonNull ObservableSource<T2> source2,
@NonNull ObservableSource<T3> source3,
@NonNull Function4<? super T,? super T1,? super T2,? super T3,R> combiner)
Combines the value emission from the current
Observable with the latest emissions from the
other ObservableSource s via a function to produce the output item. |
<T1,T2,T3,T4,R> |
withLatestFrom(@NonNull ObservableSource<T1> source1,
@NonNull ObservableSource<T2> source2,
@NonNull ObservableSource<T3> source3,
@NonNull ObservableSource<T4> source4,
@NonNull Function5<? super T,? super T1,? super T2,? super T3,? super T4,R> combiner)
Combines the value emission from the current
Observable with the latest emissions from the
other ObservableSource s via a function to produce the output item. |
static <T> @NonNull Observable<T> |
wrap(@NonNull ObservableSource<T> source)
|
static <T,R> @NonNull Observable<R> |
zip(@NonNull Iterable<? extends ObservableSource<? extends T>> sources,
@NonNull Function<? super Object[],? extends R> zipper)
Returns an
Observable that emits the results of a specified combiner function applied to combinations of
items emitted, in sequence, by an Iterable of other ObservableSource s. |
static <T,R> @NonNull Observable<R> |
zip(@NonNull Iterable<? extends ObservableSource<? extends T>> sources,
@NonNull Function<? super Object[],? extends R> zipper,
boolean delayError,
int bufferSize)
Returns an
Observable that emits the results of a specified combiner function applied to combinations of
items emitted, in sequence, by an Iterable of other ObservableSource s. |
static <T1,T2,R> @NonNull Observable<R> |
zip(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull BiFunction<? super T1,? super T2,? extends R> zipper)
Returns an
Observable that emits the results of a specified combiner function applied to combinations of
two items emitted, in sequence, by two other ObservableSource s. |
static <T1,T2,R> @NonNull Observable<R> |
zip(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull BiFunction<? super T1,? super T2,? extends R> zipper,
boolean delayError)
Returns an
Observable that emits the results of a specified combiner function applied to combinations of
two items emitted, in sequence, by two other ObservableSource s. |
static <T1,T2,R> @NonNull Observable<R> |
zip(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull BiFunction<? super T1,? super T2,? extends R> zipper,
boolean delayError,
int bufferSize)
Returns an
Observable that emits the results of a specified combiner function applied to combinations of
two items emitted, in sequence, by two other ObservableSource s. |
static <T1,T2,T3,R> |
zip(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull ObservableSource<? extends T3> source3,
@NonNull Function3<? super T1,? super T2,? super T3,? extends R> zipper)
Returns an
Observable that emits the results of a specified combiner function applied to combinations of
three items emitted, in sequence, by three other ObservableSource s. |
static <T1,T2,T3,T4,R> |
zip(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull ObservableSource<? extends T3> source3,
@NonNull ObservableSource<? extends T4> source4,
@NonNull Function4<? super T1,? super T2,? super T3,? super T4,? extends R> zipper)
Returns an
Observable that emits the results of a specified combiner function applied to combinations of
four items emitted, in sequence, by four other ObservableSource s. |
static <T1,T2,T3,T4,T5,R> |
zip(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull ObservableSource<? extends T3> source3,
@NonNull ObservableSource<? extends T4> source4,
@NonNull ObservableSource<? extends T5> source5,
@NonNull Function5<? super T1,? super T2,? super T3,? super T4,? super T5,? extends R> zipper)
Returns an
Observable that emits the results of a specified combiner function applied to combinations of
five items emitted, in sequence, by five other ObservableSource s. |
static <T1,T2,T3,T4,T5,T6,R> |
zip(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull ObservableSource<? extends T3> source3,
@NonNull ObservableSource<? extends T4> source4,
@NonNull ObservableSource<? extends T5> source5,
@NonNull ObservableSource<? extends T6> source6,
@NonNull Function6<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? extends R> zipper)
Returns an
Observable that emits the results of a specified combiner function applied to combinations of
six items emitted, in sequence, by six other ObservableSource s. |
static <T1,T2,T3,T4,T5,T6,T7,R> |
zip(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull ObservableSource<? extends T3> source3,
@NonNull ObservableSource<? extends T4> source4,
@NonNull ObservableSource<? extends T5> source5,
@NonNull ObservableSource<? extends T6> source6,
@NonNull ObservableSource<? extends T7> source7,
@NonNull Function7<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? extends R> zipper)
Returns an
Observable that emits the results of a specified combiner function applied to combinations of
seven items emitted, in sequence, by seven other ObservableSource s. |
static <T1,T2,T3,T4,T5,T6,T7,T8,R> |
zip(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull ObservableSource<? extends T3> source3,
@NonNull ObservableSource<? extends T4> source4,
@NonNull ObservableSource<? extends T5> source5,
@NonNull ObservableSource<? extends T6> source6,
@NonNull ObservableSource<? extends T7> source7,
@NonNull ObservableSource<? extends T8> source8,
@NonNull Function8<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? extends R> zipper)
Returns an
Observable that emits the results of a specified combiner function applied to combinations of
eight items emitted, in sequence, by eight other ObservableSource s. |
static <T1,T2,T3,T4,T5,T6,T7,T8,T9,R> |
zip(@NonNull ObservableSource<? extends T1> source1,
@NonNull ObservableSource<? extends T2> source2,
@NonNull ObservableSource<? extends T3> source3,
@NonNull ObservableSource<? extends T4> source4,
@NonNull ObservableSource<? extends T5> source5,
@NonNull ObservableSource<? extends T6> source6,
@NonNull ObservableSource<? extends T7> source7,
@NonNull ObservableSource<? extends T8> source8,
@NonNull ObservableSource<? extends T9> source9,
@NonNull Function9<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? super T9,? extends R> zipper)
Returns an
Observable that emits the results of a specified combiner function applied to combinations of
nine items emitted, in sequence, by nine other ObservableSource s. |
static <T,R> @NonNull Observable<R> |
zipArray(@NonNull Function<? super Object[],? extends R> zipper,
boolean delayError,
int bufferSize,
ObservableSource<? extends T>... sources)
Returns an
Observable that emits the results of a specified combiner function applied to combinations of
items emitted, in sequence, by an array of other ObservableSource s. |
<U,R> @NonNull Observable<R> |
zipWith(@NonNull Iterable<U> other,
@NonNull BiFunction<? super T,? super U,? extends R> zipper)
Returns an
Observable that emits items that are the result of applying a specified function to pairs of
values, one each from the current Observable and a specified Iterable sequence. |
<U,R> @NonNull Observable<R> |
zipWith(@NonNull ObservableSource<? extends U> other,
@NonNull BiFunction<? super T,? super U,? extends R> zipper)
Returns an
Observable that emits items that are the result of applying a specified function to pairs of
values, one each from the current Observable and another specified ObservableSource . |
<U,R> @NonNull Observable<R> |
zipWith(@NonNull ObservableSource<? extends U> other,
@NonNull BiFunction<? super T,? super U,? extends R> zipper,
boolean delayError)
Returns an
Observable that emits items that are the result of applying a specified function to pairs of
values, one each from the current Observable and another specified ObservableSource . |
<U,R> @NonNull Observable<R> |
zipWith(@NonNull ObservableSource<? extends U> other,
@NonNull BiFunction<? super T,? super U,? extends R> zipper,
boolean delayError,
int bufferSize)
Returns an
Observable that emits items that are the result of applying a specified function to pairs of
values, one each from the current Observable and another specified ObservableSource . |
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> amb(@NonNull Iterable<? extends ObservableSource<? extends T>> sources)
ObservableSource
in an Iterable
of several ObservableSource
s that first either emits an item or sends
a termination notification.
When one of the ObservableSource
s signal an item or terminates first, all subscriptions to the other
ObservableSource
s are disposed.
amb
does not operate by default on a particular Scheduler
.ObservableSource
s signals an error, the error is routed to the global
error handler via RxJavaPlugins.onError(Throwable)
.
T
- the common element typesources
- an Iterable
of ObservableSource
sources competing to react first. A subscription to each source will
occur in the same order as in the Iterable
.Observable
instanceNullPointerException
- if sources
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") @SafeVarargs public static <T> @NonNull Observable<T> ambArray(@NonNull ObservableSource<? extends T>... sources)
ObservableSource
in an array of several ObservableSource
s that first either emits an item or sends
a termination notification.
When one of the ObservableSource
s signal an item or terminates first, all subscriptions to the other
ObservableSource
s are disposed.
ambArray
does not operate by default on a particular Scheduler
.ObservableSource
s signals an error, the error is routed to the global
error handler via RxJavaPlugins.onError(Throwable)
.
T
- the common element typesources
- an array of ObservableSource
sources competing to react first. A subscription to each source will
occur in the same order as in the array.Observable
instanceNullPointerException
- if sources
is null
@CheckReturnValue public static int bufferSize()
Delegates to Flowable.bufferSize()
but is public for convenience.
The value can be overridden via system parameter rx3.buffer-size
before the Flowable
class is loaded.
@CheckReturnValue @SchedulerSupport(value="none") @NonNull public static <T,R> @NonNull Observable<R> combineLatest(@NonNull Iterable<? extends ObservableSource<? extends T>> sources, @NonNull Function<? super Object[],? extends R> combiner)
ObservableSource
s by emitting an item that aggregates the latest values of each of
the returned ObservableSource
s each time an item is received from any of the returned ObservableSource
s, where this
aggregation is defined by a specified function.
Note on method signature: since Java doesn't allow creating a generic array with new T[]
, the
implementation of this operator has to create an Object[]
instead. Unfortunately, a
Function<Integer[], R>
passed to the method would trigger a ClassCastException
.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.
If the provided iterable of ObservableSource
s is empty, the resulting sequence completes immediately without emitting
any items and without any calls to the combiner function.
combineLatest
does not operate by default on a particular Scheduler
.T
- the common base type of source valuesR
- the result typesources
- the collection of source ObservableSource
scombiner
- the aggregation function used to combine the items emitted by the returned ObservableSource
sObservable
instanceNullPointerException
- if sources
or combiner
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T,R> @NonNull Observable<R> combineLatest(@NonNull Iterable<? extends ObservableSource<? extends T>> sources, @NonNull Function<? super Object[],? extends R> combiner, int bufferSize)
Iterable
of source ObservableSource
s by emitting an item that aggregates the latest values of each of
the returned ObservableSource
s each time an item is received from any of the returned ObservableSource
s, where this
aggregation is defined by a specified function.
Note on method signature: since Java doesn't allow creating a generic array with new T[]
, the
implementation of this operator has to create an Object[]
instead. Unfortunately, a
Function<Integer[], R>
passed to the method would trigger a ClassCastException
.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.
If the provided Iterable
of ObservableSource
s is empty, the resulting sequence completes immediately without emitting
any items and without any calls to the combiner function.
combineLatest
does not operate by default on a particular Scheduler
.T
- the common base type of source valuesR
- the result typesources
- the collection of source ObservableSource
scombiner
- the aggregation function used to combine the items emitted by the returned ObservableSource
sbufferSize
- the expected number of row combination items to be buffered internallyObservable
instanceNullPointerException
- if sources
or combiner
is null
IllegalArgumentException
- if bufferSize
is non-positive@CheckReturnValue @SchedulerSupport(value="none") @NonNull public static <T,R> @NonNull Observable<R> combineLatestArray(@NonNull ObservableSource<? extends T>[] sources, @NonNull Function<? super Object[],? extends R> combiner)
ObservableSource
s by emitting an item that aggregates the latest values of each of
the ObservableSource
s each time an item is received from any of the returned ObservableSource
s, where this
aggregation is defined by a specified function.
Note on method signature: since Java doesn't allow creating a generic array with new T[]
, the
implementation of this operator has to create an Object[]
instead. Unfortunately, a
Function<Integer[], R>
passed to the method would trigger a ClassCastException
.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.
If the provided array of ObservableSource
s is empty, the resulting sequence completes immediately without emitting
any items and without any calls to the combiner function.
combineLatestArray
does not operate by default on a particular Scheduler
.T
- the common base type of source valuesR
- the result typesources
- the collection of source ObservableSource
scombiner
- the aggregation function used to combine the items emitted by the ObservableSource
sObservable
instanceNullPointerException
- if sources
or combiner
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T,R> @NonNull Observable<R> combineLatestArray(@NonNull ObservableSource<? extends T>[] sources, @NonNull Function<? super Object[],? extends R> combiner, int bufferSize)
ObservableSource
s by emitting an item that aggregates the latest values of each of
the ObservableSource
s each time an item is received from any of the ObservableSource
s, where this
aggregation is defined by a specified function.
Note on method signature: since Java doesn't allow creating a generic array with new T[]
, the
implementation of this operator has to create an Object[]
instead. Unfortunately, a
Function<Integer[], R>
passed to the method would trigger a ClassCastException
.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.
If the provided array of ObservableSource
s is empty, the resulting sequence completes immediately without emitting
any items and without any calls to the combiner function.
combineLatestArray
does not operate by default on a particular Scheduler
.T
- the common base type of source valuesR
- the result typesources
- the collection of source ObservableSource
scombiner
- the aggregation function used to combine the items emitted by the ObservableSource
sbufferSize
- the expected number of row combination items to be buffered internallyObservable
instanceNullPointerException
- if sources
or combiner
is null
IllegalArgumentException
- if bufferSize
is non-positive@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T1,T2,R> @NonNull Observable<R> combineLatest(@NonNull ObservableSource<? extends T1> source1, @NonNull ObservableSource<? extends T2> source2, @NonNull BiFunction<? super T1,? super T2,? extends R> combiner)
ObservableSource
s by emitting an item that aggregates the latest values of each of the
ObservableSource
s each time an item is received from either of the ObservableSource
s, where this
aggregation is defined by a specified function.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.
combineLatest
does not operate by default on a particular Scheduler
.T1
- the element type of the first sourceT2
- the element type of the second sourceR
- the combined output typesource1
- the first source ObservableSource
source2
- the second source ObservableSource
combiner
- the aggregation function used to combine the items emitted by the ObservableSource
sObservable
instanceNullPointerException
- if source1
, source2
or combiner
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T1,T2,T3,R> @NonNull Observable<R> combineLatest(@NonNull ObservableSource<? extends T1> source1, @NonNull ObservableSource<? extends T2> source2, @NonNull ObservableSource<? extends T3> source3, @NonNull Function3<? super T1,? super T2,? super T3,? extends R> combiner)
ObservableSource
s by emitting an item that aggregates the latest values of each of the
ObservableSource
s each time an item is received from any of the ObservableSource
s, where this
aggregation is defined by a specified function.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.
combineLatest
does not operate by default on a particular Scheduler
.T1
- the element type of the first sourceT2
- the element type of the second sourceT3
- the element type of the third sourceR
- the combined output typesource1
- the first source ObservableSource
source2
- the second source ObservableSource
source3
- the third source ObservableSource
combiner
- the aggregation function used to combine the items emitted by the ObservableSource
sObservable
instanceNullPointerException
- if source1
, source2
, source3
or combiner
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T1,T2,T3,T4,R> @NonNull Observable<R> combineLatest(@NonNull ObservableSource<? extends T1> source1, @NonNull ObservableSource<? extends T2> source2, @NonNull ObservableSource<? extends T3> source3, @NonNull ObservableSource<? extends T4> source4, @NonNull Function4<? super T1,? super T2,? super T3,? super T4,? extends R> combiner)
ObservableSource
s by emitting an item that aggregates the latest values of each of the
ObservableSource
s each time an item is received from any of the ObservableSource
s, where this
aggregation is defined by a specified function.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.
combineLatest
does not operate by default on a particular Scheduler
.T1
- the element type of the first sourceT2
- the element type of the second sourceT3
- the element type of the third sourceT4
- the element type of the fourth sourceR
- the combined output typesource1
- the first source ObservableSource
source2
- the second source ObservableSource
source3
- the third source ObservableSource
source4
- the fourth source ObservableSource
combiner
- the aggregation function used to combine the items emitted by the ObservableSource
sObservable
instanceNullPointerException
- if source1
, source2
, source3
,
source4
or combiner
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T1,T2,T3,T4,T5,R> @NonNull Observable<R> combineLatest(@NonNull ObservableSource<? extends T1> source1, @NonNull ObservableSource<? extends T2> source2, @NonNull ObservableSource<? extends T3> source3, @NonNull ObservableSource<? extends T4> source4, @NonNull ObservableSource<? extends T5> source5, @NonNull Function5<? super T1,? super T2,? super T3,? super T4,? super T5,? extends R> combiner)
ObservableSource
s by emitting an item that aggregates the latest values of each of the
ObservableSource
s each time an item is received from any of the ObservableSource
s, where this
aggregation is defined by a specified function.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.
combineLatest
does not operate by default on a particular Scheduler
.T1
- the element type of the first sourceT2
- the element type of the second sourceT3
- the element type of the third sourceT4
- the element type of the fourth sourceT5
- the element type of the fifth sourceR
- the combined output typesource1
- the first source ObservableSource
source2
- the second source ObservableSource
source3
- the third source ObservableSource
source4
- the fourth source ObservableSource
source5
- the fifth source ObservableSource
combiner
- the aggregation function used to combine the items emitted by the ObservableSource
sObservable
instanceNullPointerException
- if source1
, source2
, source3
,
source4
, source5
or combiner
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T1,T2,T3,T4,T5,T6,R> @NonNull Observable<R> combineLatest(@NonNull ObservableSource<? extends T1> source1, @NonNull ObservableSource<? extends T2> source2, @NonNull ObservableSource<? extends T3> source3, @NonNull ObservableSource<? extends T4> source4, @NonNull ObservableSource<? extends T5> source5, @NonNull ObservableSource<? extends T6> source6, @NonNull Function6<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? extends R> combiner)
ObservableSource
s by emitting an item that aggregates the latest values of each of the
ObservableSource
s each time an item is received from any of the ObservableSource
s, where this
aggregation is defined by a specified function.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.
combineLatest
does not operate by default on a particular Scheduler
.T1
- the element type of the first sourceT2
- the element type of the second sourceT3
- the element type of the third sourceT4
- the element type of the fourth sourceT5
- the element type of the fifth sourceT6
- the element type of the sixth sourceR
- the combined output typesource1
- the first source ObservableSource
source2
- the second source ObservableSource
source3
- the third source ObservableSource
source4
- the fourth source ObservableSource
source5
- the fifth source ObservableSource
source6
- the sixth source ObservableSource
combiner
- the aggregation function used to combine the items emitted by the ObservableSource
sObservable
instanceNullPointerException
- if source1
, source2
, source3
,
source4
, source5
, source6
or combiner
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T1,T2,T3,T4,T5,T6,T7,R> @NonNull Observable<R> combineLatest(@NonNull ObservableSource<? extends T1> source1, @NonNull ObservableSource<? extends T2> source2, @NonNull ObservableSource<? extends T3> source3, @NonNull ObservableSource<? extends T4> source4, @NonNull ObservableSource<? extends T5> source5, @NonNull ObservableSource<? extends T6> source6, @NonNull ObservableSource<? extends T7> source7, @NonNull Function7<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? extends R> combiner)
ObservableSource
s by emitting an item that aggregates the latest values of each of the
ObservableSource
s each time an item is received from any of the ObservableSource
s, where this
aggregation is defined by a specified function.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.
combineLatest
does not operate by default on a particular Scheduler
.T1
- the element type of the first sourceT2
- the element type of the second sourceT3
- the element type of the third sourceT4
- the element type of the fourth sourceT5
- the element type of the fifth sourceT6
- the element type of the sixth sourceT7
- the element type of the seventh sourceR
- the combined output typesource1
- the first source ObservableSource
source2
- the second source ObservableSource
source3
- the third source ObservableSource
source4
- the fourth source ObservableSource
source5
- the fifth source ObservableSource
source6
- the sixth source ObservableSource
source7
- the seventh source ObservableSource
combiner
- the aggregation function used to combine the items emitted by the ObservableSource
sObservable
instanceNullPointerException
- if source1
, source2
, source3
,
source4
, source5
, source6
,
source7
or combiner
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T1,T2,T3,T4,T5,T6,T7,T8,R> @NonNull Observable<R> combineLatest(@NonNull ObservableSource<? extends T1> source1, @NonNull ObservableSource<? extends T2> source2, @NonNull ObservableSource<? extends T3> source3, @NonNull ObservableSource<? extends T4> source4, @NonNull ObservableSource<? extends T5> source5, @NonNull ObservableSource<? extends T6> source6, @NonNull ObservableSource<? extends T7> source7, @NonNull ObservableSource<? extends T8> source8, @NonNull Function8<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? extends R> combiner)
ObservableSource
s by emitting an item that aggregates the latest values of each of the
ObservableSource
s each time an item is received from any of the ObservableSource
s, where this
aggregation is defined by a specified function.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.
combineLatest
does not operate by default on a particular Scheduler
.T1
- the element type of the first sourceT2
- the element type of the second sourceT3
- the element type of the third sourceT4
- the element type of the fourth sourceT5
- the element type of the fifth sourceT6
- the element type of the sixth sourceT7
- the element type of the seventh sourceT8
- the element type of the eighth sourceR
- the combined output typesource1
- the first source ObservableSource
source2
- the second source ObservableSource
source3
- the third source ObservableSource
source4
- the fourth source ObservableSource
source5
- the fifth source ObservableSource
source6
- the sixth source ObservableSource
source7
- the seventh source ObservableSource
source8
- the eighth source ObservableSource
combiner
- the aggregation function used to combine the items emitted by the ObservableSource
sObservable
instanceNullPointerException
- if source1
, source2
, source3
,
source4
, source5
, source6
,
source7
, source8
or combiner
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T1,T2,T3,T4,T5,T6,T7,T8,T9,R> @NonNull Observable<R> combineLatest(@NonNull ObservableSource<? extends T1> source1, @NonNull ObservableSource<? extends T2> source2, @NonNull ObservableSource<? extends T3> source3, @NonNull ObservableSource<? extends T4> source4, @NonNull ObservableSource<? extends T5> source5, @NonNull ObservableSource<? extends T6> source6, @NonNull ObservableSource<? extends T7> source7, @NonNull ObservableSource<? extends T8> source8, @NonNull ObservableSource<? extends T9> source9, @NonNull Function9<? super T1,? super T2,? super T3,? super T4,? super T5,? super T6,? super T7,? super T8,? super T9,? extends R> combiner)
ObservableSource
s by emitting an item that aggregates the latest values of each of the
ObservableSource
s each time an item is received from any of the ObservableSource
s, where this
aggregation is defined by a specified function.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.
combineLatest
does not operate by default on a particular Scheduler
.T1
- the element type of the first sourceT2
- the element type of the second sourceT3
- the element type of the third sourceT4
- the element type of the fourth sourceT5
- the element type of the fifth sourceT6
- the element type of the sixth sourceT7
- the element type of the seventh sourceT8
- the element type of the eighth sourceT9
- the element type of the ninth sourceR
- the combined output typesource1
- the first source ObservableSource
source2
- the second source ObservableSource
source3
- the third source ObservableSource
source4
- the fourth source ObservableSource
source5
- the fifth source ObservableSource
source6
- the sixth source ObservableSource
source7
- the seventh source ObservableSource
source8
- the eighth source ObservableSource
source9
- the ninth source ObservableSource
combiner
- the aggregation function used to combine the items emitted by the ObservableSource
sObservable
instanceNullPointerException
- if source1
, source2
, source3
,
source4
, source5
, source6
,
source7
, source8
, source9
or combiner
is null
@CheckReturnValue @SchedulerSupport(value="none") @NonNull public static <T,R> @NonNull Observable<R> combineLatestArrayDelayError(@NonNull ObservableSource<? extends T>[] sources, @NonNull Function<? super Object[],? extends R> combiner)
ObservableSource
s by emitting an item that aggregates the latest values of each of
the ObservableSource
s each time an item is received from any of the ObservableSource
s, where this
aggregation is defined by a specified function.
Note on method signature: since Java doesn't allow creating a generic array with new T[]
, the
implementation of this operator has to create an Object[]
instead. Unfortunately, a
Function<Integer[], R>
passed to the method would trigger a ClassCastException
.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.
If the provided array of ObservableSource
s is empty, the resulting sequence completes immediately without emitting
any items and without any calls to the combiner function.
combineLatestArrayDelayError
does not operate by default on a particular Scheduler
.T
- the common base type of source valuesR
- the result typesources
- the collection of source ObservableSource
scombiner
- the aggregation function used to combine the items emitted by the ObservableSource
sObservable
instanceNullPointerException
- if sources
or combiner
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T,R> @NonNull Observable<R> combineLatestArrayDelayError(@NonNull ObservableSource<? extends T>[] sources, @NonNull Function<? super Object[],? extends R> combiner, int bufferSize)
ObservableSource
s by emitting an item that aggregates the latest values of each of
the ObservableSource
s each time an item is received from any of the ObservableSource
s, where this
aggregation is defined by a specified function and delays any error from the sources until
all source ObservableSource
s terminate.
Note on method signature: since Java doesn't allow creating a generic array with new T[]
, the
implementation of this operator has to create an Object[]
instead. Unfortunately, a
Function<Integer[], R>
passed to the method would trigger a ClassCastException
.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.
If the provided array of ObservableSource
s is empty, the resulting sequence completes immediately without emitting
any items and without any calls to the combiner function.
combineLatestArrayDelayError
does not operate by default on a particular Scheduler
.T
- the common base type of source valuesR
- the result typesources
- the collection of source ObservableSource
scombiner
- the aggregation function used to combine the items emitted by the ObservableSource
sbufferSize
- the expected number of row combination items to be buffered internallyObservable
instanceNullPointerException
- if sources
or combiner
is null
IllegalArgumentException
- if bufferSize
is non-positive@CheckReturnValue @SchedulerSupport(value="none") @NonNull public static <T,R> @NonNull Observable<R> combineLatestDelayError(@NonNull Iterable<? extends ObservableSource<? extends T>> sources, @NonNull Function<? super Object[],? extends R> combiner)
Iterable
of ObservableSource
s by emitting an item that aggregates the latest values of each of
the ObservableSource
s each time an item is received from any of the ObservableSource
s, where this
aggregation is defined by a specified function and delays any error from the sources until
all source ObservableSource
s terminate.
Note on method signature: since Java doesn't allow creating a generic array with new T[]
, the
implementation of this operator has to create an Object[]
instead. Unfortunately, a
Function<Integer[], R>
passed to the method would trigger a ClassCastException
.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.
If the provided iterable of ObservableSource
s is empty, the resulting sequence completes immediately without emitting
any items and without any calls to the combiner function.
combineLatestDelayError
does not operate by default on a particular Scheduler
.T
- the common base type of source valuesR
- the result typesources
- the Iterable
of source ObservableSource
scombiner
- the aggregation function used to combine the items emitted by the ObservableSource
sObservable
instanceNullPointerException
- if sources
or combiner
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T,R> @NonNull Observable<R> combineLatestDelayError(@NonNull Iterable<? extends ObservableSource<? extends T>> sources, @NonNull Function<? super Object[],? extends R> combiner, int bufferSize)
Iterable
of ObservableSource
s by emitting an item that aggregates the latest values of each of
the ObservableSource
s each time an item is received from any of the ObservableSource
s, where this
aggregation is defined by a specified function and delays any error from the sources until
all source ObservableSource
s terminate.
Note on method signature: since Java doesn't allow creating a generic array with new T[]
, the
implementation of this operator has to create an Object[]
instead. Unfortunately, a
Function<Integer[], R>
passed to the method would trigger a ClassCastException
.
If any of the sources never produces an item but only terminates (normally or with an error), the resulting sequence terminates immediately (normally or with all the errors accumulated till that point). If that input source is also synchronous, other sources after it will not be subscribed to.
If the provided iterable of ObservableSource
s is empty, the resulting sequence completes immediately without emitting
any items and without any calls to the combiner function.
combineLatestDelayError
does not operate by default on a particular Scheduler
.T
- the common base type of source valuesR
- the result typesources
- the collection of source ObservableSource
scombiner
- the aggregation function used to combine the items emitted by the ObservableSource
sbufferSize
- the expected number of row combination items to be buffered internallyObservable
instanceNullPointerException
- if sources
or combiner
is null
IllegalArgumentException
- if bufferSize
is non-positive@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> concat(@NonNull Iterable<? extends ObservableSource<? extends T>> sources)
ObservableSource
provided via an Iterable
sequence into a single sequence
of elements without interleaving them.
concat
does not operate by default on a particular Scheduler
.T
- the common value type of the sourcessources
- the Iterable
sequence of ObservableSource
sObservable
instanceNullPointerException
- if sources
is null
@CheckReturnValue @SchedulerSupport(value="none") @NonNull public static <T> @NonNull Observable<T> concat(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources)
Observable
that emits the items emitted by each of the ObservableSource
s emitted by the
ObservableSource
, one after the other, without interleaving them.
concat
does not operate by default on a particular Scheduler
.T
- the common element base typesources
- an ObservableSource
that emits ObservableSource
sObservable
instanceNullPointerException
- if sources
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> concat(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources, int bufferSize)
Observable
that emits the items emitted by each of the ObservableSource
s emitted by the outer
ObservableSource
, one after the other, without interleaving them.
concat
does not operate by default on a particular Scheduler
.T
- the common element base typesources
- an ObservableSource
that emits ObservableSource
sbufferSize
- the number of inner ObservableSource
s expected to be buffered.Observable
instanceNullPointerException
- if sources
is null
IllegalArgumentException
- if bufferSize
is non-positive@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> concat(@NonNull ObservableSource<? extends T> source1, ObservableSource<? extends T> source2)
Observable
that emits the items emitted by two ObservableSource
s, one after the other, without
interleaving them.
concat
does not operate by default on a particular Scheduler
.T
- the common element base typesource1
- an ObservableSource
to be concatenatedsource2
- an ObservableSource
to be concatenatedObservable
instanceNullPointerException
- if source1
or source2
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> concat(@NonNull ObservableSource<? extends T> source1, @NonNull ObservableSource<? extends T> source2, @NonNull ObservableSource<? extends T> source3)
Observable
that emits the items emitted by three ObservableSource
s, one after the other, without
interleaving them.
concat
does not operate by default on a particular Scheduler
.T
- the common element base typesource1
- an ObservableSource
to be concatenatedsource2
- an ObservableSource
to be concatenatedsource3
- an ObservableSource
to be concatenatedObservable
instanceNullPointerException
- if source1
, source2
or source3
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> concat(@NonNull ObservableSource<? extends T> source1, @NonNull ObservableSource<? extends T> source2, @NonNull ObservableSource<? extends T> source3, @NonNull ObservableSource<? extends T> source4)
Observable
that emits the items emitted by four ObservableSource
s, one after the other, without
interleaving them.
concat
does not operate by default on a particular Scheduler
.T
- the common element base typesource1
- an ObservableSource
to be concatenatedsource2
- an ObservableSource
to be concatenatedsource3
- an ObservableSource
to be concatenatedsource4
- an ObservableSource
to be concatenatedObservable
instanceNullPointerException
- if source1
, source2
, source3
or source4
is null
@CheckReturnValue @SchedulerSupport(value="none") @NonNull @SafeVarargs public static <T> @NonNull Observable<T> concatArray(@NonNull ObservableSource<? extends T>... sources)
ObservableSource
sources.
Note: named this way because of overload conflict with concat(ObservableSource<ObservableSource>)
concatArray
does not operate by default on a particular Scheduler
.T
- the common base value typesources
- the array of sourcesObservable
instanceNullPointerException
- if sources
is null
@CheckReturnValue @SchedulerSupport(value="none") @NonNull @SafeVarargs public static <T> @NonNull Observable<T> concatArrayDelayError(@NonNull ObservableSource<? extends T>... sources)
ObservableSource
sources and delays errors from any of them
till all terminate.
concatArrayDelayError
does not operate by default on a particular Scheduler
.T
- the common base value typesources
- the array of sourcesObservable
instanceNullPointerException
- if sources
is null
@CheckReturnValue @SchedulerSupport(value="none") @SafeVarargs @NonNull public static <T> @NonNull Observable<T> concatArrayEager(@NonNull ObservableSource<? extends T>... sources)
ObservableSource
s eagerly into a single stream of values.
Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the
ObservableSource
s. The operator buffers the values emitted by these ObservableSource
s and then drains them
in order, each one after the previous one completes.
Scheduler
.T
- the value typesources
- an array of ObservableSource
s that need to be eagerly concatenatedObservable
instance with the specified concatenation behaviorNullPointerException
- if sources
is null
@CheckReturnValue @SchedulerSupport(value="none") @NonNull @SafeVarargs public static <T> @NonNull Observable<T> concatArrayEager(int maxConcurrency, int bufferSize, @NonNull ObservableSource<? extends T>... sources)
ObservableSource
s eagerly into a single stream of values.
Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the
ObservableSource
s. The operator buffers the values emitted by these ObservableSource
s and then drains them
in order, each one after the previous one completes.
Scheduler
.T
- the value typesources
- an array of ObservableSource
s that need to be eagerly concatenatedmaxConcurrency
- the maximum number of concurrent subscriptions at a time, Integer.MAX_VALUE
is interpreted as indication to subscribe to all sources at oncebufferSize
- the number of elements expected from each ObservableSource
to be bufferedObservable
instance with the specified concatenation behaviorNullPointerException
- if sources
is null
IllegalArgumentException
- if maxConcurrency
or bufferSize
is non-positive@CheckReturnValue @SchedulerSupport(value="none") @SafeVarargs @NonNull public static <T> @NonNull Observable<T> concatArrayEagerDelayError(@NonNull ObservableSource<? extends T>... sources)
ObservableSource
s eagerly into a single stream of values
and delaying any errors until all sources terminate.
Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the
ObservableSource
s. The operator buffers the values emitted by these ObservableSource
s
and then drains them in order, each one after the previous one completes.
Scheduler
.T
- the value typesources
- an array of ObservableSource
s that need to be eagerly concatenatedObservable
instance with the specified concatenation behaviorNullPointerException
- if sources
is null
@CheckReturnValue @SchedulerSupport(value="none") @NonNull @SafeVarargs public static <T> @NonNull Observable<T> concatArrayEagerDelayError(int maxConcurrency, int bufferSize, @NonNull ObservableSource<? extends T>... sources)
ObservableSource
s eagerly into a single stream of values
and delaying any errors until all sources terminate.
Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the
ObservableSource
s. The operator buffers the values emitted by these ObservableSource
s
and then drains them in order, each one after the previous one completes.
Scheduler
.T
- the value typesources
- an array of ObservableSource
s that need to be eagerly concatenatedmaxConcurrency
- the maximum number of concurrent subscriptions at a time, Integer.MAX_VALUE
is interpreted as indication to subscribe to all sources at oncebufferSize
- the number of elements expected from each ObservableSource
to be bufferedObservable
instance with the specified concatenation behaviorNullPointerException
- if sources
is null
IllegalArgumentException
- if maxConcurrency
or bufferSize
is non-positive@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> concatDelayError(@NonNull Iterable<? extends ObservableSource<? extends T>> sources)
Iterable
sequence of ObservableSource
s into a single Observable
sequence
by subscribing to each ObservableSource
, one after the other, one at a time and delays any errors till
the all inner ObservableSource
s terminate.
concatDelayError
does not operate by default on a particular Scheduler
.T
- the common element base typesources
- the Iterable
sequence of ObservableSource
sObservable
with the concatenating behaviorNullPointerException
- if sources
is null
@CheckReturnValue @SchedulerSupport(value="none") @NonNull public static <T> @NonNull Observable<T> concatDelayError(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources)
ObservableSource
sequence of ObservableSource
s into a single Observable
sequence
by subscribing to each inner ObservableSource
, one after the other, one at a time and delays any errors till the
all inner and the outer ObservableSource
s terminate.
concatDelayError
does not operate by default on a particular Scheduler
.T
- the common element base typesources
- the ObservableSource
sequence of ObservableSource
sObservable
with the concatenating behaviorNullPointerException
- if sources
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> concatDelayError(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources, int bufferSize, boolean tillTheEnd)
ObservableSource
sequence of ObservableSource
s into a single sequence by subscribing to each inner ObservableSource
,
one after the other, one at a time and delays any errors till the all inner and the outer ObservableSource
s terminate.
concatDelayError
does not operate by default on a particular Scheduler
.T
- the common element base typesources
- the ObservableSource
sequence of ObservableSource
sbufferSize
- the number of inner ObservableSource
s expected to be bufferedtillTheEnd
- if true
, exceptions from the outer and all inner ObservableSource
s are delayed to the end
if false
, exception from the outer ObservableSource
is delayed till the active ObservableSource
terminatesObservable
with the concatenating behaviorNullPointerException
- if sources
is null
IllegalArgumentException
- if bufferSize
is non-positive@CheckReturnValue @SchedulerSupport(value="none") @NonNull public static <T> @NonNull Observable<T> concatEager(@NonNull Iterable<? extends ObservableSource<? extends T>> sources)
ObservableSource
s eagerly into a single stream of values.
Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the
ObservableSource
s. The operator buffers the values emitted by these ObservableSource
s and then drains them
in order, each one after the previous one completes.
Scheduler
.T
- the value typesources
- a sequence of ObservableSource
s that need to be eagerly concatenatedObservable
instance with the specified concatenation behaviorNullPointerException
- if sources
is null
@CheckReturnValue @SchedulerSupport(value="none") @NonNull public static <T> @NonNull Observable<T> concatEager(@NonNull Iterable<? extends ObservableSource<? extends T>> sources, int maxConcurrency, int bufferSize)
ObservableSource
s eagerly into a single stream of values and
runs a limited number of inner sequences at once.
Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the
ObservableSource
s. The operator buffers the values emitted by these ObservableSource
s and then drains them
in order, each one after the previous one completes.
Scheduler
.T
- the value typesources
- a sequence of ObservableSource
s that need to be eagerly concatenatedmaxConcurrency
- the maximum number of concurrently running inner ObservableSource
s; Integer.MAX_VALUE
is interpreted as all inner ObservableSource
s can be active at the same timebufferSize
- the number of elements expected from each inner ObservableSource
to be bufferedObservable
instance with the specified concatenation behaviorNullPointerException
- if sources
is null
IllegalArgumentException
- if maxConcurrency
or bufferSize
is non-positive@CheckReturnValue @SchedulerSupport(value="none") @NonNull public static <T> @NonNull Observable<T> concatEager(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources)
ObservableSource
sequence of ObservableSource
s eagerly into a single stream of values.
Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the
emitted source ObservableSource
s as they are observed. The operator buffers the values emitted by these
ObservableSource
s and then drains them in order, each one after the previous one completes.
Scheduler
.T
- the value typesources
- a sequence of ObservableSource
s that need to be eagerly concatenatedObservable
instance with the specified concatenation behaviorNullPointerException
- if sources
is null
@CheckReturnValue @SchedulerSupport(value="none") @NonNull public static <T> @NonNull Observable<T> concatEager(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources, int maxConcurrency, int bufferSize)
ObservableSource
sequence of ObservableSource
s eagerly into a single stream of values
and runs a limited number of inner sequences at once.
Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the
emitted source ObservableSource
s as they are observed. The operator buffers the values emitted by these
ObservableSource
s and then drains them in order, each one after the previous one completes.
Scheduler
.T
- the value typesources
- a sequence of ObservableSource
s that need to be eagerly concatenatedmaxConcurrency
- the maximum number of concurrently running inner ObservableSource
s; Integer.MAX_VALUE
is interpreted as all inner ObservableSource
s can be active at the same timebufferSize
- the number of inner ObservableSource
expected to be bufferedObservable
instance with the specified concatenation behaviorNullPointerException
- if sources
is null
IllegalArgumentException
- if maxConcurrency
or bufferSize
is non-positive@CheckReturnValue @SchedulerSupport(value="none") @NonNull public static <T> @NonNull Observable<T> concatEagerDelayError(@NonNull Iterable<? extends ObservableSource<? extends T>> sources)
ObservableSource
s eagerly into a single stream of values,
delaying errors until all the inner sequences terminate.
Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the
ObservableSource
s. The operator buffers the values emitted by these ObservableSource
s and then drains them
in order, each one after the previous one completes.
Scheduler
.T
- the value typesources
- a sequence of ObservableSource
s that need to be eagerly concatenatedObservable
instance with the specified concatenation behaviorNullPointerException
- if sources
is null
@CheckReturnValue @SchedulerSupport(value="none") @NonNull public static <T> @NonNull Observable<T> concatEagerDelayError(@NonNull Iterable<? extends ObservableSource<? extends T>> sources, int maxConcurrency, int bufferSize)
ObservableSource
s eagerly into a single stream of values,
delaying errors until all the inner sequences terminate and runs a limited number of inner
sequences at once.
Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the
ObservableSource
s. The operator buffers the values emitted by these ObservableSource
s and then drains them
in order, each one after the previous one completes.
Scheduler
.T
- the value typesources
- a sequence of ObservableSource
s that need to be eagerly concatenatedmaxConcurrency
- the maximum number of concurrently running inner ObservableSource
s; Integer.MAX_VALUE
is interpreted as all inner ObservableSource
s can be active at the same timebufferSize
- the number of elements expected from each inner ObservableSource
to be bufferedObservable
instance with the specified concatenation behaviorNullPointerException
- if sources
is null
IllegalArgumentException
- if maxConcurrency
or bufferSize
is non-positive@CheckReturnValue @SchedulerSupport(value="none") @NonNull public static <T> @NonNull Observable<T> concatEagerDelayError(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources)
ObservableSource
sequence of ObservableSource
s eagerly into a single stream of values,
delaying errors until all the inner and the outer sequence terminate.
Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the
emitted source ObservableSource
s as they are observed. The operator buffers the values emitted by these
ObservableSource
s and then drains them in order, each one after the previous one completes.
Scheduler
.T
- the value typesources
- a sequence of ObservableSource
s that need to be eagerly concatenatedObservable
instance with the specified concatenation behaviorNullPointerException
- if sources
is null
@CheckReturnValue @SchedulerSupport(value="none") @NonNull public static <T> @NonNull Observable<T> concatEagerDelayError(@NonNull ObservableSource<? extends ObservableSource<? extends T>> sources, int maxConcurrency, int bufferSize)
ObservableSource
sequence of ObservableSource
s eagerly into a single stream of values,
delaying errors until all the inner and the outer sequence terminate and runs a limited number of inner sequences at once.
Eager concatenation means that once a subscriber subscribes, this operator subscribes to all of the
emitted source ObservableSource
s as they are observed. The operator buffers the values emitted by these
ObservableSource
s and then drains them in order, each one after the previous one completes.
Scheduler
.T
- the value typesources
- a sequence of ObservableSource
s that need to be eagerly concatenatedmaxConcurrency
- the maximum number of concurrently running inner ObservableSource
s; Integer.MAX_VALUE
is interpreted as all inner ObservableSource
s can be active at the same timebufferSize
- the number of inner ObservableSource
expected to be bufferedObservable
instance with the specified concatenation behaviorNullPointerException
- if sources
is null
IllegalArgumentException
- if maxConcurrency
or bufferSize
is non-positive@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> create(@NonNull ObservableOnSubscribe<T> source)
Observable
) that bridges the reactive world with the callback-style world.
Example:
Observable.<Event>create(emitter -> {
Callback listener = new Callback() {
@Override
public void onEvent(Event e) {
emitter.onNext(e);
if (e.isLast()) {
emitter.onComplete();
}
}
@Override
public void onFailure(Exception e) {
emitter.onError(e);
}
};
AutoCloseable c = api.someMethod(listener);
emitter.setCancellable(c::close);
});
Whenever an Observer
subscribes to the returned Observable
, the provided
ObservableOnSubscribe
callback is invoked with a fresh instance of an ObservableEmitter
that will interact only with that specific Observer
. If this Observer
disposes the flow (making ObservableEmitter.isDisposed()
return true
),
other observers subscribed to the same returned Observable
are not affected.
You should call the ObservableEmitter
's onNext
, onError
and onComplete
methods in a serialized fashion. The
rest of its methods are thread-safe.
create
does not operate by default on a particular Scheduler
.T
- the element typesource
- the emitter that is called when an Observer
subscribes to the returned Observable
Observable
instanceNullPointerException
- if source
is null
ObservableOnSubscribe
,
ObservableEmitter
,
Cancellable
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> defer(@NonNull Supplier<? extends ObservableSource<? extends T>> supplier)
Observable
that calls an ObservableSource
factory to create an ObservableSource
for each new Observer
that subscribes. That is, for each subscriber, the actual ObservableSource
that subscriber observes is
determined by the factory function.
The defer
operator allows you to defer or delay emitting items from an ObservableSource
until such time as an
Observer
subscribes to the ObservableSource
. This allows an Observer
to easily obtain updates or a
refreshed version of the sequence.
defer
does not operate by default on a particular Scheduler
.T
- the type of the items emitted by the ObservableSource
supplier
- the ObservableSource
factory function to invoke for each Observer
that subscribes to the
resulting Observable
Observable
instanceNullPointerException
- if supplier
is null
@CheckReturnValue @SchedulerSupport(value="none") @NonNull public static <T> @NonNull Observable<T> empty()
Observable
that emits no items to the Observer
and immediately invokes its
onComplete
method.
empty
does not operate by default on a particular Scheduler
.T
- the type of the items (ostensibly) emitted by the Observable
Observable
instance@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> error(@NonNull Supplier<? extends Throwable> supplier)
Observable
that invokes an Observer
's onError
method when the
Observer
subscribes to it.
error
does not operate by default on a particular Scheduler
.T
- the type of the items (ostensibly) emitted by the Observable
supplier
- a Supplier
factory to return a Throwable
for each individual Observer
Observable
instanceNullPointerException
- if supplier
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> error(@NonNull Throwable throwable)
Observable
that invokes an Observer
's onError
method when the
Observer
subscribes to it.
error
does not operate by default on a particular Scheduler
.T
- the type of the items (ostensibly) emitted by the Observable
throwable
- the particular Throwable
to pass to onError
Observable
instanceNullPointerException
- if throwable
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> fromAction(@NonNull Action action)
Observable
instance that runs the given Action
for each Observer
and
emits either its exception or simply completes.
fromAction
does not operate by default on a particular Scheduler
.Action
throws an exception, the respective Throwable
is
delivered to the downstream via Observer.onError(Throwable)
,
except when the downstream has canceled the resulting Observable
source.
In this latter case, the Throwable
is delivered to the global error handler via
RxJavaPlugins.onError(Throwable)
as an UndeliverableException
.
T
- the target typeaction
- the Action
to run for each Observer
Observable
instanceNullPointerException
- if action
is null
@CheckReturnValue @SchedulerSupport(value="none") @NonNull @SafeVarargs public static <T> @NonNull Observable<T> fromArray(@NonNull T... items)
ObservableSource
that emits the items in the array.
fromArray
does not operate by default on a particular Scheduler
.T
- the type of items in the array and the type of items to be emitted by the resulting Observable
items
- the array of elementsObservable
instanceNullPointerException
- if items
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> fromCallable(@NonNull Callable<? extends T> callable)
Observable
that, when an observer subscribes to it, invokes a function you specify and then
emits the value returned from that function.
This allows you to defer the execution of the function you specify until an observer subscribes to the
Observable
. That is to say, it makes the function "lazy."
fromCallable
does not operate by default on a particular Scheduler
.Callable
throws an exception, the respective Throwable
is
delivered to the downstream via Observer.onError(Throwable)
,
except when the downstream has disposed the current Observable
source.
In this latter case, the Throwable
is delivered to the global error handler via
RxJavaPlugins.onError(Throwable)
as an UndeliverableException
.
T
- the type of the item returned by the Callable
and emitted by the Observable
callable
- a function, the execution of which should be deferred; fromCallable
will invoke this
function only when an observer subscribes to the Observable
that fromCallable
returnsObservable
instanceNullPointerException
- if callable
is null
defer(Supplier)
,
fromSupplier(Supplier)
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> fromCompletable(@NonNull CompletableSource completableSource)
CompletableSource
into an Observable
.
fromCompletable
does not operate by default on a particular Scheduler
.T
- the target typecompletableSource
- the CompletableSource
to convert fromObservable
instanceNullPointerException
- if completableSource
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> fromFuture(@NonNull Future<? extends T> future)
Future
into an Observable
.
The operator calls Future.get()
, which is a blocking method, on the subscription thread.
It is recommended applying subscribeOn(Scheduler)
to move this blocking wait to a
background thread, and if the Scheduler
supports it, interrupt the wait when the flow
is disposed.
Unlike 1.x, disposing the Observable
won't cancel the future. If necessary, one can use composition to achieve the
cancellation effect: futureObservableSource.doOnDispose(() -> future.cancel(true));
.
Also note that this operator will consume a CompletionStage
-based Future
subclass (such as
CompletableFuture
) in a blocking manner as well. Use the fromCompletionStage(CompletionStage)
operator to convert and consume such sources in a non-blocking fashion instead.
fromFuture
does not operate by default on a particular Scheduler
.T
- the type of object that the Future
returns, and also the type of item to be emitted by
the resulting Observable
future
- the source Future
Observable
instanceNullPointerException
- if future
is null
fromCompletionStage(CompletionStage)
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> fromFuture(@NonNull Future<? extends T> future, long timeout, @NonNull TimeUnit unit)
Future
into an Observable
, with a timeout on the Future
.
The operator calls Future.get(long, TimeUnit)
, which is a blocking method, on the subscription thread.
It is recommended applying subscribeOn(Scheduler)
to move this blocking wait to a
background thread, and if the Scheduler
supports it, interrupt the wait when the flow
is disposed.
Unlike 1.x, disposing the Observable
won't cancel the future. If necessary, one can use composition to achieve the
cancellation effect: futureObservableSource.doOnDispose(() -> future.cancel(true));
.
Also note that this operator will consume a CompletionStage
-based Future
subclass (such as
CompletableFuture
) in a blocking manner as well. Use the fromCompletionStage(CompletionStage)
operator to convert and consume such sources in a non-blocking fashion instead.
fromFuture
does not operate by default on a particular Scheduler
.T
- the type of object that the Future
returns, and also the type of item to be emitted by
the resulting Observable
future
- the source Future
timeout
- the maximum time to wait before calling get
unit
- the TimeUnit
of the timeout
argumentObservable
instanceNullPointerException
- if future
or unit
is null
fromCompletionStage(CompletionStage)
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> fromIterable(@NonNull Iterable<? extends T> source)
Iterable
sequence into an Observable
that emits the items in the sequence.
fromIterable
does not operate by default on a particular Scheduler
.T
- the type of items in the Iterable
sequence and the type of items to be emitted by the
resulting Observable
source
- the source Iterable
sequenceObservable
instanceNullPointerException
- if source
is null
fromStream(Stream)
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> fromMaybe(@NonNull MaybeSource<T> maybe)
Observable
instance that when subscribed to, subscribes to the MaybeSource
instance and
emits onSuccess
as a single item or forwards any onComplete
or
onError
signal.
fromMaybe
does not operate by default on a particular Scheduler
.T
- the value type of the MaybeSource
elementmaybe
- the MaybeSource
instance to subscribe to, not null
Observable
instanceNullPointerException
- if maybe
is null
@BackpressureSupport(value=UNBOUNDED_IN) @CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> fromPublisher(@NonNull Publisher<? extends T> publisher)
Publisher
into an Observable
.
The Publisher
must follow the
Reactive-Streams specification.
Violating the specification may result in undefined behavior.
If possible, use create(ObservableOnSubscribe)
to create a
source-like Observable
instead.
Note that even though Publisher
appears to be a functional interface, it
is not recommended to implement it through a lambda as the specification requires
state management that is not achievable with a stateless lambda.
publisher
is consumed in an unbounded fashion without applying any
backpressure to it.fromPublisher
does not operate by default on a particular Scheduler
.T
- the value type of the flowpublisher
- the Publisher
to convertObservable
instanceNullPointerException
- if publisher
is null
create(ObservableOnSubscribe)
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> fromRunnable(@NonNull Runnable run)
Observable
instance that runs the given Runnable
for each Observer
and
emits either its unchecked exception or simply completes.
If the code to be wrapped needs to throw a checked or more broader Throwable
exception, that
exception has to be converted to an unchecked exception by the wrapped code itself. Alternatively,
use the fromAction(Action)
method which allows the wrapped code to throw any Throwable
exception and will signal it to observers as-is.
fromRunnable
does not operate by default on a particular Scheduler
.Runnable
throws an exception, the respective Throwable
is
delivered to the downstream via Observer.onError(Throwable)
,
except when the downstream has canceled the resulting Observable
source.
In this latter case, the Throwable
is delivered to the global error handler via
RxJavaPlugins.onError(Throwable)
as an UndeliverableException
.
T
- the target typerun
- the Runnable
to run for each Observer
Observable
instanceNullPointerException
- if run
is null
fromAction(Action)
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> fromSingle(@NonNull SingleSource<T> source)
Observable
instance that when subscribed to, subscribes to the SingleSource
instance and
emits onSuccess
as a single item or forwards the onError
signal.
fromSingle
does not operate by default on a particular Scheduler
.T
- the value type of the SingleSource
elementsource
- the SingleSource
instance to subscribe to, not null
Observable
instanceNullPointerException
- if source
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> fromSupplier(@NonNull Supplier<? extends T> supplier)
Observable
that, when an observer subscribes to it, invokes a supplier function you specify and then
emits the value returned from that function.
This allows you to defer the execution of the function you specify until an observer subscribes to the
Observable
. That is to say, it makes the function "lazy."
fromSupplier
does not operate by default on a particular Scheduler
.Supplier
throws an exception, the respective Throwable
is
delivered to the downstream via Observer.onError(Throwable)
,
except when the downstream has disposed the current Observable
source.
In this latter case, the Throwable
is delivered to the global error handler via
RxJavaPlugins.onError(Throwable)
as an UndeliverableException
.
T
- the type of the item emitted by the Observable
supplier
- a function, the execution of which should be deferred; fromSupplier
will invoke this
function only when an observer subscribes to the Observable
that fromSupplier
returnsObservable
instanceNullPointerException
- if supplier
is null
defer(Supplier)
,
fromCallable(Callable)
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T> @NonNull Observable<T> generate(@NonNull Consumer<Emitter<T>> generator)
Note that the Emitter.onNext(T)
, Emitter.onError(java.lang.Throwable)
and
Emitter.onComplete()
methods provided to the function via the Emitter
instance should be called synchronously,
never concurrently and only while the function body is executing. Calling them from multiple threads
or outside the function call is not supported and leads to an undefined behavior.
generate
does not operate by default on a particular Scheduler
.T
- the generated value typegenerator
- the Consumer
called in a loop after a downstream Observer
has
subscribed. The callback then should call onNext
, onError
or
onComplete
to signal a value or a terminal event. Signaling multiple onNext
in a call will make the operator signal IllegalStateException
.Observable
instanceNullPointerException
- if generator
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T,S> @NonNull Observable<T> generate(@NonNull Supplier<S> initialState, @NonNull BiConsumer<S,Emitter<T>> generator)
Note that the Emitter.onNext(T)
, Emitter.onError(java.lang.Throwable)
and
Emitter.onComplete()
methods provided to the function via the Emitter
instance should be called synchronously,
never concurrently and only while the function body is executing. Calling them from multiple threads
or outside the function call is not supported and leads to an undefined behavior.
generate
does not operate by default on a particular Scheduler
.S
- the type of the per-Observer
stateT
- the generated value typeinitialState
- the Supplier
to generate the initial state for each Observer
generator
- the BiConsumer
called in a loop after a downstream Observer
has
subscribed. The callback then should call onNext
, onError
or
onComplete
to signal a value or a terminal event. Signaling multiple onNext
in a call will make the operator signal IllegalStateException
.Observable
instanceNullPointerException
- if initialState
or generator
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T,S> @NonNull Observable<T> generate(@NonNull Supplier<S> initialState, @NonNull BiConsumer<S,Emitter<T>> generator, @NonNull Consumer<? super S> disposeState)
Note that the Emitter.onNext(T)
, Emitter.onError(java.lang.Throwable)
and
Emitter.onComplete()
methods provided to the function via the Emitter
instance should be called synchronously,
never concurrently and only while the function body is executing. Calling them from multiple threads
or outside the function call is not supported and leads to an undefined behavior.
generate
does not operate by default on a particular Scheduler
.S
- the type of the per-Observer
stateT
- the generated value typeinitialState
- the Supplier
to generate the initial state for each Observer
generator
- the BiConsumer
called in a loop after a downstream Observer
has
subscribed. The callback then should call onNext
, onError
or
onComplete
to signal a value or a terminal event. Signaling multiple onNext
in a call will make the operator signal IllegalStateException
.disposeState
- the Consumer
that is called with the current state when the generator
terminates the sequence or it gets disposedObservable
instanceNullPointerException
- if initialState
, generator
or disposeState
is null
@CheckReturnValue @SchedulerSupport(value="none") @NonNull public static <T,S> @NonNull Observable<T> generate(@NonNull Supplier<S> initialState, @NonNull BiFunction<S,Emitter<T>,S> generator)
Note that the Emitter.onNext(T)
, Emitter.onError(java.lang.Throwable)
and
Emitter.onComplete()
methods provided to the function via the Emitter
instance should be called synchronously,
never concurrently and only while the function body is executing. Calling them from multiple threads
or outside the function call is not supported and leads to an undefined behavior.
generate
does not operate by default on a particular Scheduler
.S
- the type of the per-Observer
stateT
- the generated value typeinitialState
- the Supplier
to generate the initial state for each Observer
generator
- the BiConsumer
called in a loop after a downstream Observer
has
subscribed. The callback then should call onNext
, onError
or
onComplete
to signal a value or a terminal event and should return a (new) state for
the next invocation. Signaling multiple onNext
in a call will make the operator signal IllegalStateException
.Observable
instanceNullPointerException
- if initialState
or generator
is null
@CheckReturnValue @NonNull @SchedulerSupport(value="none") public static <T,S> @NonNull Observable<T> generate(@NonNull Supplier<S> initialState, @NonNull BiFunction<S,Emitter<T>,S> generator, @NonNull Consumer<? super S> disposeState)
Note that the Emitter.onNext(T)
, Emitter.onError(java.lang.Throwable)
and
Emitter.onComplete()
methods provided to the function via the Emitter
instance should be called synchronously,
never concurrently and only while the function body is executing. Calling them from multiple threads
or outside the function call is not supported and leads to an undefined behavior.
generate
does not operate by default on a particular Scheduler
.