T - the type of the items emitted by the Observable
public class Observable<T> extends Object
This class provides methods for subscribing to the Observable as well as delegate methods to the various Observers.
The documentation for this class makes use of marble diagrams. The following legend explains these diagrams:
For more information see the RxJava wiki
| Modifier and Type | Class and Description |
|---|---|
static interface |
Observable
Invoked when Obserable.subscribe is called.
|
static interface |
Observable
Operator function for lifting into an Observable.
|
static interface |
Observable
Transformer function used by
compose(rx.Observable.Transformer<? super T, ? extends R>).
|
| Modifier | Constructor and Description |
|---|---|
protected |
Observable(Observable
Creates an Observable with a Function to execute when it is subscribed to.
|
| Modifier and Type | Method and Description |
|---|---|
Observable |
all(Func1
Returns an Observable that emits a Boolean that indicates whether all of the items emitted by the source Observable satisfy a condition.
|
static <T> Observable |
amb(Iterable
Mirrors the one Observable in an Iterable of several Observables that first emits an item.
|
static <T> Observable |
amb(Observable
Given two Observables, mirrors the one that first emits an item.
|
static <T> Observable |
amb(Observable
Given three Observables, mirrors the one that first emits an item.
|
static <T> Observable |
amb(Observable
Given four Observables, mirrors the one that first emits an item.
|
static <T> Observable |
amb(Observable
Given five Observables, mirrors the one that first emits an item.
|
static <T> Observable |
amb(Observable
Given six Observables, mirrors the one that first emits an item.
|
static <T> Observable |
amb(Observable
Given seven Observables, mirrors the one that first emits an item.
|
static <T> Observable |
amb(Observable
Given eight Observables, mirrors the one that first emits an item.
|
static <T> Observable |
amb(Observable
Given nine Observables, mirrors the one that first emits an item.
|
Observable |
ambWith(Observable
Mirrors the first Observable (current or provided) that emits an item.
|
Observable |
asObservable()
Portrays a object of an Observable subclass as a simple Observable object.
|
<TClosing> Observable |
buffer(Func0
Returns an Observable that emits buffers of items it collects from the source Observable.
|
Observable |
buffer(int count)
Returns an Observable that emits buffers of items it collects from the source Observable.
|
Observable |
buffer(int count, int skip)
Returns an Observable that emits buffers of items it collects from the source Observable.
|
Observable |
buffer(long timespan, long timeshift, TimeUnit
Returns an Observable that emits buffers of items it collects from the source Observable.
|
Observable |
buffer(long timespan, long timeshift, TimeUnit
Returns an Observable that emits buffers of items it collects from the source Observable.
|
Observable |
buffer(long timespan, TimeUnit
Returns an Observable that emits buffers of items it collects from the source Observable.
|
Observable |
buffer(long timespan, TimeUnit
Returns an Observable that emits buffers of items it collects from the source Observable.
|
Observable |
buffer(long timespan, TimeUnit
Returns an Observable that emits buffers of items it collects from the source Observable.
|
Observable |
buffer(long timespan, TimeUnit
Returns an Observable that emits buffers of items it collects from the source Observable.
|
<TOpening |
buffer(Observable
Returns an Observable that emits buffers of items it collects from the source Observable.
|
<B> Observable |
buffer(Observable
Returns an Observable that emits non-overlapping buffered items from the source Observable each time the specified boundary Observable emits an item.
|
<B> Observable |
buffer(Observable
Returns an Observable that emits non-overlapping buffered items from the source Observable each time the specified boundary Observable emits an item.
|
Observable |
cache()
Caches the emissions from the source Observable and replays them in order to any subsequent Subscribers.
|
Observable |
cache(int capacity)
Caches emissions from the source Observable and replays them in order to any subsequent Subscribers.
|
<R> Observable |
cast(Class
Returns an Observable that emits the items emitted by the source Observable, converted to the specified type.
|
<R> Observable |
collect(Func0
Collects items emitted by the source Observable into a single mutable data structure and returns an Observable that emits this structure.
|
static <T |
combineLatest(List
Combines a list of source Observables by emitting an item that aggregates the latest values of each of the source Observables each time an item is received from any of the source Observables, where this aggregation is defined by a specified function.
|
static <T1 |
combineLatest(Observable
Combines two source Observables by emitting an item that aggregates the latest values of each of the source Observables each time an item is received from either of the source Observables, where this aggregation is defined by a specified function.
|
static <T1 |
combineLatest(Observable
Combines three source Observables by emitting an item that aggregates the latest values of each of the source Observables each time an item is received from any of the source Observables, where this aggregation is defined by a specified function.
|
static <T1 |
combineLatest(Observable
Combines four source Observables by emitting an item that aggregates the latest values of each of the source Observables each time an item is received from any of the source Observables, where this aggregation is defined by a specified function.
|
static <T1 |
combineLatest(Observable
Combines five source Observables by emitting an item that aggregates the latest values of each of the source Observables each time an item is received from any of the source Observables, where this aggregation is defined by a specified function.
|
static <T1 |
combineLatest(Observable
Combines six source Observables by emitting an item that aggregates the latest values of each of the source Observables each time an item is received from any of the source Observables, where this aggregation is defined by a specified function.
|
static <T1 |
combineLatest(Observable
Combines seven source Observables by emitting an item that aggregates the latest values of each of the source Observables each time an item is received from any of the source Observables, where this aggregation is defined by a specified function.
|
static <T1 |
combineLatest(Observable
Combines eight source Observables by emitting an item that aggregates the latest values of each of the source Observables each time an item is received from any of the source Observables, where this aggregation is defined by a specified function.
|
static <T1 |
combineLatest(Observable
Combines nine source Observables by emitting an item that aggregates the latest values of each of the source Observables each time an item is received from any of the source Observables, where this aggregation is defined by a specified function.
|
<R> Observable |
compose(Observable
Transform an Observable by applying a particular Transformer function to it.
|
static <T> Observable |
concat(Observable
Returns an Observable that emits the items emitted by each of the Observables emitted by the source Observable, one after the other, without interleaving them.
|
static <T> Observable |
concat(Observable
Returns an Observable that emits the items emitted by two Observables, one after the other, without interleaving them.
|
static <T> Observable |
concat(Observable
Returns an Observable that emits the items emitted by three Observables, one after the other, without interleaving them.
|
static <T> Observable |
concat(Observable
Returns an Observable that emits the items emitted by four Observables, one after the other, without interleaving them.
|
static <T> Observable |
concat(Observable
Returns an Observable that emits the items emitted by five Observables, one after the other, without interleaving them.
|
static <T> Observable |
concat(Observable
Returns an Observable that emits the items emitted by six Observables, one after the other, without interleaving them.
|
static <T> Observable |
concat(Observable
Returns an Observable that emits the items emitted by seven Observables, one after the other, without interleaving them.
|
static <T> Observable |
concat(Observable
Returns an Observable that emits the items emitted by eight Observables, one after the other, without interleaving them.
|
static <T> Observable |
concat(Observable
Returns an Observable that emits the items emitted by nine Observables, one after the other, without interleaving them.
|
<R> Observable |
concatMap(Func1
Returns a new Observable that emits items resulting from applying a function that you supply to each item emitted by the source Observable, where that function returns an Observable, and then emitting the items that result from concatinating those resulting Observables.
|
Observable |
concatWith(Observable
Returns an Observable that emits the items emitted from the current Observable, then the next, one after the other, without interleaving them.
|
Observable |
contains(Object
Returns an Observable that emits a Boolean that indicates whether the source Observable emitted a specified item.
|
Observable |
count()
Returns an Observable that emits the count of the total number of items emitted by the source Observable.
|
Observable |
countLong()
Returns an Observable that counts the total number of items emitted by the source Observable and emits this count as a 64-bit Long.
|
static <T> Observable |
create(Observable
Returns an Observable that will execute the specified function when a
Subscriber subscribes to it.
|
<U> Observable |
debounce(Func1
Returns an Observable that mirrors the source Observable, except that it drops items emitted by the source Observable that are followed by another item within a computed debounce duration.
|
Observable |
debounce(long timeout, TimeUnit
Returns an Observable that mirrors the source Observable, except that it drops items emitted by the source Observable that are followed by newer items before a timeout value expires.
|
Observable |
debounce(long timeout, TimeUnit
Returns an Observable that mirrors the source Observable, except that it drops items emitted by the source Observable that are followed by newer items before a timeout value expires on a specified Scheduler.
|
Observable |
defaultIfEmpty(T defaultValue)
Returns an Observable that emits the items emitted by the source Observable or a specified default item if the source Observable is empty.
|
static <T> Observable |
defer(Func0
Returns an Observable that calls an Observable factory to create an Observable for each new Observer that subscribes.
|
<U |
delay(Func0
Returns an Observable that delays the subscription to and emissions from the souce Observable via another Observable on a per-item basis.
|
<U> Observable |
delay(Func1
Returns an Observable that delays the emissions of the source Observable via another Observable on a per-item basis.
|
Observable |
delay(long delay, TimeUnit
Returns an Observable that emits the items emitted by the source Observable shifted forward in time by a specified delay.
|
Observable |
delay(long delay, TimeUnit
Returns an Observable that emits the items emitted by the source Observable shifted forward in time by a specified delay.
|
<U> Observable |
delaySubscription(Func0
Returns an Observable that delays the subscription to the source Observable until a second Observable emits an item.
|
Observable |
delaySubscription(long delay, TimeUnit
Returns an Observable that delays the subscription to the source Observable by a given amount of time.
|
Observable |
delaySubscription(long delay, TimeUnit
Returns an Observable that delays the subscription to the source Observable by a given amount of time, both waiting and subscribing on a given Scheduler.
|
<T2> Observable |
dematerialize()
Returns an Observable that reverses the effect of
materialize by transforming the
Notification objects emitted by the source Observable into the items or notifications they represent.
|
Observable |
distinct()
Returns an Observable that emits all items emitted by the source Observable that are distinct.
|
<U> Observable |
distinct(Func1
Returns an Observable that emits all items emitted by the source Observable that are distinct according to a key selector function.
|
Observable |
distinctUntilChanged()
Returns an Observable that emits all items emitted by the source Observable that are distinct from their immediate predecessors.
|
<U> Observable |
distinctUntilChanged(Func1
Returns an Observable that emits all items emitted by the source Observable that are distinct from their immediate predecessors, according to a key selector function.
|
Observable |
doOnCompleted(Action0
Modifies the source Observable so that it invokes an action when it calls
onCompleted.
|
Observable |
doOnEach(Action1
Modifies the source Observable so that it invokes an action for each item it emits.
|
Observable |
doOnEach(Observer
Modifies the source Observable so that it notifies an Observer for each item it emits.
|
Observable |
doOnError(Action1
Modifies the source Observable so that it invokes an action if it calls
onError.
|
Observable |
doOnNext(Action1
Modifies the source Observable so that it invokes an action when it calls
onNext.
|
Observable |
doOnSubscribe(Action0
Modifies the source
Observable so that it invokes the given action when it is subscribed from its subscribers.
|
Observable |
doOnTerminate(Action0
Modifies the source Observable so that it invokes an action when it calls
onCompleted or
onError.
|
Observable |
doOnUnsubscribe(Action0
Modifies the source
Observable so that it invokes the given action when it is unsubscribed from its subscribers.
|
Observable |
elementAt(int index)
Returns an Observable that emits the single item at a specified index in a sequence of emissions from a source Observbable.
|
Observable |
elementAtOrDefault(int index, T defaultValue)
Returns an Observable that emits the item found at a specified index in a sequence of emissions from a source Observable, or a default item if that index is out of range.
|
static <T> Observable |
empty()
Returns an Observable that emits no items to the
Observer and immediately invokes its
onCompleted method.
|
static <T> Observable |
error(Throwable
|
Observable |
exists(Func1
Returns an Observable that emits
true if any item emitted by the source Observable satisfies a specified condition, otherwise
false.
|
Observable |
filter(Func1
Filters items emitted by an Observable by only emitting those that satisfy a specified predicate.
|
Observable |
finallyDo(Action0
|
Observable |
first()
Returns an Observable that emits only the very first item emitted by the source Observable, or notifies of an
NoSuchElementException if the source Observable is empty.
|
Observable |
first(Func1
Returns an Observable that emits only the very first item emitted by the source Observable that satisfies a specified condition, or notifies of an
NoSuchElementException if no such items are emitted.
|
Observable |
firstOrDefault(T defaultValue)
Returns an Observable that emits only the very first item emitted by the source Observable, or a default item if the source Observable completes without emitting anything.
|
Observable |
firstOrDefault(T defaultValue, Func1
Returns an Observable that emits only the very first item emitted by the source Observable that satisfies a specified condition, or a default item if the source Observable emits no such items.
|
<R> Observable |
flatMap(Func1
Returns an Observable that emits items based on applying a function that you supply to each item emitted by the source Observable, where that function returns an Observable, and then merging those resulting Observables and emitting the results of this merger.
|
<R> Observable |
flatMap(Func1
Returns an Observable that applies a function to each item emitted or notification raised by the source Observable and then flattens the Observables returned from these functions and emits the resulting items.
|
<U |
flatMap(Func1
Returns an Observable that emits the results of a specified function to the pair of values emitted by the source Observable and a specified collection Observable.
|
<R> Observable |
flatMapIterable(Func1
Returns an Observable that merges each item emitted by the source Observable with the values in an Iterable corresponding to that item that is generated by a selector.
|
<U |
flatMapIterable(Func1
Returns an Observable that emits the results of applying a function to the pair of values from the source Observable and an Iterable corresponding to that item that is generated by a selector.
|
void |
forEach(Action1
Subscribes to the
Observable and receives notifications for each element.
|
void |
forEach(Action1
Subscribes to the
Observable and receives notifications for each element and error events.
|
void |
forEach(Action1
Subscribes to the
Observable and receives notifications for each element and the terminal events.
|
static <T> Observable |
from(Future
Converts a
Future into an Observable.
|
static <T> Observable |
from(Future
Converts a
Future into an Observable, with a timeout on the Future.
|
static <T> Observable |
from(Future
|
static <T> Observable |
from(Iterable
Converts an
Iterable sequence into an Observable that emits the items in the sequence.
|
static <T> Observable |
from(T[] array)
Converts an Array into an Observable that emits the items in the Array.
|
<K> Observable |
groupBy(Func1
Groups the items emitted by an
Observable according to a specified criterion, and emits these grouped items as
GroupedObservables, one
GroupedObservable per group.
|
<K |
groupBy(Func1
Groups the items emitted by an
Observable according to a specified criterion, and emits these grouped items as
GroupedObservables, one
GroupedObservable per group.
|
<T2 |
groupJoin(Observable
Returns an Observable that correlates two Observables when they overlap in time and groups the results.
|
Observable |
ignoreElements()
Ignores all items emitted by the source Observable and only calls
onCompleted or
onError.
|
static Observable |
interval(long interval, TimeUnit
Returns an Observable that emits a sequential number every specified interval of time.
|
static Observable |
interval(long interval, TimeUnit
Returns an Observable that emits a sequential number every specified interval of time, on a specified Scheduler.
|
Observable |
isEmpty()
Returns an Observable that emits
true if the source Observable is empty, otherwise
false.
|
<TRight |
join(Observable
Correlates the items emitted by two Observables based on overlapping durations.
|
static <T> Observable |
just(T value)
Returns an Observable that emits a single item and then completes.
|
static <T> Observable |
just(T t1, T t2)
Converts two items into an Observable that emits those items.
|
static <T> Observable |
just(T t1, T t2, T t3)
Converts three items into an Observable that emits those items.
|
static <T> Observable |
just(T t1, T t2, T t3, T t4)
Converts four items into an Observable that emits those items.
|
static <T> Observable |
just(T t1, T t2, T t3, T t4, T t5)
Converts five items into an Observable that emits those items.
|
static <T> Observable |
just(T t1, T t2, T t3, T t4, T t5, T t6)
Converts six items into an Observable that emits those items.
|
static <T> Observable |
just(T t1, T t2, T t3, T t4, T t5, T t6, T t7)
Converts seven items into an Observable that emits those items.
|
static <T> Observable |
just(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8)
Converts eight items into an Observable that emits those items.
|
static <T> Observable |
just(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8, T t9)
Converts nine items into an Observable that emits those items.
|
static <T> Observable |
just(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8, T t9, T t10)
Converts ten items into an Observable that emits those items.
|
Observable |
last()
Returns an Observable that emits the last item emitted by the source Observable or notifies observers of a
NoSuchElementException if the source Observable is empty.
|
Observable |
last(Func1
Returns an Observable that emits only the last item emitted by the source Observable that satisfies a given condition, or notifies of a
NoSuchElementException if no such items are emitted.
|
Observable |
lastOrDefault(T defaultValue)
Returns an Observable that emits only the last item emitted by the source Observable, or a default item if the source Observable completes without emitting any items.
|
Observable |
lastOrDefault(T defaultValue, Func1
Returns an Observable that emits only the last item emitted by the source Observable that satisfies a specified condition, or a default item if no such item is emitted by the source Observable.
|
<R> Observable |
lift(Observable
Lifts a function to the current Observable and returns a new Observable that when subscribed to will pass the values of the current Observable through the Operator function.
|
Observable |
limit(int num)
Returns an Observable that emits only the first
num items emitted by the source Observable.
|
<R> Observable |
map(Func1
Returns an Observable that applies a specified function to each item emitted by the source Observable and emits the results of these function applications.
|
Observable |
materialize()
Returns an Observable that represents all of the emissions
and notifications from the source Observable into emissions marked with their original types within
Notification objects.
|
static <T> Observable |
merge(Iterable
Flattens an Iterable of Observables into one Observable, without any transformation.
|
static <T> Observable |
merge(Iterable
Flattens an Iterable of Observables into one Observable, without any transformation, while limiting the number of concurrent subscriptions to these Observables.
|
static <T> Observable |
merge(Observable
Flattens an Observable that emits Observables into a single Observable that emits the items emitted by those Observables, without any transformation.
|
static <T> Observable |
merge(Observable
Flattens an Observable that emits Observables into a single Observable that emits the items emitted by those Observables, without any transformation, while limiting the maximum number of concurrent subscriptions to these Observables.
|
static <T> Observable |
merge(Observable
Flattens an Array of Observables into one Observable, without any transformation.
|
static <T> Observable |
merge(Observable
Flattens two Observables into a single Observable, without any transformation.
|
static <T> Observable |
merge(Observable
Flattens three Observables into a single Observable, without any transformation.
|
static <T> Observable |
merge(Observable
Flattens four Observables into a single Observable, without any transformation.
|
static <T> Observable |
merge(Observable
Flattens five Observables into a single Observable, without any transformation.
|
static <T> Observable |
merge(Observable
Flattens six Observables into a single Observable, without any transformation.
|
static <T> Observable |
merge(Observable
Flattens seven Observables into a single Observable, without any transformation.
|
static <T> Observable |
merge(Observable
Flattens eight Observables into a single Observable, without any transformation.
|
static <T> Observable |
merge(Observable
Flattens nine Observables into a single Observable, without any transformation.
|
static <T> Observable |
mergeDelayError(Observable
Flattens an Observable that emits Observables into one Observable, in a way that allows an Observer to receive all successfully emitted items from all of the source Observables without being interrupted by an error notification from one of them.
|
static <T> Observable |
mergeDelayError(Observable
Flattens two Observables into one Observable, in a way that allows an Observer to receive all successfully emitted items from each of the source Observables without being interrupted by an error notification from one of them.
|
static <T> Observable |
mergeDelayError(Observable
Flattens three Observables into one Observable, in a way that allows an Observer to receive all successfully emitted items from all of the source Observables without being interrupted by an error notification from one of them.
|
static <T> Observable |
mergeDelayError(Observable
Flattens four Observables into one Observable, in a way that allows an Observer to receive all successfully emitted items from all of the source Observables without being interrupted by an error notification from one of them.
|
static <T> Observable |
mergeDelayError(Observable
Flattens five Observables into one Observable, in a way that allows an Observer to receive all successfully emitted items from all of the source Observables without being interrupted by an error notification from one of them.
|
static <T> Observable |
mergeDelayError(Observable
Flattens six Observables into one Observable, in a way that allows an Observer to receive all successfully emitted items from all of the source Observables without being interrupted by an error notification from one of them.
|
static <T> Observable |
mergeDelayError(Observable
Flattens seven Observables into one Observable, in a way that allows an Observer to receive all successfully emitted items from all of the source Observables without being interrupted by an error notification from one of them.
|
static <T> Observable |
mergeDelayError(Observable
Flattens eight Observables into one Observable, in a way that allows an Observer to receive all successfully emitted items from all of the source Observables without being interrupted by an error notification from one of them.
|
static <T> Observable |
mergeDelayError(Observable
Flattens nine Observables into one Observable, in a way that allows an Observer to receive all successfully emitted items from all of the source Observables without being interrupted by an error notification from one of them.
|
Observable |
mergeWith(Observable
Flattens this and another Observable into a single Observable, without any transformation.
|
Observable |
nest()
Converts the source
Observable<T> into an
Observable<Observable<T>> that emits the source Observable as its single emission.
|
static <T> Observable |
never()
Returns an Observable that never sends any items or notifications to an
Observer.
|
Observable |
observeOn(Scheduler
Modifies an Observable to perform its emissions and notifications on a specified
Scheduler, asynchronously with an unbounded buffer.
|
<R> Observable |
ofType(Class
Filters the items emitted by an Observable, only emitting those of the specified type.
|
Observable |
onBackpressureBuffer()
Instructs an Observable that is emitting items faster than its observer can consume them to buffer these items indefinitely until they can be emitted.
|
Observable |
onBackpressureDrop()
Instructs an Observable that is emitting items faster than its observer can consume them to discard, rather than emit, those items that its observer is not prepared to observe.
|
Observable |
onErrorResumeNext(Func1
Instructs an Observable to pass control to another Observable rather than invoking
onError if it encounters an error.
|
Observable |
onErrorResumeNext(Observable
Instructs an Observable to pass control to another Observable rather than invoking
onError if it encounters an error.
|
Observable |
onErrorReturn(Func1
Instructs an Observable to emit an item (returned by a specified function) rather than invoking
onError if it encounters an error.
|
Observable |
onExceptionResumeNext(Observable
|
ConnectableObservable |
publish()
Returns a
ConnectableObservable, which is a variety of Observable that waits until its
connect method is called before it begins emitting items to those
Observers that have subscribed to it.
|
<R> Observable |
publish(Func1
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 underlying sequence.
|
static Observable |
range(int start, int count)
Returns an Observable that emits a sequence of Integers within a specified range.
|
static Observable |
range(int start, int count, Scheduler
Returns an Observable that emits a sequence of Integers within a specified range, on a specified Scheduler.
|
Observable |
reduce(Func2
Returns an Observable that applies a specified accumulator function to the first item emitted by a source Observable, then feeds the result of that function along with the second item emitted by the source Observable into the same function, and so on until all items have been emitted by the source Observable, and emits the final result from the final call to your function as its sole item.
|
<R> Observable |
reduce(R initialValue, Func2
Returns an Observable that applies a specified accumulator function to the first item emitted by a source Observable and a specified seed value, then feeds the result of that function along with the second item emitted by an Observable into the same function, and so on until all items have been emitted by the source Observable, emitting the final result from the final call to your function as its sole item.
|
Observable |
repeat()
Returns an Observable that repeats the sequence of items emitted by the source Observable indefinitely.
|
Observable |
repeat(long count)
Returns an Observable that repeats the sequence of items emitted by the source Observable at most
count times.
|
Observable |
repeat(long count, Scheduler
Returns an Observable that repeats the sequence of items emitted by the source Observable at most
count times, on a particular Scheduler.
|
Observable |
repeat(Scheduler
Returns an Observable that repeats the sequence of items emitted by the source Observable indefinitely, on a particular Scheduler.
|
Observable |
repeatWhen(Func1
Returns an Observable that emits the same values as the source Observable with the exception of an
onCompleted.
|
Observable |
repeatWhen(Func1
Returns an Observable that emits the same values as the source Observable with the exception of an
onCompleted.
|
ConnectableObservable |
replay()
Returns a
ConnectableObservable that shares a single subscription to the underlying Observable that will replay all of its items and notifications to any future
Observer.
|
<R> Observable |
replay(Func1
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 source Observable.
|
<R> Observable |
replay(Func1
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 source Observable, replaying
bufferSize notifications.
|
<R> Observable |
replay(Func1
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 source Observable, replaying no more than
bufferSize items that were emitted within a specified time window.
|
<R> Observable |
replay(Func1
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 source Observable, replaying no more than
bufferSize items that were emitted within a specified time window.
|
<R> Observable |
replay(Func1
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 source Observable, replaying a maximum of
bufferSize items.
|
<R> Observable |
replay(Func1
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 source Observable, replaying all items that were emitted within a specified time window.
|
<R> Observable |
replay(Func1
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 source Observable, replaying all items that were emitted within a specified time window.
|
<R> Observable |
replay(Func1
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 source Observable.
|
ConnectableObservable |
replay(int bufferSize)
Returns a
ConnectableObservable that shares a single subscription to the source Observable that replays at most
bufferSize items emitted by that Observable.
|
ConnectableObservable |
replay(int bufferSize, long time, TimeUnit
Returns a
ConnectableObservable that shares a single subscription to the source Observable and replays at most
bufferSize items that were emitted during a specified time window.
|
ConnectableObservable |
replay(int bufferSize, long time, TimeUnit
Returns a
ConnectableObservable that shares a single subscription to the source Observable and that replays a maximum of
bufferSize items that are emitted within a specified time window.
|
ConnectableObservable |
replay(int bufferSize, Scheduler
Returns a
ConnectableObservable that shares a single subscription to the source Observable and replays at most
bufferSize items emitted by that Observable.
|
ConnectableObservable |
replay(long time, TimeUnit
Returns a
ConnectableObservable that shares a single subscription to the source Observable and replays all items emitted by that Observable within a specified time window.
|
ConnectableObservable |
replay(long time, TimeUnit
Returns a
ConnectableObservable that shares a single subscription to the source Observable and replays all items emitted by that Observable within a specified time window.
|
ConnectableObservable |
replay(Scheduler
Returns a
ConnectableObservable that shares a single subscription to the source Observable that will replay all of its items and notifications to any future
Observer on the given
Scheduler.
|
Observable |
retry()
Returns an Observable that mirrors the source Observable, resubscribing to it if it calls
onError (infinite retry count).
|
Observable |
retry(Func2
Returns an Observable that mirrors the source Observable, resubscribing to it if it calls
onError and the predicate returns true for that specific exception and retry count.
|
Observable |
retry(long count)
Returns an Observable that mirrors the source Observable, resubscribing to it if it calls
onError up to a specified number of retries.
|
Observable |
retryWhen(Func1
Returns an Observable that emits the same values as the source observable with the exception of an
onError.
|
Observable |
retryWhen(Func1
Returns an Observable that emits the same values as the source observable with the exception of an
onError.
|
Observable |
sample(long period, TimeUnit
Returns an Observable that emits the most recently emitted item (if any) emitted by the source Observable within periodic time intervals.
|
Observable |
sample(long period, TimeUnit
Returns an Observable that emits the most recently emitted item (if any) emitted by the source Observable within periodic time intervals, where the intervals are defined on a particular Scheduler.
|
<U> Observable |
sample(Observable
Returns an Observable that, when the specified
sampler Observable emits an item or completes, emits the most recently emitted item (if any) emitted by the source Observable since the previous emission from the
sampler Observable.
|
Observable |
scan(Func2
Returns an Observable that applies a specified accumulator function to the first item emitted by a source Observable, then feeds the result of that function along with the second item emitted by the source Observable into the same function, and so on until all items have been emitted by the source Observable, emitting the result of each of these iterations.
|
<R> Observable |
scan(R initialValue, Func2
Returns an Observable that applies a specified accumulator function to the first item emitted by a source Observable and a seed value, then feeds the result of that function along with the second item emitted by the source Observable into the same function, and so on until all items have been emitted by the source Observable, emitting the result of each of these iterations.
|
static <T> Observable |
sequenceEqual(Observable
Returns an Observable that emits a Boolean value that indicates whether two Observable sequences are the same by comparing the items emitted by each Observable pairwise.
|
static <T> Observable |
sequenceEqual(Observable
Returns an Observable that emits a Boolean value that indicates whether two Observable sequences are the same by comparing the items emitted by each Observable pairwise based on the results of a specified equality function.
|
Observable |
serialize()
Forces an Observable's emissions and notifications to be serialized and for it to obey the Rx contract in other ways.
|
Observable |
share()
Returns a new
Observable that multicasts (shares) the original
Observable.
|
Observable |
single()
Returns an Observable that emits the single item emitted by the source Observable, if that Observable emits only a single item.
|
Observable |
single(Func1
Returns an Observable that emits the single item emitted by the source Observable that matches a specified predicate, if that Observable emits one such item.
|
Observable |
singleOrDefault(T defaultValue)
Returns an Observable that emits the single item emitted by the source Observable, if that Observable emits only a single item, or a default item if the source Observable emits no items.
|
Observable |
singleOrDefault(T defaultValue, Func1
Returns an Observable that emits the single item emitted by the source Observable that matches a predicate, if that Observable emits only one such item, or a default item if the source Observable emits no such items.
|
Observable |
skip(int num)
Returns an Observable that skips the first
num items emitted by the source Observable and emits the remainder.
|
Observable |
skip(long time, TimeUnit
Returns an Observable that skips values emitted by the source Observable before a specified time window elapses.
|
Observable |
skip(long time, TimeUnit
Returns an Observable that skips values emitted by the source Observable before a specified time window on a specified
Scheduler elapses.
|
Observable |
skipLast(int count)
Returns an Observable that drops a specified number of items from the end of the sequence emitted by the source Observable.
|
Observable |
skipLast(long time, TimeUnit
Returns an Observable that drops items emitted by the source Observable during a specified time window before the source completes.
|
Observable |
skipLast(long time, TimeUnit
Returns an Observable that drops items emitted by the source Observable during a specified time window (defined on a specified scheduler) before the source completes.
|
<U> Observable |
skipUntil(Observable
Returns an Observable that skips items emitted by the source Observable until a second Observable emits an item.
|
Observable |
skipWhile(Func1
Returns an Observable that skips all items emitted by the source Observable as long as a specified condition holds true, but emits all further source items as soon as the condition becomes false.
|
Observable |
startWith(Iterable
Returns an Observable that emits the items in a specified
Iterable before it begins to emit items emitted by the source Observable.
|
Observable |
startWith(Observable
Returns an Observable that emits the items in a specified
Observable before it begins to emit items emitted by the source Observable.
|
Observable |
startWith(T t1)
Returns an Observable that emits a specified item before it begins to emit items emitted by the source Observable.
|
Observable |
startWith(T t1, T t2)
Returns an Observable that emits the specified items before it begins to emit items emitted by the source Observable.
|
Observable |
startWith(T t1, T t2, T t3)
Returns an Observable that emits the specified items before it begins to emit items emitted by the source Observable.
|
Observable |
startWith(T t1, T t2, T t3, T t4)
Returns an Observable that emits the specified items before it begins to emit items emitted by the source Observable.
|
Observable |
startWith(T t1, T t2, T t3, T t4, T t5)
Returns an Observable that emits the specified items before it begins to emit items emitted by the source Observable.
|
Observable |
startWith(T t1, T t2, T t3, T t4, T t5, T t6)
Returns an Observable that emits the specified items before it begins to emit items emitted by the source Observable.
|
Observable |
startWith(T t1, T t2, T t3, T t4, T t5, T t6, T t7)
Returns an Observable that emits the specified items before it begins to emit items emitted by the source Observable.
|
Observable |
startWith(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8)
Returns an Observable that emits the specified items before it begins to emit items emitted by the source Observable.
|
Observable |
startWith(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8, T t9)
Returns an Observable that emits the specified items before it begins to emit items emitted by the source Observable.
|
Subscription |
subscribe()
Subscribes to an Observable but ignore its emissions and notifications.
|
Subscription |
subscribe(Action1
Subscribes to an Observable and provides a callback to handle the items it emits.
|
Subscription |
subscribe(Action1
Subscribes to an Observable and provides callbacks to handle the items it emits and any error notification it issues.
|
Subscription |
subscribe(Action1
Subscribes to an Observable and provides callbacks to handle the items it emits and any error or completion notification it issues.
|
Subscription |
subscribe(Observer
Subscribes to an Observable and provides an Observer that implements functions to handle the items the Observable emits and any error or completion notification it issues.
|
Subscription |
subscribe(Subscriber
Subscribes to an Observable and provides a Subscriber that implements functions to handle the items the Observable emits and any error or completion notification it issues.
|
Observable |
subscribeOn(Scheduler
Asynchronously subscribes Observers to this Observable on the specified
Scheduler.
|
<R> Observable |
switchMap(Func1
Returns a new Observable by applying a function that you supply to each item emitted by the source Observable that returns an Observable, and then emitting the items emitted by the most recently emitted of these Observables.
|
static <T> Observable |
switchOnNext(Observable
Converts an Observable that emits Observables into an Observable that emits the items emitted by the most recently emitted of those Observables.
|
Observable |
take(int num)
Returns an Observable that emits only the first
num items emitted by the source Observable.
|
Observable |
take(long time, TimeUnit
Returns an Observable that emits those items emitted by source Observable before a specified time runs out.
|
Observable |
take(long time, TimeUnit
Returns an Observable that emits those items emitted by source Observable before a specified time (on a specified Scheduler) runs out.
|
Observable |
takeFirst(Func1
Returns an Observable that emits only the very first item emitted by the source Observable that satisfies a specified condition.
|
Observable |
takeLast(int count)
Returns an Observable that emits only the last
count items emitted by the source Observable.
|
Observable |
takeLast(int count, long time, TimeUnit
Returns an Observable that emits at most a specified number of items from the source Observable that were emitted in a specified window of time before the Observable completed.
|
Observable |
takeLast(int count, long time, TimeUnit
Returns an Observable that emits at most a specified number of items from the source Observable that were emitted in a specified window of time before the Observable completed, where the timing information is provided by a given Scheduler.
|
Observable |
takeLast(long time, TimeUnit
Returns an Observable that emits the items from the source Observable that were emitted in a specified window of time before the Observable completed.
|
Observable |
takeLast(long time, TimeUnit
Returns an Observable that emits the items from the source Observable that were emitted in a specified window of time before the Observable completed, where the timing information is provided by a specified Scheduler.
|
Observable |
takeLastBuffer(int count)
Returns an Observable that emits a single List containing the last
count elements emitted by the source Observable.
|
Observable |
takeLastBuffer(int count, long time, TimeUnit
Returns an Observable that emits a single List containing at most
count items from the source Observable that were emitted during a specified window of time before the source Observable completed.
|
Observable |
takeLastBuffer(int count, long time, TimeUnit
Returns an Observable that emits a single List containing at most
count items from the source Observable that were emitted during a specified window of time (on a specified Scheduler) before the source Observable completed.
|
Observable |
takeLastBuffer(long time, TimeUnit
Returns an Observable that emits a single List containing those items from the source Observable that were emitted during a specified window of time before the source Observable completed.
|
Observable |
takeLastBuffer(long time, TimeUnit
Returns an Observable that emits a single List containing those items from the source Observable that were emitted during a specified window of time before the source Observable completed, where the timing information is provided by the given Scheduler.
|
<E> Observable |
takeUntil(Observable
Returns an Observable that emits the items emitted by the source Observable until a second Observable emits an item.
|
Observable |
takeWhile(Func1
Returns an Observable that emits items emitted by the source Observable so long as each item satisfied a specified condition, and then completes as soon as this condition is not satisfied.
|
Observable |
throttleFirst(long windowDuration, TimeUnit
Returns an Observable that emits only the first item emitted by the source Observable during sequential time windows of a specified duration.
|
Observable |
throttleFirst(long skipDuration, TimeUnit
Returns an Observable that emits only the first item emitted by the source Observable during sequential time windows of a specified duration, where the windows are managed by a specified Scheduler.
|
Observable |
throttleLast(long intervalDuration, TimeUnit
Returns an Observable that emits only the last item emitted by the source Observable during sequential time windows of a specified duration.
|
Observable |
throttleLast(long intervalDuration, TimeUnit
Returns an Observable that emits only the last item emitted by the source Observable during sequential time windows of a specified duration, where the duration is governed by a specified Scheduler.
|
Observable |
throttleWithTimeout(long timeout, TimeUnit
Returns an Observable that only emits those items emitted by the source Observable that are not followed by another emitted item within a specified time window.
|
Observable |
throttleWithTimeout(long timeout, TimeUnit
Returns an Observable that only emits those items emitted by the source Observable that are not followed by another emitted item within a specified time window, where the time window is governed by a specified Scheduler.
|
Observable |
timeInterval()
Returns an Observable that emits records of the time interval between consecutive items emitted by the source Observable.
|
Observable |
timeInterval(Scheduler
Returns an Observable that emits records of the time interval between consecutive items emitted by the source Observable, where this interval is computed on a specified Scheduler.
|
<U |
timeout(Func0
Returns an Observable that mirrors the source Observable, but notifies observers of a
TimeoutException if either the first item emitted by the source Observable or any subsequent item doesn't arrive within time windows defined by other Observables.
|
<U |
timeout(Func0
Returns an Observable that mirrors the source Observable, but switches to a fallback Observable if either the first item emitted by the source Observable or any subsequent item doesn't arrive within time windows defined by other Observables.
|
<V> Observable |
timeout(Func1
Returns an Observable that mirrors the source Observable, but notifies observers of a
TimeoutException if an item emitted by the source 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 Observable that is a function of the previous item.
|
<V> Observable |
timeout(Func1
Returns an Observable that mirrors the source Observable, but that switches to a fallback Observable if an item emitted by the source 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 Observable that is a function of the previous item.
|
Observable |
timeout(long timeout, TimeUnit
Returns an Observable that mirrors the source Observable but applies a timeout policy for each emitted item.
|
Observable |
timeout(long timeout, TimeUnit
Returns an Observable that mirrors the source Observable but applies a timeout policy for each emitted item.
|
Observable |
timeout(long timeout, TimeUnit
Returns an Observable that mirrors the source Observable but applies a timeout policy for each emitted item using a specified Scheduler.
|
Observable |
timeout(long timeout, TimeUnit
Returns an Observable that mirrors the source Observable but applies a timeout policy for each emitted item, where this policy is governed on a specified Scheduler.
|
static Observable |
timer(long initialDelay, long period, TimeUnit
Returns an Observable that emits a
0L after the
initialDelay and ever increasing numbers after each
period of time thereafter.
|
static Observable |
timer(long initialDelay, long period, TimeUnit
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 Observable |
timer(long delay, TimeUnit
Returns an Observable that emits one item after a specified delay, and then completes.
|
static Observable |
timer(long delay, TimeUnit
Returns an Observable that emits one item after a specified delay, on a specified Scheduler, and then completes.
|
Observable |
timestamp()
Returns an Observable that emits each item emitted by the source Observable, wrapped in a
Timestamped object.
|
Observable |
timestamp(Scheduler
Returns an Observable that emits each item emitted by the source Observable, wrapped in a
Timestamped object whose timestamps are provided by a specified Scheduler.
|
BlockingObservable |
toBlocking()
Converts an Observable into a
BlockingObservable (an Observable with blocking operators).
|
Observable |
toList()
Returns an Observable that emits a single item, a list composed of all the items emitted by the source Observable.
|
<K> Observable |
toMap(Func1
Returns an Observable that emits a single HashMap containing all items emitted by the source Observable, mapped by the keys returned by a specified
keySelector function.
|
<K |
toMap(Func1
Returns an Observable that emits a single HashMap containing values corresponding to items emitted by the source Observable, mapped by the keys returned by a specified
keySelector function.
|
<K |
toMap(Func1
Returns an Observable that emits a single Map, returned by a specified
mapFactory function, that contains keys and values extracted from the items emitted by the source Observable.
|
<K> Observable |
toMultimap(Func1
Returns an Observable that emits a single HashMap that contains an ArrayList of items emitted by the source Observable keyed by a specified
keySelector function.
|
<K |
toMultimap(Func1
Returns an Observable that emits a single HashMap that contains an ArrayList of values extracted by a specified
valueSelector function from items emitted by the source Observable, keyed by a specified
keySelector function.
|
<K |
toMultimap(Func1
Returns an Observable that emits a single Map, returned by a specified
mapFactory function, that contains an ArrayList of values, extracted by a specified
valueSelector function from items emitted by the source Observable and keyed by the
keySelector function.
|
<K |
toMultimap(Func1
Returns an Observable that emits a single Map, returned by a specified
mapFactory function, that contains a custom collection of values, extracted by a specified
valueSelector function from items emitted by the source Observable, and keyed by the
keySelector function.
|
Observable |
toSortedList()
Returns an Observable that emits a list that contains the items emitted by the source Observable, in a sorted order.
|
Observable |
toSortedList(Func2
Returns an Observable that emits a list that contains the items emitted by the source Observable, in a sorted order based on a specified comparison function.
|
Subscription |
unsafeSubscribe(Subscriber
Subscribes to an Observable and invokes
Observable.OnSubscribe function without any contract protection, error handling, unsubscribe, or execution hooks.
|
Observable |
unsubscribeOn(Scheduler
Modifies the source Observable so that subscribers will unsubscribe from it on a specified
Scheduler.
|
static <T |
using(Func0
Constructs an Observable that creates a dependent resource object.
|
<TClosing> Observable |
window(Func0
Returns an Observable that emits windows of items it collects from the source Observable.
|
Observable |
window(int count)
Returns an Observable that emits windows of items it collects from the source Observable.
|
Observable |
window(int count, int skip)
Returns an Observable that emits windows of items it collects from the source Observable.
|
Observable |
window(long timespan, long timeshift, TimeUnit
Returns an Observable that emits windows of items it collects from the source Observable.
|
Observable |
window(long timespan, long timeshift, TimeUnit
Returns an Observable that emits windows of items it collects from the source Observable.
|
Observable |
window(long timespan, long timeshift, TimeUnit
Returns an Observable that emits windows of items it collects from the source Observable.
|
Observable |
window(long timespan, TimeUnit
Returns an Observable that emits windows of items it collects from the source Observable.
|
Observable |
window(long timespan, TimeUnit
Returns an Observable that emits windows of items it collects from the source Observable.
|
Observable |
window(long timespan, TimeUnit
Returns an Observable that emits windows of items it collects from the source Observable.
|
Observable |
window(long timespan, TimeUnit
Returns an Observable that emits windows of items it collects from the source Observable.
|
<TOpening |
window(Observable
Returns an Observable that emits windows of items it collects from the source Observable.
|
<U> Observable |
window(Observable
Returns an Observable that emits non-overlapping windows of items it collects from the source Observable where the boundary of each window is determined by the items emitted from a specified boundary-governing Observable.
|
static <R> Observable |
zip(Iterable
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 Observables.
|
static <R> Observable |
zip(Observable
Returns an Observable that emits the results of a specified combiner function applied to combinations of
n items emitted, in sequence, by the
n Observables emitted by a specified Observable.
|
static <T1 |
zip(Observable
Returns an Observable that emits the results of a specified combiner function applied to combinations of two items emitted, in sequence, by two other Observables.
|
static <T1 |
zip(Observable
Returns an Observable that emits the results of a specified combiner function applied to combinations of three items emitted, in sequence, by three other Observables.
|
static <T1 |
zip(Observable
Returns an Observable that emits the results of a specified combiner function applied to combinations of four items emitted, in sequence, by four other Observables.
|
static <T1 |
zip(Observable
Returns an Observable that emits the results of a specified combiner function applied to combinations of five items emitted, in sequence, by five other Observables.
|
static <T1 |
zip(Observable
Returns an Observable that emits the results of a specified combiner function applied to combinations of six items emitted, in sequence, by six other Observables.
|
static <T1 |
zip(Observable
Returns an Observable that emits the results of a specified combiner function applied to combinations of seven items emitted, in sequence, by seven other Observables.
|
static <T1 |
zip(Observable
Returns an Observable that emits the results of a specified combiner function applied to combinations of eight items emitted, in sequence, by eight other Observables.
|
static <T1 |
zip(Observable
Returns an Observable that emits the results of a specified combiner function applied to combinations of nine items emitted, in sequence, by nine other Observables.
|
<T2 |
zipWith(Iterable
Returns an Observable that emits items that are the result of applying a specified function to pairs of values, one each from the source Observable and a specified Iterable sequence.
|
<T2 |
zipWith(Observable
Returns an Observable that emits items that are the result of applying a specified function to pairs of values, one each from the source Observable and another specified Observable.
|
protected Observable(Observable.OnSubscribe <T> f)
Note: Use create(OnSubscribe) to create an Observable, instead of this constructor, unless you specifically have a need for inheritance.
f -
Observable.OnSubscribe to be executed when
subscribe(Subscriber) is called
public static final <T> Observable<T> create(Observable .OnSubscribe <T> f)
Subscriber subscribes to it.
Write the function you pass to create so that it behaves as an Observable: It should invoke the Subscriber's onNext, onError, and onCompleted methods appropriately.
A well-formed Observable must invoke either the Subscriber's onCompleted method exactly once or its onError method exactly once.
See Rx Design Guidelines (PDF) for detailed information.
create does not operate by default on a particular
Scheduler.
T - the type of the items that this Observable emits
f - a function that accepts an
Subscriber<T>, and invokes its
onNext,
onError, and
onCompleted methods as appropriate
Subscriber subscribes to it, will execute the specified function
public final <R> Observable<R> lift(Observable .Operator <? extends R ,? super T> lift)
In other words, this allows chaining Observers together on an Observable for acting on the values within the Observable.
observable.map(...).filter(...).take(5).lift(new OperatorA()).lift(new OperatorB(...)).subscribe()
If the operator you are creating is designed to act on the individual items emitted by a source Observable, use lift. If your operator is designed to transform the source Observable as a whole (for instance, by applying a particular set of existing RxJava operators to it) use compose(rx.Observable.Transformer<? super T, ? extends R>).
lift does not operate by default on a particular
Scheduler.
lift - the Operator that implements the Observable-operating function to be applied to the source Observable
public <R> Observable<R> compose(Observable .Transformer <? super T ,? extends R> transformer)
This method operates on the Observable itself whereas lift(rx.Observable.Operator<? extends R, ? super T>) operates on the Observable's Subscribers or Observers.
If the operator you are creating is designed to act on the individual items emitted by a source Observable, use lift(rx.Observable.Operator<? extends R, ? super T>). If your operator is designed to transform the source Observable as a whole (for instance, by applying a particular set of existing RxJava operators to it) use compose.
compose does not operate by default on a particular
Scheduler.
transformer - implements the function that transforms the source Observable
public static final <T> Observable<T> amb(Iterable <? extends Observable <? extends T>> sources)
amb does not operate by default on a particular
Scheduler.
sources - an Iterable of Observable sources competing to react first
public static final <T> Observable<T> amb(Observable <? extends T> o1, Observable <? extends T> o2)
amb does not operate by default on a particular
Scheduler.
o1 - an Observable competing to react first
o2 - an Observable competing to react first
public static final <T> Observable<T> amb(Observable <? extends T> o1, Observable <? extends T> o2, Observable <? extends T> o3)
amb does not operate by default on a particular
Scheduler.
o1 - an Observable competing to react first
o2 - an Observable competing to react first
o3 - an Observable competing to react first
public static final <T> Observable<T> amb(Observable <? extends T> o1, Observable <? extends T> o2, Observable <? extends T> o3, Observable <? extends T> o4)
amb does not operate by default on a particular
Scheduler.
o1 - an Observable competing to react first
o2 - an Observable competing to react first
o3 - an Observable competing to react first
o4 - an Observable competing to react first
public static final <T> Observable<T> amb(Observable <? extends T> o1, Observable <? extends T> o2, Observable <? extends T> o3, Observable <? extends T> o4, Observable <? extends T> o5)
amb does not operate by default on a particular
Scheduler.
o1 - an Observable competing to react first
o2 - an Observable competing to react first
o3 - an Observable competing to react first
o4 - an Observable competing to react first
o5 - an Observable competing to react first
public static final <T> Observable<T> amb(Observable <? extends T> o1, Observable <? extends T> o2, Observable <? extends T> o3, Observable <? extends T> o4, Observable <? extends T> o5, Observable <? extends T> o6)
amb does not operate by default on a particular
Scheduler.
o1 - an Observable competing to react first
o2 - an Observable competing to react first
o3 - an Observable competing to react first
o4 - an Observable competing to react first
o5 - an Observable competing to react first
o6 - an Observable competing to react first
public static final <T> Observable<T> amb(Observable <? extends T> o1, Observable <? extends T> o2, Observable <? extends T> o3, Observable <? extends T> o4, Observable <? extends T> o5, Observable <? extends T> o6, Observable <? extends T> o7)
amb does not operate by default on a particular
Scheduler.
o1 - an Observable competing to react first
o2 - an Observable competing to react first
o3 - an Observable competing to react first
o4 - an Observable competing to react first
o5 - an Observable competing to react first
o6 - an Observable competing to react first
o7 - an Observable competing to react first
public static final <T> Observable<T> amb(Observable <? extends T> o1, Observable <? extends T> o2, Observable <? extends T> o3, Observable <? extends T> o4, Observable <? extends T> o5, Observable <? extends T> o6, Observable <? extends T> o7, Observable <? extends T> o8)
amb does not operate by default on a particular
Scheduler.
o1 - an Observable competing to react first
o2 - an Observable competing to react first
o3 - an Observable competing to react first
o4 - an Observable competing to react first
o5 - an Observable competing to react first
o6 - an Observable competing to react first
o7 - an Observable competing to react first
o8 - an observable competing to react first
public static final <T> Observable<T> amb(Observable <? extends T> o1, Observable <? extends T> o2, Observable <? extends T> o3, Observable <? extends T> o4, Observable <? extends T> o5, Observable <? extends T> o6, Observable <? extends T> o7, Observable <? extends T> o8, Observable <? extends T> o9)
amb does not operate by default on a particular
Scheduler.
o1 - an Observable competing to react first
o2 - an Observable competing to react first
o3 - an Observable competing to react first
o4 - an Observable competing to react first
o5 - an Observable competing to react first
o6 - an Observable competing to react first
o7 - an Observable competing to react first
o8 - an Observable competing to react first
o9 - an Observable competing to react first
public static final <T1,T2 ,R> Observable <R> combineLatest(Observable <? extends T1> o1, Observable <? extends T2> o2, Func2 <? super T1 ,? super T2 ,? extends R> combineFunction)
combineLatest does not operate by default on a particular
Scheduler.
o1 - the first source Observable
o2 - the second source Observable
combineFunction - the aggregation function used to combine the items emitted by the source Observables
public static final <T1,T2 ,T3 ,R> Observable <R> combineLatest(Observable <? extends T1> o1, Observable <? extends T2> o2, Observable <? extends T3> o3, Func3 <? super T1 ,? super T2 ,? super T3 ,? extends R> combineFunction)
combineLatest does not operate by default on a particular
Scheduler.
o1 - the first source Observable
o2 - the second source Observable
o3 - the third source Observable
combineFunction - the aggregation function used to combine the items emitted by the source Observables
public static final <T1,T2 ,T3 ,T4 ,R> Observable <R> combineLatest(Observable <? extends T1> o1, Observable <? extends T2> o2, Observable <? extends T3> o3, Observable <? extends T4> o4, Func4 <? super T1 ,? super T2 ,? super T3 ,? super T4 ,? extends R> combineFunction)
combineLatest does not operate by default on a particular
Scheduler.
o1 - the first source Observable
o2 - the second source Observable
o3 - the third source Observable
o4 - the fourth source Observable
combineFunction - the aggregation function used to combine the items emitted by the source Observables
public static final <T1,T2 ,T3 ,T4 ,T5 ,R> Observable <R> combineLatest(Observable <? extends T1> o1, Observable <? extends T2> o2, Observable <? extends T3> o3, Observable <? extends T4> o4, Observable <? extends T5> o5, Func5 <? super T1 ,? super T2 ,? super T3 ,? super T4 ,? super T5 ,? extends R> combineFunction)
combineLatest does not operate by default on a particular
Scheduler.
o1 - the first source Observable
o2 - the second source Observable
o3 - the third source Observable
o4 - the fourth source Observable
o5 - the fifth source Observable
combineFunction - the aggregation function used to combine the items emitted by the source Observables
public static final <T1,T2 ,T3 ,T4 ,T5 ,T6 ,R> Observable <R> combineLatest(Observable <? extends T1> o1, Observable <? extends T2> o2, Observable <? extends T3> o3, Observable <? extends T4> o4, Observable <? extends T5> o5, Observable <? extends T6> o6, Func6 <? super T1 ,? super T2 ,? super T3 ,? super T4 ,? super T5 ,? super T6 ,? extends R> combineFunction)
combineLatest does not operate by default on a particular
Scheduler.
o1 - the first source Observable
o2 - the second source Observable
o3 - the third source Observable
o4 - the fourth source Observable
o5 - the fifth source Observable
o6 - the sixth source Observable
combineFunction - the aggregation function used to combine the items emitted by the source Observables
public static final <T1,T2 ,T3 ,T4 ,T5 ,T6 ,T7 ,R> Observable <R> combineLatest(Observable <? extends T1> o1, Observable <? extends T2> o2, Observable <? extends T3> o3, Observable <? extends T4> o4, Observable <? extends T5> o5, Observable <? extends T6> o6, Observable <? extends T7> o7, Func7 <? super T1 ,? super T2 ,? super T3 ,? super T4 ,? super T5 ,? super T6 ,? super T7 ,? extends R> combineFunction)
combineLatest does not operate by default on a particular
Scheduler.
o1 - the first source Observable
o2 - the second source Observable
o3 - the third source Observable
o4 - the fourth source Observable
o5 - the fifth source Observable
o6 - the sixth source Observable
o7 - the seventh source Observable
combineFunction - the aggregation function used to combine the items emitted by the source Observables
public static final <T1,T2 ,T3 ,T4 ,T5 ,T6 ,T7 ,T8 ,R> Observable <R> combineLatest(Observable <? extends T1> o1, Observable <? extends T2> o2, Observable <? extends T3> o3, Observable <? extends T4> o4, Observable <? extends T5> o5, Observable <? extends T6> o6, Observable <? extends T7> o7, Observable <? extends T8> o8, Func8 <? super T1 ,? super T2 ,? super T3 ,? super T4 ,? super T5 ,? super T6 ,? super T7 ,? super T8 ,? extends R> combineFunction)
combineLatest does not operate by default on a particular
Scheduler.
o1 - the first source Observable
o2 - the second source Observable
o3 - the third source Observable
o4 - the fourth source Observable
o5 - the fifth source Observable
o6 - the sixth source Observable
o7 - the seventh source Observable
o8 - the eighth source Observable
combineFunction - the aggregation function used to combine the items emitted by the source Observables
public static final <T1,T2 ,T3 ,T4 ,T5 ,T6 ,T7 ,T8 ,T9 ,R> Observable <R> combineLatest(Observable <? extends T1> o1, Observable <? extends T2> o2, Observable <? extends T3> o3, Observable <? extends T4> o4, Observable <? extends T5> o5, Observable <? extends T6> o6, Observable <? extends T7> o7, Observable <? extends T8> o8, Observable <? extends T9> o9, Func9 <? super T1 ,? super T2 ,? super T3 ,? super T4 ,? super T5 ,? super T6 ,? super T7 ,? super T8 ,? super T9 ,? extends R> combineFunction)
combineLatest does not operate by default on a particular
Scheduler.
o1 - the first source Observable
o2 - the second source Observable
o3 - the third source Observable
o4 - the fourth source Observable
o5 - the fifth source Observable
o6 - the sixth source Observable
o7 - the seventh source Observable
o8 - the eighth source Observable
o9 - the ninth source Observable
combineFunction - the aggregation function used to combine the items emitted by the source Observables
public static final <T,R> Observable <R> combineLatest(List <? extends Observable <? extends T>> sources, FuncN <? extends R> combineFunction)
combineLatest does not operate by default on a particular
Scheduler.
T - the common base type of source values
R - the result type
sources - the list of source Observables
combineFunction - the aggregation function used to combine the items emitted by the source Observables
public static final <T> Observable<T> concat(Observable <? extends Observable <? extends T>> observables)
concat does not operate by default on a particular
Scheduler.
observables - an Observable that emits Observables
observables, one after the other, without interleaving them
public static final <T> Observable<T> concat(Observable <? extends T> t1, Observable <? extends T> t2)
concat does not operate by default on a particular
Scheduler.
t1 - an Observable to be concatenated
t2 - an Observable to be concatenated
public static final <T> Observable<T> concat(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3)
concat does not operate by default on a particular
Scheduler.
t1 - an Observable to be concatenated
t2 - an Observable to be concatenated
t3 - an Observable to be concatenated
public static final <T> Observable<T> concat(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4)
concat does not operate by default on a particular
Scheduler.
t1 - an Observable to be concatenated
t2 - an Observable to be concatenated
t3 - an Observable to be concatenated
t4 - an Observable to be concatenated
public static final <T> Observable<T> concat(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4, Observable <? extends T> t5)
concat does not operate by default on a particular
Scheduler.
t1 - an Observable to be concatenated
t2 - an Observable to be concatenated
t3 - an Observable to be concatenated
t4 - an Observable to be concatenated
t5 - an Observable to be concatenated
public static final <T> Observable<T> concat(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4, Observable <? extends T> t5, Observable <? extends T> t6)
concat does not operate by default on a particular
Scheduler.
t1 - an Observable to be concatenated
t2 - an Observable to be concatenated
t3 - an Observable to be concatenated
t4 - an Observable to be concatenated
t5 - an Observable to be concatenated
t6 - an Observable to be concatenated
public static final <T> Observable<T> concat(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4, Observable <? extends T> t5, Observable <? extends T> t6, Observable <? extends T> t7)
concat does not operate by default on a particular
Scheduler.
t1 - an Observable to be concatenated
t2 - an Observable to be concatenated
t3 - an Observable to be concatenated
t4 - an Observable to be concatenated
t5 - an Observable to be concatenated
t6 - an Observable to be concatenated
t7 - an Observable to be concatenated
public static final <T> Observable<T> concat(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4, Observable <? extends T> t5, Observable <? extends T> t6, Observable <? extends T> t7, Observable <? extends T> t8)
concat does not operate by default on a particular
Scheduler.
t1 - an Observable to be concatenated
t2 - an Observable to be concatenated
t3 - an Observable to be concatenated
t4 - an Observable to be concatenated
t5 - an Observable to be concatenated
t6 - an Observable to be concatenated
t7 - an Observable to be concatenated
t8 - an Observable to be concatenated
public static final <T> Observable<T> concat(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4, Observable <? extends T> t5, Observable <? extends T> t6, Observable <? extends T> t7, Observable <? extends T> t8, Observable <? extends T> t9)
concat does not operate by default on a particular
Scheduler.
t1 - an Observable to be concatenated
t2 - an Observable to be concatenated
t3 - an Observable to be concatenated
t4 - an Observable to be concatenated
t5 - an Observable to be concatenated
t6 - an Observable to be concatenated
t7 - an Observable to be concatenated
t8 - an Observable to be concatenated
t9 - an Observable to be concatenated
public static final <T> Observable<T> defer(Func0 <Observable <T>> observableFactory)
The defer Observer allows you to defer or delay emitting items from an Observable until such time as an Observer subscribes to the Observable. 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 Observable
observableFactory - the Observable factory function to invoke for each
Observer that subscribes to the resulting Observable
Observers' subscriptions trigger an invocation of the given Observable factory function
public static final <T> Observable<T> empty()
Observer and immediately invokes its
onCompleted method.
empty does not operate by default on a particular
Scheduler.
T - the type of the items (ostensibly) emitted by the Observable
Observer but immediately invokes the
Observer's
onCompleted method
public static final <T> Observable<T> error(Throwable exception)
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
exception - the particular Throwable to pass to
onError
Observer's
onError method when the Observer subscribes to it
public static final <T> Observable<T> from(Future <? extends T> future)
Future into an Observable.
You can convert any object that supports the Future interface into an Observable that emits the return value of the Future method of that object, by passing the object into the from method.
Important note: This Observable is blocking; you cannot unsubscribe from it.
from 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
Future
public static final <T> Observable<T> from(Future <? extends T> future, long timeout, TimeUnit unit)
Future into an Observable, with a timeout on the Future.
You can convert any object that supports the Future interface into an Observable that emits the return value of the Future method of that object, by passing the object into the from method.
Important note: This Observable is blocking; you cannot unsubscribe from it.
from 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 argument
Future
public static final <T> Observable<T> from(Future <? extends T> future, Scheduler scheduler)
Future, operating on a specified
Scheduler, into an Observable.
You can convert any object that supports the Future interface into an Observable that emits the return value of the Future method of that object, by passing the object into the from method.
Scheduler this operator will use
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
scheduler - the
Scheduler to wait for the Future on. Use a Scheduler such as
Schedulers.io() that can block and wait on the Future
Future
public static final <T> Observable<T> from(Iterable <? extends T> iterable)
Iterable sequence into an Observable that emits the items in the sequence.
from 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
iterable - the source
Iterable sequence
Iterable sequence
public static final <T> Observable<T> from(T[] array)
from 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
array - the source Array
public static final Observable<Long > interval(long interval, TimeUnit unit)
interval operates by default on the
computation
Scheduler.
interval - interval size in time units (see below)
unit - time units to use for the interval size
public static final Observable<Long > interval(long interval, TimeUnit unit, Scheduler scheduler)
Scheduler this operator will use
interval - interval size in time units (see below)
unit - time units to use for the interval size
scheduler - the Scheduler to use for scheduling the items
public static final <T> Observable<T> just(T value)
To convert any object into an Observable that emits that object, pass that object into the just method.
This is similar to the from(java.lang.Object[]) method, except that from will convert an Iterable object into an Observable that emits each of the items in the Iterable, one at a time, while the just method converts an Iterable into an Observable that emits the entire Iterable as a single item.
just does not operate by default on a particular
Scheduler.
T - the type of that item
value - the item to emit
value as a single item and then completes
public static final <T> Observable<T> just(T t1, T t2)
just does not operate by default on a particular
Scheduler.
T - the type of these items
t1 - first item
t2 - second item
public static final <T> Observable<T> just(T t1, T t2, T t3)
just does not operate by default on a particular
Scheduler.
T - the type of these items
t1 - first item
t2 - second item
t3 - third item
public static final <T> Observable<T> just(T t1, T t2, T t3, T t4)
just does not operate by default on a particular
Scheduler.
T - the type of these items
t1 - first item
t2 - second item
t3 - third item
t4 - fourth item
public static final <T> Observable<T> just(T t1, T t2, T t3, T t4, T t5)
just does not operate by default on a particular
Scheduler.
T - the type of these items
t1 - first item
t2 - second item
t3 - third item
t4 - fourth item
t5 - fifth item
public static final <T> Observable<T> just(T t1, T t2, T t3, T t4, T t5, T t6)
just does not operate by default on a particular
Scheduler.
T - the type of these items
t1 - first item
t2 - second item
t3 - third item
t4 - fourth item
t5 - fifth item
t6 - sixth item
public static final <T> Observable<T> just(T t1, T t2, T t3, T t4, T t5, T t6, T t7)
just does not operate by default on a particular
Scheduler.
T - the type of these items
t1 - first item
t2 - second item
t3 - third item
t4 - fourth item
t5 - fifth item
t6 - sixth item
t7 - seventh item
public static final <T> Observable<T> just(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8)
just does not operate by default on a particular
Scheduler.
T - the type of these items
t1 - first item
t2 - second item
t3 - third item
t4 - fourth item
t5 - fifth item
t6 - sixth item
t7 - seventh item
t8 - eighth item
public static final <T> Observable<T> just(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8, T t9)
just does not operate by default on a particular
Scheduler.
T - the type of these items
t1 - first item
t2 - second item
t3 - third item
t4 - fourth item
t5 - fifth item
t6 - sixth item
t7 - seventh item
t8 - eighth item
t9 - ninth item
public static final <T> Observable<T> just(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8, T t9, T t10)
just does not operate by default on a particular
Scheduler.
T - the type of these items
t1 - first item
t2 - second item
t3 - third item
t4 - fourth item
t5 - fifth item
t6 - sixth item
t7 - seventh item
t8 - eighth item
t9 - ninth item
t10 - tenth item
public static final <T> Observable<T> merge(Iterable <? extends Observable <? extends T>> sequences)
You can combine the items emitted by multiple Observables so that they appear as a single Observable, by using the merge method.
merge does not operate by default on a particular
Scheduler.
sequences - the Iterable of Observables
public static final <T> Observable<T> merge(Iterable <? extends Observable <? extends T>> sequences, int maxConcurrent)
You can combine the items emitted by multiple Observables so that they appear as a single Observable, by using the merge method.
merge does not operate by default on a particular
Scheduler.
sequences - the Iterable of Observables
maxConcurrent - the maximum number of Observables that may be subscribed to concurrently
IllegalArgumentException - if
maxConcurrent is less than or equal to 0
public static final <T> Observable<T> merge(Observable <? extends Observable <? extends T>> source)
You can combine the items emitted by multiple Observables so that they appear as a single Observable, by using the merge method.
merge does not operate by default on a particular
Scheduler.
source - an Observable that emits Observables
source Observable
public static final <T> Observable<T> merge(Observable <? extends Observable <? extends T>> source, int maxConcurrent)
You can combine the items emitted by multiple Observables so that they appear as a single Observable, by using the merge method.
merge does not operate by default on a particular
Scheduler.
source - an Observable that emits Observables
maxConcurrent - the maximum number of Observables that may be subscribed to concurrently
source Observable
IllegalArgumentException - if
maxConcurrent is less than or equal to 0
public static final <T> Observable<T> merge(Observable <? extends T> t1, Observable <? extends T> t2)
You can combine items emitted by multiple Observables so that they appear as a single Observable, by using the merge method.
merge does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
t2 - an Observable to be merged
public static final <T> Observable<T> merge(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3)
You can combine items emitted by multiple Observables so that they appear as a single Observable, by using the merge method.
merge does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
public static final <T> Observable<T> merge(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4)
You can combine items emitted by multiple Observables so that they appear as a single Observable, by using the merge method.
merge does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
public static final <T> Observable<T> merge(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4, Observable <? extends T> t5)
You can combine items emitted by multiple Observables so that they appear as a single Observable, by using the merge method.
merge does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
public static final <T> Observable<T> merge(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4, Observable <? extends T> t5, Observable <? extends T> t6)
You can combine items emitted by multiple Observables so that they appear as a single Observable, by using the merge method.
merge does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
t6 - an Observable to be merged
public static final <T> Observable<T> merge(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4, Observable <? extends T> t5, Observable <? extends T> t6, Observable <? extends T> t7)
You can combine items emitted by multiple Observables so that they appear as a single Observable, by using the merge method.
merge does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
t6 - an Observable to be merged
t7 - an Observable to be merged
public static final <T> Observable<T> merge(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4, Observable <? extends T> t5, Observable <? extends T> t6, Observable <? extends T> t7, Observable <? extends T> t8)
You can combine items emitted by multiple Observables so that they appear as a single Observable, by using the merge method.
merge does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
t6 - an Observable to be merged
t7 - an Observable to be merged
t8 - an Observable to be merged
public static final <T> Observable<T> merge(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4, Observable <? extends T> t5, Observable <? extends T> t6, Observable <? extends T> t7, Observable <? extends T> t8, Observable <? extends T> t9)
You can combine items emitted by multiple Observables so that they appear as a single Observable, by using the merge method.
merge does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
t6 - an Observable to be merged
t7 - an Observable to be merged
t8 - an Observable to be merged
t9 - an Observable to be merged
public static final <T> Observable<T> merge(Observable <? extends T>[] sequences)
You can combine items emitted by multiple Observables so that they appear as a single Observable, by using the merge method.
merge does not operate by default on a particular
Scheduler.
sequences - the Array of Observables
public static final <T> Observable<T> mergeDelayError(Observable <? extends Observable <? extends T>> source)
This behaves like merge(Observable) except that if any of the merged Observables notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Observables have finished emitting items.
Even if multiple merged Observables send onError notifications, mergeDelayError will only invoke the onError method of its Observers once.
mergeDelayError does not operate by default on a particular
Scheduler.
source - an Observable that emits Observables
source Observable
public static final <T> Observable<T> mergeDelayError(Observable <? extends T> t1, Observable <? extends T> t2)
This behaves like merge(Observable, Observable) except that if any of the merged Observables notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Observables have finished emitting items.
Even if both merged Observables send onError notifications, mergeDelayError will only invoke the onError method of its Observers once.
mergeDelayError does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
t2 - an Observable to be merged
public static final <T> Observable<T> mergeDelayError(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3)
This behaves like merge(Observable, Observable, Observable) except that if any of the merged Observables notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Observables have finished emitting items.
Even if multiple merged Observables send onError notifications, mergeDelayError will only invoke the onError method of its Observers once.
mergeDelayError does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
public static final <T> Observable<T> mergeDelayError(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4)
This behaves like merge(Observable, Observable, Observable, Observable) except that if any of the merged Observables notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Observables have finished emitting items.
Even if multiple merged Observables send onError notifications, mergeDelayError will only invoke the onError method of its Observers once.
mergeDelayError does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
public static final <T> Observable<T> mergeDelayError(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4, Observable <? extends T> t5)
This behaves like merge(Observable, Observable, Observable, Observable, Observable) except that if any of the merged Observables notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Observables have finished emitting items.
Even if multiple merged Observables send onError notifications, mergeDelayError will only invoke the onError method of its Observers once.
mergeDelayError does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
public static final <T> Observable<T> mergeDelayError(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4, Observable <? extends T> t5, Observable <? extends T> t6)
This behaves like merge(Observable, Observable, Observable, Observable, Observable, Observable) except that if any of the merged Observables notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Observables have finished emitting items.
Even if multiple merged Observables send onError notifications, mergeDelayError will only invoke the onError method of its Observers once.
mergeDelayError does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
t6 - an Observable to be merged
public static final <T> Observable<T> mergeDelayError(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4, Observable <? extends T> t5, Observable <? extends T> t6, Observable <? extends T> t7)
This behaves like merge(Observable, Observable, Observable, Observable, Observable, Observable, Observable) except that if any of the merged Observables notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Observables have finished emitting items.
Even if multiple merged Observables send onError notifications, mergeDelayError will only invoke the onError method of its Observers once.
mergeDelayError does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
t6 - an Observable to be merged
t7 - an Observable to be merged
public static final <T> Observable<T> mergeDelayError(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4, Observable <? extends T> t5, Observable <? extends T> t6, Observable <? extends T> t7, Observable <? extends T> t8)
This behaves like merge(Observable, Observable, Observable, Observable, Observable, Observable, Observable, Observable) except that if any of the merged Observables notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Observables have finished emitting items.
Even if multiple merged Observables send onError notifications, mergeDelayError will only invoke the onError method of its Observers once.
mergeDelayError does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
t6 - an Observable to be merged
t7 - an Observable to be merged
t8 - an Observable to be merged
public static final <T> Observable<T> mergeDelayError(Observable <? extends T> t1, Observable <? extends T> t2, Observable <? extends T> t3, Observable <? extends T> t4, Observable <? extends T> t5, Observable <? extends T> t6, Observable <? extends T> t7, Observable <? extends T> t8, Observable <? extends T> t9)
This behaves like merge(Observable, Observable, Observable, Observable, Observable, Observable, Observable, Observable, Observable) except that if any of the merged Observables notify of an error via onError, mergeDelayError will refrain from propagating that error notification until all of the merged Observables have finished emitting items.
Even if multiple merged Observables send onError notifications, mergeDelayError will only invoke the onError method of its Observers once.
mergeDelayError does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
t6 - an Observable to be merged
t7 - an Observable to be merged
t8 - an Observable to be merged
t9 - an Observable to be merged
public final Observable<Observable <T>> nest()
Observable<T> into an
Observable<Observable<T>> that emits the source Observable as its single emission.
nest does not operate by default on a particular
Scheduler.
public static final <T> Observable<T> never()
Observer.
This Observable is useful primarily for testing purposes.
never does not operate by default on a particular
Scheduler.
T - the type of items (not) emitted by the Observable
Observer
public static final Observable<Integer > range(int start, int count)
range does not operate by default on a particular
Scheduler.
start - the value of the first Integer in the sequence
count - the number of sequential Integers to generate
IllegalArgumentException - if
count is less than zero, or if
start +
count − 1 exceeds
Integer.MAX_VALUE
public static final Observable<Integer > range(int start, int count, Scheduler scheduler)
Scheduler this operator will use
start - the value of the first Integer in the sequence
count - the number of sequential Integers to generate
scheduler - the Scheduler to run the generator loop on
public static final <T> Observable<Boolean > sequenceEqual(Observable <? extends T> first, Observable <? extends T> second)
sequenceEqual does not operate by default on a particular
Scheduler.
T - the type of items emitted by each Observable
first - the first Observable to compare
second - the second Observable to compare
public static final <T> Observable<Boolean > sequenceEqual(Observable <? extends T> first, Observable <? extends T> second, Func2 <? super T ,? super T ,Boolean > equality)
sequenceEqual does not operate by default on a particular
Scheduler.
T - the type of items emitted by each Observable
first - the first Observable to compare
second - the second Observable to compare
equality - a function used to compare items emitted by each Observable
public static final <T> Observable<T> switchOnNext(Observable <? extends Observable <? extends T>> sequenceOfSequences)
switchOnNext subscribes to an Observable that emits Observables. Each time it observes one of these emitted Observables, the Observable returned by switchOnNext begins emitting the items emitted by that Observable. When a new Observable is emitted, switchOnNext stops emitting items from the earlier-emitted Observable and begins emitting items from the new one.
switchOnNext does not operate by default on a particular
Scheduler.
T - the item type
sequenceOfSequences - the source Observable that emits Observables
public static final Observable<Long > timer(long initialDelay, long period, TimeUnit unit)
0L after the
initialDelay and ever increasing numbers after each
period of time thereafter.
onBackpressureDrop().
timer operates by default on the
computation
Scheduler.
initialDelay - the initial delay time to wait before emitting the first value of 0L
period - the period of time between emissions of the subsequent numbers
unit - the time unit for both
initialDelay and
period
initialDelay and ever increasing numbers after each
period of time thereafter
public static final Observable<Long > timer(long initialDelay, long period, TimeUnit unit, Scheduler scheduler)
0L after the
initialDelay and ever increasing numbers after each
period of time thereafter, on a specified
Scheduler.
onBackpressureDrop().
Scheduler this operator will use
initialDelay - the initial delay time to wait before emitting the first value of 0L
period - the period of time between emissions of the subsequent numbers
unit - the time unit for both
initialDelay and
period
scheduler - the Scheduler on which the waiting happens and items are emitted
initialDelay and ever increasing numbers after each
period of time thereafter, while running on the given Scheduler
public static final Observable<Long > timer(long delay, TimeUnit unit)
onBackpressureDrop().
timer operates by default on the
computation
Scheduler.
delay - the initial delay before emitting a single
0L
unit - time units to use for
delay
public static final Observable<Long > timer(long delay, TimeUnit unit, Scheduler scheduler)
onBackpressureDrop().
Scheduler this operator will use
delay - the initial delay before emitting a single 0L
unit - time units to use for
delay
scheduler - the
Scheduler to use for scheduling the item
public static final <T,Resource> Observable <T> using(Func0 <Resource> resourceFactory, Func1 <? super Resource ,? extends Observable <? extends T>> observableFactory, Action1 <? super Resource> disposeAction)
using does not operate by default on a particular
Scheduler.
resourceFactory - the factory function to create a resource object that depends on the Observable
observableFactory - the factory function to create an Observable
disposeAction - the function that will dispose of the resource
public static final <R> Observable<R> zip(Iterable <? extends Observable <?>> ws, FuncN <? extends R> zipFunction)
zip applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by each of the source Observables; the second item emitted by the new Observable will be the result of the function applied to the second item emitted by each of those Observables; and so forth.
The resulting Observable<R> returned from zip will invoke onNext as many times as the number of onNext invokations of the source Observable that emits the fewest items.
zip does not operate by default on a particular
Scheduler.
ws - an Iterable of source Observables
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
public static final <R> Observable<R> zip(Observable <? extends Observable <?>> ws, FuncN <? extends R> zipFunction)
zip applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by each of the Observables emitted by the source Observable; the second item emitted by the new Observable will be the result of the function applied to the second item emitted by each of those Observables; and so forth.
The resulting Observable<R> returned from zip will invoke onNext as many times as the number of onNext invokations of the source Observable that emits the fewest items.
zip does not operate by default on a particular
Scheduler.
ws - an Observable of source Observables
zipFunction - a function that, when applied to an item emitted by each of the Observables emitted by
ws, results in an item that will be emitted by the resulting Observable
public static final <T1,T2 ,R> Observable <R> zip(Observable <? extends T1> o1, Observable <? extends T2> o2, Func2 <? super T1 ,? super T2 ,? extends R> zipFunction)
zip applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by o1 and the first item emitted by o2; the second item emitted by the new Observable will be the result of the function applied to the second item emitted by o1 and the second item emitted by o2; and so forth.
The resulting Observable<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Observable that emits the fewest items.
zip does not operate by default on a particular
Scheduler.
o1 - the first source Observable
o2 - a second source Observable
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
public static final <T1,T2 ,T3 ,R> Observable <R> zip(Observable <? extends T1> o1, Observable <? extends T2> o2, Observable <? extends T3> o3, Func3 <? super T1 ,? super T2 ,? super T3 ,? extends R> zipFunction)
zip applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by o1, the first item emitted by o2, and the first item emitted by o3; the second item emitted by the new Observable will be the result of the function applied to the second item emitted by o1, the second item emitted by o2, and the second item emitted by o3; and so forth.
The resulting Observable<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Observable that emits the fewest items.
zip does not operate by default on a particular
Scheduler.
o1 - the first source Observable
o2 - a second source Observable
o3 - a third source Observable
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
public static final <T1,T2 ,T3 ,T4 ,R> Observable <R> zip(Observable <? extends T1> o1, Observable <? extends T2> o2, Observable <? extends T3> o3, Observable <? extends T4> o4, Func4 <? super T1 ,? super T2 ,? super T3 ,? super T4 ,? extends R> zipFunction)
zip applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by o1, the first item emitted by o2, the first item emitted by o3, and the first item emitted by 04; the second item emitted by the new Observable will be the result of the function applied to the second item emitted by each of those Observables; and so forth.
The resulting Observable<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Observable that emits the fewest items.
zip does not operate by default on a particular
Scheduler.
o1 - the first source Observable
o2 - a second source Observable
o3 - a third source Observable
o4 - a fourth source Observable
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
public static final <T1,T2 ,T3 ,T4 ,T5 ,R> Observable <R> zip(Observable <? extends T1> o1, Observable <? extends T2> o2, Observable <? extends T3> o3, Observable <? extends T4> o4, Observable <? extends T5> o5, Func5 <? super T1 ,? super T2 ,? super T3 ,? super T4 ,? super T5 ,? extends R> zipFunction)
zip applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by o1, the first item emitted by o2, the first item emitted by o3, the first item emitted by o4, and the first item emitted by o5; the second item emitted by the new Observable will be the result of the function applied to the second item emitted by each of those Observables; and so forth.
The resulting Observable<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Observable that emits the fewest items.
zip does not operate by default on a particular
Scheduler.
o1 - the first source Observable
o2 - a second source Observable
o3 - a third source Observable
o4 - a fourth source Observable
o5 - a fifth source Observable
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
public static final <T1,T2 ,T3 ,T4 ,T5 ,T6 ,R> Observable <R> zip(Observable <? extends T1> o1, Observable <? extends T2> o2, Observable <? extends T3> o3, Observable <? extends T4> o4, Observable <? extends T5> o5, Observable <? extends T6> o6, Func6 <? super T1 ,? super T2 ,? super T3 ,? super T4 ,? super T5 ,? super T6 ,? extends R> zipFunction)
zip applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by each source Observable, the second item emitted by the new Observable will be the result of the function applied to the second item emitted by each of those Observables, and so forth.
The resulting Observable<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Observable that emits the fewest items.
zip does not operate by default on a particular
Scheduler.
o1 - the first source Observable
o2 - a second source Observable
o3 - a third source Observable
o4 - a fourth source Observable
o5 - a fifth source Observable
o6 - a sixth source Observable
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
public static final <T1,T2 ,T3 ,T4 ,T5 ,T6 ,T7 ,R> Observable <R> zip(Observable <? extends T1> o1, Observable <? extends T2> o2, Observable <? extends T3> o3, Observable <? extends T4> o4, Observable <? extends T5> o5, Observable <? extends T6> o6, Observable <? extends T7> o7, Func7 <? super T1 ,? super T2 ,? super T3 ,? super T4 ,? super T5 ,? super T6 ,? super T7 ,? extends R> zipFunction)
zip applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by each source Observable, the second item emitted by the new Observable will be the result of the function applied to the second item emitted by each of those Observables, and so forth.
The resulting Observable<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Observable that emits the fewest items.
zip does not operate by default on a particular
Scheduler.
o1 - the first source Observable
o2 - a second source Observable
o3 - a third source Observable
o4 - a fourth source Observable
o5 - a fifth source Observable
o6 - a sixth source Observable
o7 - a seventh source Observable
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
public static final <T1,T2 ,T3 ,T4 ,T5 ,T6 ,T7 ,T8 ,R> Observable <R> zip(Observable <? extends T1> o1, Observable <? extends T2> o2, Observable <? extends T3> o3, Observable <? extends T4> o4, Observable <? extends T5> o5, Observable <? extends T6> o6, Observable <? extends T7> o7, Observable <? extends T8> o8, Func8 <? super T1 ,? super T2 ,? super T3 ,? super T4 ,? super T5 ,? super T6 ,? super T7 ,? super T8 ,? extends R> zipFunction)
zip applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by each source Observable, the second item emitted by the new Observable will be the result of the function applied to the second item emitted by each of those Observables, and so forth.
The resulting Observable<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Observable that emits the fewest items.
zip does not operate by default on a particular
Scheduler.
o1 - the first source Observable
o2 - a second source Observable
o3 - a third source Observable
o4 - a fourth source Observable
o5 - a fifth source Observable
o6 - a sixth source Observable
o7 - a seventh source Observable
o8 - an eighth source Observable
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
public static final <T1,T2 ,T3 ,T4 ,T5 ,T6 ,T7 ,T8 ,T9 ,R> Observable <R> zip(Observable <? extends T1> o1, Observable <? extends T2> o2, Observable <? extends T3> o3, Observable <? extends T4> o4, Observable <? extends T5> o5, Observable <? extends T6> o6, Observable <? extends T7> o7, Observable <? extends T8> o8, Observable <? extends T9> o9, Func9 <? super T1 ,? super T2 ,? super T3 ,? super T4 ,? super T5 ,? super T6 ,? super T7 ,? super T8 ,? super T9 ,? extends R> zipFunction)
zip applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by each source Observable, the second item emitted by the new Observable will be the result of the function applied to the second item emitted by each of those Observables, and so forth.
The resulting Observable<R> returned from zip will invoke onNext as many times as the number of onNext invocations of the source Observable that emits the fewest items.
zip does not operate by default on a particular
Scheduler.
o1 - the first source Observable
o2 - a second source Observable
o3 - a third source Observable
o4 - a fourth source Observable
o5 - a fifth source Observable
o6 - a sixth source Observable
o7 - a seventh source Observable
o8 - an eighth source Observable
o9 - a ninth source Observable
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
public final Observable<Boolean > all(Func1 <? super T ,Boolean > predicate)
all does not operate by default on a particular
Scheduler.
predicate - a function that evaluates an item and returns a Boolean
true if all items emitted by the source Observable satisfy the predicate; otherwise,
false
public final Observable<T> ambWith(Observable <? extends T> t1)
amb does not operate by default on a particular
Scheduler.
t1 - an Observable competing to react first
public final Observable<T> asObservable()
asObservable does not operate by default on a particular
Scheduler.
public final <TClosing> Observable<List <T>> buffer(Func0 <? extends Observable <? extends TClosing>> bufferClosingSelector)
bufferClosingSelector emits an item.
Long.MAX_VALUE upstream and does not obey downstream requests.
buffer does not operate by default on a particular
Scheduler.
bufferClosingSelector - a
Func0 that produces an Observable that governs the boundary between buffers. Whenever this
Observable emits an item,
buffer emits the current buffer and begins to fill a new one
bufferClosingSelector argument emits an item
public final Observable<List <T>> buffer(int count)
count items. When the source Observable completes or encounters an error, the resulting Observable emits the current buffer and propagates the notification from the source Observable.
buffer does not operate by default on a particular
Scheduler.
count - the maximum number of items in each buffer before it should be emitted
count items from the source Observable
public final Observable<List <T>> buffer(int count, int skip)
skip items, each containing
count items. When the source Observable completes or encounters an error, the resulting Observable emits the current buffer and propagates the notification from the source Observable.
buffer does not operate by default on a particular
Scheduler.
count - the maximum size of each buffer before it should be emitted
skip - how many items emitted by the source Observable should be skipped before starting a new buffer. Note that when
skip and
count are equal, this is the same operation as
buffer(int).
skip item from the source Observable and containing at most
count items
public final Observable<List <T>> buffer(long timespan, long timeshift, TimeUnit unit)
timeshift argument. It emits each buffer after a fixed timespan, specified by the
timespan argument. When the source Observable completes or encounters an error, the resulting Observable emits the current buffer and propagates the notification from the source Observable.
Long.MAX_VALUE upstream and does not obey downstream requests.
buffer operates by default on the
computation
Scheduler.
timespan - the period of time each buffer collects items before it is emitted
timeshift - the period of time after which a new buffer will be created
unit - the unit of time that applies to the
timespan and
timeshift arguments
public final Observable<List <T>> buffer(long timespan, long timeshift, TimeUnit unit, Scheduler scheduler)
timeshift argument, and on the specified
scheduler. It emits each buffer after a fixed timespan, specified by the
timespan argument. When the source Observable completes or encounters an error, the resulting Observable emits the current buffer and propagates the notification from the source Observable.
Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler this operator will use
timespan - the period of time each buffer collects items before it is emitted
timeshift - the period of time after which a new buffer will be created
unit - the unit of time that applies to the
timespan and
timeshift arguments
scheduler - the
Scheduler to use when determining the end and start of a buffer
public final Observable<List <T>> buffer(long timespan, TimeUnit unit)
timespan argument. When the source Observable completes or encounters an error, the resulting Observable emits the current buffer and propagates the notification from the source Observable.
Long.MAX_VALUE upstream and does not obey downstream requests.
buffer operates by default on the
computation
Scheduler.
timespan - the period of time each buffer collects items before it is emitted and replaced with a new buffer
unit - the unit of time that applies to the
timespan argument
public final Observable<List <T>> buffer(long timespan, TimeUnit unit, int count)
timespan argument or a maximum size specified by the
count argument (whichever is reached first). When the source Observable completes or encounters an error, the resulting Observable emits the current buffer and propagates the notification from the source Observable.
Long.MAX_VALUE upstream and does not obey downstream requests.
buffer operates by default on the
computation
Scheduler.
timespan - the period of time each buffer collects items before it is emitted and replaced with a new buffer
unit - the unit of time which applies to the
timespan argument
count - the maximum size of each buffer before it is emitted
public final Observable<List <T>> buffer(long timespan, TimeUnit unit, int count, Scheduler scheduler)
timespan argument as measured on the specified
scheduler, or a maximum size specified by the
count argument (whichever is reached first). When the source Observable completes or encounters an error, the resulting Observable emits the current buffer and propagates the notification from the source Observable.
Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler this operator will use
timespan - the period of time each buffer collects items before it is emitted and replaced with a new buffer
unit - the unit of time which applies to the
timespan argument
count - the maximum size of each buffer before it is emitted
scheduler - the
Scheduler to use when determining the end and start of a buffer
public final Observable<List <T>> buffer(long timespan, TimeUnit unit, Scheduler scheduler)
timespan argument and on the specified
scheduler. When the source Observable completes or encounters an error, the resulting Observable emits the current buffer and propagates the notification from the source Observable.
Long.MAX_VALUE upstream and does not obey downstream requests.
Scheduler this operator will use
timespan - the period of time each buffer collects items before it is emitted and replaced with a new buffer
unit - the unit of time which applies to the
timespan argument
scheduler - the
Scheduler to use when determining the end and start of a buffer
public final <TOpening,TClosing> Observable <List <T>> buffer(Observable <? extends TOpening> bufferOpenings, Func1 <? super TOpening ,? extends Observable <? extends TClosing>> bufferClosingSelector)
bufferOpenings Observable emits an item, and closes when the Observable returned from
bufferClosingSelector emits an item.
Long.MAX_VALUE upstream and does not obey downstream requests.
buffer does not operate by default on a particular
Scheduler.
bufferOpenings - the Observable that, when it emits an item, causes a new buffer to be created
bufferClosingSelector - the
Func1 that is used to produce an Observable for every buffer created. When this Observable emits an item, the associated buffer is emitted.
public final <B> Observable<List <T>> buffer(Observable <B> boundary)
Completion of either the source or the boundary Observable causes the returned Observable to emit the latest buffer and complete.
Observable
boundary and buffers data. It requests
Long.MAX_VALUE upstream and does not obey downstream requests.
buffer does not operate by default on a particular
Scheduler.
B - the boundary value type (ignored)
boundary - the boundary Observable
buffer(rx.Observable, int),
RxJava wiki: buffer
public final <B> Observable<List <T>> buffer(Observable <B> boundary, int initialCapacity)
Completion of either the source or the boundary Observable causes the returned Observable to emit the latest buffer and complete.
Observable
boundary and buffers data. It requests
Long.MAX_VALUE upstream and does not obey downstream requests.
buffer does not operate by default on a particular
Scheduler.
B - the boundary value type (ignored)
boundary - the boundary Observable
initialCapacity - the initial capacity of each buffer chunk
buffer(rx.Observable, int)
public final Observable<T> cache()
replay() except that this auto-subscribes to the source Observable rather than returning a
ConnectableObservable for which you must call
connect to activate the subscription.
This is useful when you want an Observable to cache responses and you can't control the subscribe/unsubscribe behavior of all the Subscribers.
When you call cache, it does not yet subscribe to the source Observable and so does not yet begin cacheing items. This only happens when the first Subscriber calls the resulting Observable's subscribe method.
Note: You sacrifice the ability to unsubscribe from the origin when you use the cache Observer so be careful not to use this Observer on Observables that emit an infinite or very large number of items that will use up memory.
cache does not operate by default on a particular
Scheduler.
public final Observable<T> cache(int capacity)
replay() except that this auto-subscribes to the source Observable rather than returning a
ConnectableObservable for which you must call
connect to activate the subscription.
This is useful when you want an Observable to cache responses and you can't control the subscribe/unsubscribe behavior of all the Subscribers.
When you call cache, it does not yet subscribe to the source Observable and so does not yet begin cacheing items. This only happens when the first Subscriber calls the resulting Observable's subscribe method.
Note: You sacrifice the ability to unsubscribe from the origin when you use the cache Observer so be careful not to use this Observer on Observables that emit an infinite or very large number of items that will use up memory.
cache does not operate by default on a particular
Scheduler.
capacity - hint for number of items to cache (for optimizing underlying data structure)
public final <R> Observable<R> cast(Class <R> klass)
cast does not operate by default on a particular
Scheduler.
klass - the target class type that
cast will cast the items emitted by the source Observable into before emitting them from the resulting Observable
public final <R> Observable<R> collect(Func0 <R> stateFactory, Action2 <R ,? super T> collector)
This is a simplified version of reduce that does not need to return the state on each pass.
onNext.
collect does not operate by default on a particular
Scheduler.
stateFactory - the mutable data structure that will collect the items
collector - a function that accepts the
state and an emitted item, and modifies
state accordingly
public final <R> Observable<R> concatMap(Func1 <? super T ,? extends Observable <? extends R>> func)
concatMap does not operate by default on a particular
Scheduler.
func - a function that, when applied to an item emitted by the source Observable, returns an Observable
public final Observable<T> concatWith(Observable <? extends T> t1)
concat does not operate by default on a particular
Scheduler.
t1 - an Observable to be concatenated after the current
public final Observable<Boolean > contains(Object element)
contains does not operate by default on a particular
Scheduler.
element - the item to search for in the emissions from the source Observable
true if the specified item is emitted by the source Observable, or
false if the source Observable completes without emitting that item
public final Observable<Integer > count()
onNext.
count does not operate by default on a particular
Scheduler.
countLong()
public final Observable<Long > countLong()
onNext.
countLong does not operate by default on a particular
Scheduler.
count()
public final <U> Observable<T> debounce(Func1 <? super T ,? extends Observable <U>> debounceSelector)
debounceSelector to mark boundaries.
debounce does not operate by default on a particular
Scheduler.
U - the debounce value type (ignored)
debounceSelector - function to retrieve a sequence that indicates the throttle duration for each item
public final Observable<T> debounce(long timeout, TimeUnit unit)
Note: If items keep being emitted by the source Observable faster than the timeout then no items will be emitted by the resulting Observable.
Information on debounce vs throttle:
debounce operates by default on the
computation
Scheduler.
timeout - the time each item has to be "the most recent" of those emitted by the source Observable to ensure that it's not dropped
unit - the
TimeUnit for the timeout
throttleWithTimeout(long, TimeUnit)
public final Observable<T> debounce(long timeout, TimeUnit unit, Scheduler scheduler)
Note: If items keep being emitted by the source Observable faster than the timeout then no items will be emitted by the resulting Observable.
Information on debounce vs throttle:
Scheduler this operator will use
timeout - the time each item has to be "the most recent" of those emitted by the source Observable to ensure that it's not dropped
unit - the unit of time for the specified timeout
scheduler - the
Scheduler to use internally to manage the timers that handle the timeout for each item
throttleWithTimeout(long, TimeUnit, Scheduler)
public final Observable<T> defaultIfEmpty(T defaultValue)
defaultIfEmpty does not operate by default on a particular
Scheduler.
defaultValue - the item to emit if the source Observable emits no items
public final <U,V> Observable <T> delay(Func0 <? extends Observable <U>> subscriptionDelay, Func1 <? super T ,? extends Observable <V>> itemDelay)
Note: the resulting Observable will immediately propagate any onError notification from the source Observable.
delay does not operate by default on a particular
Scheduler.
U - the subscription delay value type (ignored)
V - the item delay value type (ignored)
subscriptionDelay - a function that returns an Observable that triggers the subscription to the source Observable once it emits any item
itemDelay - a function that returns an Observable for each item emitted by the source Observable, which is then used to delay the emission of that item by the resulting Observable until the Observable returned from
itemDelay emits an item
public final <U> Observable<T> delay(Func1 <? super T ,? extends Observable <U>> itemDelay)
Note: the resulting Observable will immediately propagate any onError notification from the source Observable.
delay does not operate by default on a particular
Scheduler.
U - the item delay value type (ignored)
itemDelay - a function that returns an Observable for each item emitted by the source Observable, which is then used to delay the emission of that item by the resulting Observable until the Observable returned from
itemDelay emits an item
public final Observable<T> delay(long delay, TimeUnit unit)
delay operates by default on the
compuation
Scheduler.
delay - the delay to shift the source by
unit - the
TimeUnit in which
period is defined
public final Observable<T> delay(long delay, TimeUnit unit, Scheduler scheduler)
Scheduler this operator will use
delay - the delay to shift the source by
unit - the time unit of
delay
scheduler - the
Scheduler to use for delaying
public final Observable<T> delaySubscription(long delay, TimeUnit unit)
delay operates by default on the
compuation
Scheduler.
delay - the time to delay the subscription
unit - the time unit of
delay
public final Observable<T> delaySubscription(long delay, TimeUnit unit, Scheduler scheduler)
Scheduler this operator will use
delay - the time to delay the subscription
unit - the time unit of
delay
scheduler - the Scheduler on which the waiting and subscription will happen
public final <U> Observable<T> delaySubscription(Func0 <? extends Observable <U>> subscriptionDelay)
delay operates by default on the
compuation
Scheduler.
subscriptionDelay - a function that returns an Observable that triggers the subscription to the source Observable once it emits any item
subscriptionDelay emits an item
public final <T2> Observable<T2> dematerialize()
materialize by transforming the
Notification objects emitted by the source Observable into the items or notifications they represent.
dematerialize does not operate by default on a particular
Scheduler.
Notification objects emitted by the source Observable
OnErrorNotImplementedException - if the source Observable is not of type
Observable<Notification<T>>
public final Observable<T> distinct()
distinct does not operate by default on a particular
Scheduler.
public final <U> Observable<T> distinct(Func1 <? super T ,? extends U> keySelector)
distinct does not operate by default on a particular
Scheduler.
keySelector - a function that projects an emitted item to a key value that is used to decide whether an item is distinct from another one or not
public final Observable<T> distinctUntilChanged()
distinctUntilChanged does not operate by default on a particular
Scheduler.
public final <U> Observable<T> distinctUntilChanged(Func1 <? super T ,? extends U> keySelector)
distinctUntilChanged does not operate by default on a particular
Scheduler.
keySelector - a function that projects an emitted item to a key value that is used to decide whether an item is distinct from another one or not
public final Observable<T> doOnCompleted(Action0 onCompleted)
onCompleted.
doOnCompleted does not operate by default on a particular
Scheduler.
onCompleted - the action to invoke when the source Observable calls
onCompleted
public final Observable<T> doOnEach(Action1 <Notification <? super T>> onNotification)
doOnEach does not operate by default on a particular
Scheduler.
onNotification - the action to invoke for each item emitted by the source Observable
public final Observable<T> doOnEach(Observer <? super T> observer)
doOnEach does not operate by default on a particular
Scheduler.
observer - the action to invoke for each item emitted by the source Observable
public final Observable<T> doOnError(Action1 <Throwable > onError)
onError.
doOnError does not operate by default on a particular
Scheduler.
onError - the action to invoke if the source Observable calls
onError
public final Observable<T> doOnNext(Action1 <? super T> onNext)
onNext.
doOnNext does not operate by default on a particular
Scheduler.
onNext - the action to invoke when the source Observable calls
onNext
public final Observable<T> doOnSubscribe(Action0 subscribe)
Observable so that it invokes the given action when it is subscribed from its subscribers. Each subscription will result in an invocation of the given action except when the source
Observable is reference counted, in which case the source
Observable will invoke the given action for the first subscription.
doOnSubscribe does not operate by default on a particular
Scheduler.
subscribe - the action that gets called when an observer subscribes to this
Observable
Observable modified so as to call this Action when appropriate
public final Observable<T> doOnTerminate(Action0 onTerminate)
onCompleted or
onError.
This differs from finallyDo in that this happens before the onCompleted or onError notification.
doOnTerminate does not operate by default on a particular
Scheduler.
onTerminate - the action to invoke when the source Observable calls
onCompleted or
onError
finallyDo(Action0)
public final Observable<T> doOnUnsubscribe(Action0 unsubscribe)
Observable so that it invokes the given action when it is unsubscribed from its subscribers. Each un-subscription will result in an invocation of the given action except when the source
Observable is reference counted, in which case the source
Observable will invoke the given action for the very last un-subscription.
doOnUnsubscribe does not operate by default on a particular
Scheduler.
unsubscribe - the action that gets called when this
Observable is unsubscribed
Observable modified so as to call this Action when appropriate
public final Observable<T> elementAt(int index)
elementAt does not operate by default on a particular
Scheduler.
index - the zero-based index of the item to retrieve
IndexOutOfBoundsException - if
index is greater than or equal to the number of items emitted by the source Observable, or if
index is less than 0
public final Observable<T> elementAtOrDefault(int index, T defaultValue)
elementAtOrDefault does not operate by default on a particular
Scheduler.
index - the zero-based index of the item to retrieve
defaultValue - the default item
IndexOutOfBoundsException - if
index is less than 0
public final Observable<Boolean > exists(Func1 <? super T ,Boolean > predicate)
true if any item emitted by the source Observable satisfies a specified condition, otherwise
false.
Note: this always emits
false if the source Observable is empty.
In Rx.Net this is the any Observer but we renamed it in RxJava to better match Java naming idioms.
exists does not operate by default on a particular
Scheduler.
predicate - the condition to test items emitted by the source Observable
predicate
public final Observable<T> filter(Func1 <? super T ,Boolean > predicate)
filter does not operate by default on a particular
Scheduler.
predicate - a function that evaluates each item emitted by the source Observable, returning
true if it passes the filter
true
public final Observable<T> finallyDo(Action0 action)
Action0 to be called when this Observable invokes either
onCompleted or
onError.
finallyDo does not operate by default on a particular
Scheduler.
action - an
Action0 to be invoked when the source Observable finishes
Action0
doOnTerminate(Action0)
public final Observable<T> first()
NoSuchElementException if the source Observable is empty.
first does not operate by default on a particular
Scheduler.
NoSuchElementException if the source Observable is empty
public final Observable<T> first(Func1 <? super T ,Boolean > predicate)
NoSuchElementException if no such items are emitted.
first does not operate by default on a particular
Scheduler.
predicate - the condition that an item emitted by the source Observable has to satisfy
predicate, or raises an
NoSuchElementException if no such items are emitted
public final Observable<T> firstOrDefault(T defaultValue)
firstOrDefault does not operate by default on a particular
Scheduler.
defaultValue - the default item to emit if the source Observable doesn't emit anything
public final Observable<T> firstOrDefault(T defaultValue, Func1 <? super T ,Boolean > predicate)
firstOrDefault does not operate by default on a particular
Scheduler.
predicate - the condition any item emitted by the source Observable has to satisfy
defaultValue - the default item to emit if the source Observable doesn't emit anything that satisfies the
predicate
predicate, or a default item if the source Observable emits no such items
public final <R> Observable<R> flatMap(Func1 <? super T ,? extends Observable <? extends R>> func)
flatMap does not operate by default on a particular
Scheduler.
func - a function that, when applied to an item emitted by the source Observable, returns an Observable
public final <R> Observable<R> flatMap(Func1 <? super T ,? extends Observable <? extends R>> onNext, Func1 <? super Throwable ,? extends Observable <? extends R>> onError, Func0 <? extends Observable <? extends R>> onCompleted)
flatMap does not operate by default on a particular
Scheduler.
R - the result type
onNext - a function that returns an Observable to merge for each item emitted by the source Observable
onError - a function that returns an Observable to merge for an onError notification from the source Observable
onCompleted - a function that returns an Observable to merge for an onCompleted notification from the source Observable
public final <U,R> Observable <R> flatMap(Func1 <? super T ,? extends Observable <? extends U>> collectionSelector, Func2 <? super T ,? super U ,? extends R> resultSelector)
flatMap does not operate by default on a particular
Scheduler.
U - the type of items emitted by the collection Observable
R - the type of items emitted by the resulting Observable
collectionSelector - a function that returns an Observable for each item emitted by the source Observable
resultSelector - a function that combines one item emitted by each of the source and collection Observables and returns an item to be emitted by the resulting Observable
public final <R> Observable<R> flatMapIterable(Func1 <? super T ,? extends Iterable <? extends R>> collectionSelector)
flatMapIterable does not operate by default on a particular
Scheduler.
R - the type of item emitted by the resulting Observable
collectionSelector - a function that returns an Iterable sequence of values for when given an item emitted by the source Observable
collectionSelector
public final <U,R> Observable <R> flatMapIterable(Func1 <? super T ,? extends Iterable <? extends U>> collectionSelector, Func2 <? super T ,? super U ,? extends R> resultSelector)
flatMapIterable does not operate by default on a particular
Scheduler.
U - the collection element type
R - the type of item emited by the resulting Observable
collectionSelector - a function that returns an Iterable sequence of values for each item emitted by the source Observable
resultSelector - a function that returns an item based on the item emitted by the source Observable and the Iterable returned for that item by the
collectionSelector
resultSelector for each item in the source Observable
public final void forEach(Action1<? super T> onNext)
Observable and receives notifications for each element.
Alias to subscribe(Action1)
forEach does not operate by default on a particular
Scheduler.
onNext -
Action1 to execute for each item.
IllegalArgumentException - if
onNext is null, or if
onError is null, or if
onComplete is null
public final void forEach(Action1<? super T> onNext, Action1 <Throwable > onError)
Observable and receives notifications for each element and error events.
Alias to subscribe(Action1, Action1)
forEach does not operate by default on a particular
Scheduler.
onNext -
Action1 to execute for each item.
onError -
Action1 to execute when an error is emitted.
IllegalArgumentException - if
onNext is null, or if
onError is null, or if
onComplete is null
public final void forEach(Action1<? super T> onNext, Action1 <Throwable > onError, Action0 onComplete)
Observable and receives notifications for each element and the terminal events.
Alias to subscribe(Action1, Action1, Action0)
forEach does not operate by default on a particular
Scheduler.
onNext -
Action1 to execute for each item.
onError -
Action1 to execute when an error is emitted.
onComplete -
Action0 to execute when completion is signalled.
IllegalArgumentException - if
onNext is null, or if
onError is null, or if
onComplete is null
public final <K,R> Observable <GroupedObservable <K ,R>> groupBy(Func1 <? super T ,? extends K> keySelector, Func1 <? super T ,? extends R> elementSelector)
Observable according to a specified criterion, and emits these grouped items as
GroupedObservables, one
GroupedObservable per group.
Note: A GroupedObservable will cache the items it is to emit until such time as it is subscribed to. For this reason, in order to avoid memory leaks, you should not simply ignore those GroupedObservables that do not concern you. Instead, you can signal to them that they may discard their buffers by applying an operator like take(int)(0) to them.
groupBy does not operate by default on a particular
Scheduler.
K - the key type
R - the element type
keySelector - a function that extracts the key for each item
elementSelector - a function that extracts the return element for each item
Observable that emits
GroupedObservables, each of which corresponds to a unique key value and each of which emits those items from the source Observable that share that key value
public final <K> Observable<GroupedObservable <K ,T>> groupBy(Func1 <? super T ,? extends K> keySelector)
Observable according to a specified criterion, and emits these grouped items as
GroupedObservables, one
GroupedObservable per group.
Note: A GroupedObservable will cache the items it is to emit until such time as it is subscribed to. For this reason, in order to avoid memory leaks, you should not simply ignore those GroupedObservables that do not concern you. Instead, you can signal to them that they may discard their buffers by applying an operator like take(int)(0) to them.
groupBy does not operate by default on a particular
Scheduler.
K - the key type
keySelector - a function that extracts the key for each item
Observable that emits
GroupedObservables, each of which corresponds to a unique key value and each of which emits those items from the source Observable that share that key value
public final <T2,D1 ,D2 ,R> Observable <R> groupJoin(Observable <T2> right, Func1 <? super T ,? extends Observable <D1>> leftDuration, Func1 <? super T2 ,? extends Observable <D2>> rightDuration, Func2 <? super T ,? super Observable <T2> ,? extends R> resultSelector)
groupJoin does not operate by default on a particular
Scheduler.
right - the other Observable to correlate items from the source Observable with
leftDuration - a function that returns an Observable whose emissions indicate the duration of the values of the source Observable
rightDuration - a function that returns an Observable whose emissions indicate the duration of the values of the
right Observable
resultSelector - a function that takes an item emitted by each Observable and returns the value to be emitted by the resulting Observable
public final Observable<T> ignoreElements()
onCompleted or
onError.
ignoreElements does not operate by default on a particular
Scheduler.
onCompleted or
onError, based on which one is called by the source Observable
public final Observable<Boolean > isEmpty()
true if the source Observable is empty, otherwise
false.
In Rx.Net this is negated as the any Observer but we renamed this in RxJava to better match Java naming idioms.
isEmpty does not operate by default on a particular
Scheduler.
public final <TRight,TLeftDuration ,TRightDuration ,R> Observable <R> join(Observable <TRight> right, Func1 <T ,Observable <TLeftDuration>> leftDurationSelector, Func1 <TRight ,Observable <TRightDuration>> rightDurationSelector, Func2 <T ,TRight ,R> resultSelector)
join does not operate by default on a particular
Scheduler.
right - the second Observable to join items from
leftDurationSelector - a function to select a duration for each item emitted by the source Observable, used to determine overlap
rightDurationSelector - a function to select a duration for each item emitted by the
right Observable, used to determine overlap
resultSelector - a function that computes an item to be emitted by the resulting Observable for any two overlapping items emitted by the two Observables
public final Observable<T> last()
NoSuchElementException if the source Observable is empty.
last does not operate by default on a particular
Scheduler.
public final Observable<T> last(Func1 <? super T ,Boolean > predicate)
NoSuchElementException if no such items are emitted.
last does not operate by default on a particular
Scheduler.
predicate - the condition any source emitted item has to satisfy
NoSuchElementException if no such items are emitted
IllegalArgumentException - if no items that match the predicate are emitted by the source Observable
public final Observable<T> lastOrDefault(T defaultValue)
lastOrDefault does not operate by default on a particular
Scheduler.
defaultValue - the default item to emit if the source Observable is empty
public final Observable<T> lastOrDefault(T defaultValue, Func1 <? super T ,Boolean > predicate)
lastOrDefault does not operate by default on a particular
Scheduler.
defaultValue - the default item to emit if the source Observable doesn't emit anything that satisfies the specified
predicate
predicate - the condition any item emitted by the source Observable has to satisfy
public final Observable<T> limit(int num)
num items emitted by the source Observable.
Alias of take(int) to match Java 8 Stream API naming convention.
This method returns an Observable that will invoke a subscribing Observer's onNext function a maximum of num times before invoking onCompleted.
limit does not operate by default on a particular
Scheduler.
num - the maximum number of items to emit
num items emitted by the source Observable, or all of the items from the source Observable if that Observable emits fewer than
num items
public final <R> Observable<R> map(Func1 <? super T ,? extends R> func)
map does not operate by default on a particular
Scheduler.
func - a function to apply to each item emitted by the Observable
public final Observable<Notification <T>> materialize()
Notification objects.
materialize does not operate by default on a particular
Scheduler.
public final Observable<T> mergeWith(Observable <? extends T> t1)
You can combine items emitted by multiple Observables so that they appear as a single Observable, by using the mergeWith method.
mergeWith does not operate by default on a particular
Scheduler.
t1 - an Observable to be merged
public final Observable<T> observeOn(Scheduler scheduler)
Scheduler, asynchronously with an unbounded buffer.
Scheduler this operator will use
scheduler - the
Scheduler to notify
Observers on
Observers are notified on the specified
Scheduler
subscribeOn(rx.Scheduler)
public final <R> Observable<R> ofType(Class <R> klass)
ofType does not operate by default on a particular
Scheduler.
klass - the class type to filter the items emitted by the source Observable
klass
public final Observable<T> onBackpressureBuffer()
onBackpressureBuffer does not operate by default on a particular
Scheduler.
public final Observable<T> onBackpressureDrop()
If the downstream request count hits 0 then the Observable will refrain from calling onNext until the observer invokes request(n) again to increase the request count.
onBackpressureDrop does not operate by default on a particular
Scheduler.
onNext notifications on overflow
public final Observable<T> onErrorResumeNext(Func1 <Throwable ,? extends Observable <? extends T>> resumeFunction)
onError if it encounters an error.
By default, when an Observable encounters an error that prevents it from emitting the expected item to its Observer, the Observable invokes its Observer's onError method, and then quits without invoking any more of its Observer's methods. The onErrorResumeNext method changes this behavior. If you pass a function that returns an Observable (resumeFunction) to onErrorResumeNext, if the original Observable encounters an error, instead of invoking its Observer's onError method, it will instead relinquish control to the Observable returned from resumeFunction, which will invoke the Observer's onNext method if it is able to do so. In such a case, because no Observable necessarily invokes onError, the Observer may never know that an error happened.
You can use this to prevent errors from propagating or to supply fallback data should errors be encountered.
onErrorResumeNext does not operate by default on a particular
Scheduler.
resumeFunction - a function that returns an Observable that will take over if the source Observable encounters an error
public final Observable<T> onErrorResumeNext(Observable <? extends T> resumeSequence)
onError if it encounters an error.
By default, when an Observable encounters an error that prevents it from emitting the expected item to its Observer, the Observable invokes its Observer's onError method, and then quits without invoking any more of its Observer's methods. The onErrorResumeNext method changes this behavior. If you pass another Observable (resumeSequence) to an Observable's onErrorResumeNext method, if the original Observable encounters an error, instead of invoking its Observer's onError method, it will instead relinquish control to resumeSequence which will invoke the Observer's onNext method if it is able to do so. In such a case, because no Observable necessarily invokes onError, the Observer may never know that an error happened.
You can use this to prevent errors from propagating or to supply fallback data should errors be encountered.
onErrorResumeNext does not operate by default on a particular
Scheduler.
resumeSequence - a function that returns an Observable that will take over if the source Observable encounters an error
public final Observable<T> onErrorReturn(Func1 <Throwable ,? extends T> resumeFunction)
onError if it encounters an error.
By default, when an Observable encounters an error that prevents it from emitting the expected item to its Observer, the Observable invokes its Observer's onError method, and then quits without invoking any more of its Observer's methods. The onErrorReturn method changes this behavior. If you pass a function (resumeFunction) to an Observable's onErrorReturn method, if the original Observable encounters an error, instead of invoking its Observer's onError method, it will instead emit the return value of resumeFunction.
You can use this to prevent errors from propagating or to supply fallback data should errors be encountered.
onErrorReturn does not operate by default on a particular
Scheduler.
resumeFunction - a function that returns an item that the new Observable will emit if the source Observable encounters an error
public final Observable<T> onExceptionResumeNext(Observable <? extends T> resumeSequence)
onError if it encounters an
Exception.
This differs from onErrorResumeNext(rx.functions.Func1<java.lang.Throwable, ? extends rx.Observable<? extends T>>) in that this one does not handle Throwable or Error but lets those continue through.
By default, when an Observable encounters an exception that prevents it from emitting the expected item to its Observer, the Observable invokes its Observer's onError method, and then quits without invoking any more of its Observer's methods. The onExceptionResumeNext method changes this behavior. If you pass another Observable (resumeSequence) to an Observable's onExceptionResumeNext method, if the original Observable encounters an exception, instead of invoking its Observer's onError method, it will instead relinquish control to resumeSequence which will invoke the Observer's onNext method if it is able to do so. In such a case, because no Observable necessarily invokes onError, the Observer may never know that an exception happened.
You can use this to prevent exceptions from propagating or to supply fallback data should exceptions be encountered.
onErrorResumeNext does not operate by default on a particular
Scheduler.
resumeSequence - a function that returns an Observable that will take over if the source Observable encounters an exception
public final ConnectableObservable<T> publish()
ConnectableObservable, which is a variety of Observable that waits until its
connect method is called before it begins emitting items to those
Observers that have subscribed to it.
publish does not operate by default on a particular
Scheduler.
ConnectableObservable that upon connection causes the source Observable to emit items to its
Observers
public final <R> Observable<R> publish(Func1 <? super Observable <T> ,? extends Observable <R>> selector)
ConnectableObservable that shares a single subscription to the underlying sequence.
publish does not operate by default on a particular
Scheduler.
R - the type of items emitted by the resulting Observable
selector - a function that can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription forward.
ConnectableObservable that shares a single subscription to the underlying sequence
public final Observable<T> reduce(Func2 <T ,T ,T> accumulator)
This technique, which is called "reduce" here, is sometimes called "aggregate," "fold," "accumulate," "compress," or "inject" in other programming contexts. Groovy, for instance, has an inject method that does a similar operation on lists.
onNext.
reduce does not operate by default on a particular
Scheduler.
accumulator - an accumulator function to be invoked on each item emitted by the source Observable, whose result will be used in the next accumulator call
IllegalArgumentException - if the source Observable emits no items
public final <R> Observable<R> reduce(R initialValue, Func2 <R ,? super T ,R> accumulator)
This technique, which is called "reduce" here, is sometimec called "aggregate," "fold," "accumulate," "compress," or "inject" in other programming contexts. Groovy, for instance, has an inject method that does a similar operation on lists.
onNext.
reduce does not operate by default on a particular
Scheduler.
initialValue - the initial (seed) accumulator value
accumulator - an accumulator function to be invoked on each item emitted by the source Observable, the result of which will be used in the next accumulator call
public final Observable<T> repeat()
repeat operates by default on the
trampoline
Scheduler.
public final Observable<T> repeat(Scheduler scheduler)
Scheduler this operator will use
scheduler - the Scheduler to emit the items on
public final Observable<T> repeat(long count)
count times.
repeat operates by default on the
trampoline
Scheduler.
count - the number of times the source Observable items are repeated, a count of 0 will yield an empty sequence
count times
IllegalArgumentException - if
count is less than zero
public final Observable<T> repeat(long count, Scheduler scheduler)
count times, on a particular Scheduler.
Scheduler this operator will use
count - the number of times the source Observable items are repeated, a count of 0 will yield an empty sequence
scheduler - the
Scheduler to emit the items on
count times on a particular Scheduler
public final Observable<T> repeatWhen(Func1 <? super Observable <? extends Void > ,? extends Observable <?>> notificationHandler, Scheduler scheduler)
onCompleted. An
onCompleted notification from the source will result in the emission of a
void item to the Observable provided as an argument to the
notificationHandler function. If that Observable calls
onComplete or
onError then
repeatWhen will call
onCompleted or
onError on the child subscription. Otherwise, this Observable will resubscribe to the source Observable, on a particular Scheduler.
Scheduler this operator will use
notificationHandler - receives an Observable of notifications with which a user can complete or error, aborting the repeat.
scheduler - the
Scheduler to emit the items on
public final Observable<T> repeatWhen(Func1 <? super Observable <? extends Void > ,? extends Observable <?>> notificationHandler)
onCompleted. An
onCompleted notification from the source will result in the emission of a
void item to the Observable provided as an argument to the
notificationHandler function. If that Observable calls
onComplete or
onError then
repeatWhen will call
onCompleted or
onError on the child subscription. Otherwise, this Observable will resubscribe to the source observable.
repeatWhen operates by default on the
trampoline
Scheduler.
notificationHandler - receives an Observable of notifications with which a user can complete or error, aborting the repeat.
public final ConnectableObservable<T> replay()
ConnectableObservable that shares a single subscription to the underlying Observable that will replay all of its items and notifications to any future
Observer. A Connectable Observable resembles an ordinary Observable, except that it does not begin emitting items when it is subscribed to, but only when its
connect method is called.
onBackpressureDrop() and
onBackpressureBuffer().
replay does not operate by default on a particular
Scheduler.
ConnectableObservable that upon connection causes the source Observable to emit its items to its
Observers
public final <R> Observable<R> replay(Func1 <? super Observable <T> ,? extends Observable <R>> selector)
ConnectableObservable that shares a single subscription to the source Observable.
onBackpressureDrop() and
onBackpressureBuffer().
replay does not operate by default on a particular
Scheduler.
R - the type of items emitted by the resulting Observable
selector - the selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the Observable
ConnectableObservable that shares a single subscription to the source Observable
public final <R> Observable<R> replay(Func1 <? super Observable <T> ,? extends Observable <R>> selector, int bufferSize)
ConnectableObservable that shares a single subscription to the source Observable, replaying
bufferSize notifications.
onBackpressureDrop() and
onBackpressureBuffer().
replay does not operate by default on a particular
Scheduler.
R - the type of items emitted by the resulting Observable
selector - the selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the Observable
bufferSize - the buffer size that limits the number of items the connectable observable can replay
ConnectableObservable that shares a single subscription to the source Observable replaying no more than
bufferSize items
public final <R> Observable<R> replay(Func1 <? super Observable <T> ,? extends Observable <R>> selector, int bufferSize, long time, TimeUnit unit)
ConnectableObservable that shares a single subscription to the source Observable, replaying no more than
bufferSize items that were emitted within a specified time window.
onBackpressureDrop() and
onBackpressureBuffer().
replay operates by default on the
computation
Scheduler.
R - the type of items emitted by the resulting Observable
selector - a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the Observable
bufferSize - the buffer size that limits the number of items the connectable observable can replay
time - the duration of the window in which the replayed items must have been emitted
unit - the time unit of
time
ConnectableObservable that shares a single subscription to the source Observable, and replays no more than
bufferSize items that were emitted within the window defined by
time
public final <R> Observable<R> replay(Func1 <? super Observable <T> ,? extends Observable <R>> selector, int bufferSize, long time, TimeUnit unit, Scheduler scheduler)
ConnectableObservable that shares a single subscription to the source Observable, replaying no more than
bufferSize items that were emitted within a specified time window.
onBackpressureDrop() and
onBackpressureBuffer().
Scheduler this operator will use
R - the type of items emitted by the resulting Observable
selector - a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the Observable
bufferSize - the buffer size that limits the number of items the connectable observable can replay
time - the duration of the window in which the replayed items must have been emitted
unit - the time unit of
time
scheduler - the Scheduler that is the time source for the window
ConnectableObservable that shares a single subscription to the source Observable, and replays no more than
bufferSize items that were emitted within the window defined by
time
IllegalArgumentException - if
bufferSize is less than zero
public final <R> Observable<R> replay(Func1 <? super Observable <T> ,? extends Observable <R>> selector, int bufferSize, Scheduler scheduler)
ConnectableObservable that shares a single subscription to the source Observable, replaying a maximum of
bufferSize items.
onBackpressureDrop() and
onBackpressureBuffer().
Scheduler this operator will use
R - the type of items emitted by the resulting Observable
selector - a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the Observable
bufferSize - the buffer size that limits the number of items the connectable observable can replay
scheduler - the Scheduler on which the replay is observed
ConnectableObservable that shares a single subscription to the source Observable, replaying no more than
bufferSize notifications
public final <R> Observable<R> replay(Func1 <? super Observable <T> ,? extends Observable <R>> selector, long time, TimeUnit unit)
ConnectableObservable that shares a single subscription to the source Observable, replaying all items that were emitted within a specified time window.
onBackpressureDrop() and
onBackpressureBuffer().
replay operates by default on the
computation
Scheduler.
R - the type of items emitted by the resulting Observable
selector - a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the Observable
time - the duration of the window in which the replayed items must have been emitted
unit - the time unit of
time
ConnectableObservable that shares a single subscription to the source Observable, replaying all items that were emitted within the window defined by
time
public final <R> Observable<R> replay(Func1 <? super Observable <T> ,? extends Observable <R>> selector, long time, TimeUnit unit, Scheduler scheduler)
ConnectableObservable that shares a single subscription to the source Observable, replaying all items that were emitted within a specified time window.
onBackpressureDrop() and
onBackpressureBuffer().
Scheduler this operator will use
R - the type of items emitted by the resulting Observable
selector - a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the Observable
time - the duration of the window in which the replayed items must have been emitted
unit - the time unit of
time
scheduler - the scheduler that is the time source for the window
ConnectableObservable that shares a single subscription to the source Observable, replaying all items that were emitted within the window defined by
time
public final <R> Observable<R> replay(Func1 <? super Observable <T> ,? extends Observable <R>> selector, Scheduler scheduler)
ConnectableObservable that shares a single subscription to the source Observable.
onBackpressureDrop() and
onBackpressureBuffer().
Scheduler this operator will use
R - the type of items emitted by the resulting Observable
selector - a selector function, which can use the multicasted sequence as many times as needed, without causing multiple subscriptions to the Observable
scheduler - the Scheduler where the replay is observed
ConnectableObservable that shares a single subscription to the source Observable, replaying all items
public final ConnectableObservable<T> replay(int bufferSize)
ConnectableObservable that shares a single subscription to the source Observable that replays at most
bufferSize items emitted by that Observable. A Connectable Observable resembles an ordinary Observable, except that it does not begin emitting items when it is subscribed to, but only when its
connect method is called.
onBackpressureDrop() and
onBackpressureBuffer().
replay does not operate by default on a particular
Scheduler.
bufferSize - the buffer size that limits the number of items that can be replayed
ConnectableObservable that shares a single subscription to the source Observable and replays at most
bufferSize items emitted by that Observable
public final ConnectableObservable<T> replay(int bufferSize, long time, TimeUnit unit)
ConnectableObservable that shares a single subscription to the source Observable and replays at most
bufferSize items that were emitted during a specified time window. A Connectable Observable resembles an ordinary Observable, except that it does not begin emitting items when it is subscribed to, but only when its
connect method is called.
onBackpressureDrop() and
onBackpressureBuffer().
replay operates by default on the
computation
Scheduler.
bufferSize - the buffer size that limits the number of items that can be replayed
time - the duration of the window in which the replayed items must have been emitted
unit - the time unit of
time
ConnectableObservable that shares a single subscription to the source Observable and replays at most
bufferSize items that were emitted during the window defined by
time
public final ConnectableObservable<T> replay(int bufferSize, long time, TimeUnit unit, Scheduler scheduler)
ConnectableObservable that shares a single subscription to the source Observable and that replays a maximum of
bufferSize items that are emitted within a specified time window. A Connectable Observable resembles an ordinary Observable, except that it does not begin emitting items when it is subscribed to, but only when its
connect method is called.
onBackpressureDrop() and
onBackpressureBuffer().
Scheduler this operator will use
bufferSize - the buffer size that limits the number of items that can be replayed
time - the duration of the window in which the replayed items must have been emitted
unit - the time unit of
time
scheduler - the scheduler that is used as a time source for the window
ConnectableObservable that shares a single subscription to the source Observable and replays at most
bufferSize items that were emitted during the window defined by
time
IllegalArgumentException - if
bufferSize is less than zero
public final ConnectableObservable<T> replay(int bufferSize, Scheduler scheduler)
ConnectableObservable that shares a single subscription to the source Observable and replays at most
bufferSize items emitted by that Observable. A Connectable Observable resembles an ordinary Observable, except that it does not begin emitting items when it is subscribed to, but only when its
connect method is called.
onBackpressureDrop() and
onBackpressureBuffer().
Scheduler this operator will use
bufferSize - the buffer size that limits the number of items that can be replayed
scheduler - the scheduler on which the Observers will observe the emitted items
ConnectableObservable that shares a single subscription to the source Observable and replays at most
bufferSize items that were emitted by the Observable
public final ConnectableObservable<T> replay(long time, TimeUnit unit)
ConnectableObservable that shares a single subscription to the source Observable and replays all items emitted by that Observable within a specified time window. A Connectable Observable resembles an ordinary Observable, except that it does not begin emitting items when it is subscribed to, but only when its
connect method is called.
onBackpressureDrop() and
onBackpressureBuffer().
replay operates by default on the
computation
Scheduler.
time - the duration of the window in which the replayed items must have been emitted
unit - the time unit of
time
ConnectableObservable that shares a single subscription to the source Observable and replays the items that were emitted during the window defined by
time
public final ConnectableObservable<T> replay(long time, TimeUnit unit, Scheduler scheduler)
ConnectableObservable that shares a single subscription to the source Observable and replays all items emitted by that Observable within a specified time window. A Connectable Observable resembles an ordinary Observable, except that it does not begin emitting items when it is subscribed to, but only when its
connect method is called.
onBackpressureDrop() and
onBackpressureBuffer().
Scheduler this operator will use
time - the duration of the window in which the replayed items must have been emitted
unit - the time unit of
time
scheduler - the Scheduler that is the time source for the window
ConnectableObservable that shares a single subscription to the source Observable and replays the items that were emitted during the window defined by
time
public final ConnectableObservable<T> replay(Scheduler scheduler)
ConnectableObservable that shares a single subscription to the source Observable that will replay all of its items and notifications to any future
Observer on the given
Scheduler. A Connectable Observable resembles an ordinary Observable, except that it does not begin emitting items when it is subscribed to, but only when its
connect method is called.
onBackpressureDrop() and
onBackpressureBuffer().
Scheduler this operator will use
scheduler - the Scheduler on which the Observers will observe the emitted items
ConnectableObservable that shares a single subscription to the source Observable that will replay all of its items and notifications to any future
Observer on the given
Scheduler
public final Observable<T> retry()
onError (infinite retry count).
If the source Observable calls Observer, this method will resubscribe to the source Observable rather than propagating the onError call.
Any and all items emitted by the source Observable will be emitted by the resulting Observable, even those emitted during failed subscriptions. For example, if an Observable fails at first but emits [1, 2] then succeeds the second time and emits [1, 2, 3, 4, 5] then the complete sequence of emissions and notifications would be [1, 2, 1, 2, 3, 4, 5, onCompleted].
retry operates by default on the
trampoline
Scheduler.
public final Observable<T> retry(long count)
onError up to a specified number of retries.
If the source Observable calls Observer, this method will resubscribe to the source Observable for a maximum of count resubscriptions rather than propagating the onError call.
Any and all items emitted by the source Observable will be emitted by the resulting Observable, even those emitted during failed subscriptions. For example, if an Observable fails at first but emits [1, 2] then succeeds the second time and emits [1, 2, 3, 4, 5] then the complete sequence of emissions and notifications would be [1, 2, 1, 2, 3, 4, 5, onCompleted].
retry operates by default on the
trampoline
Scheduler.
count - number of retry attempts before failing
public final Observable<T> retry(Func2 <Integer ,Throwable ,Boolean > predicate)
onError and the predicate returns true for that specific exception and retry count.
retry operates by default on the
trampoline
Scheduler.
predicate - the predicate that determines if a resubscription may happen in case of a specific exception and retry count
retry(),
RxJava Wiki: retry()
public final Observable<T> retryWhen(Func1 <? super Observable <? extends Throwable > ,? extends Observable <?>> notificationHandler)
onError. An
onError notification from the source will result in the emission of a
Throwable item to the Observable provided as an argument to the
notificationHandler function. If that Observable calls
onComplete or
onError then
retry will call
onCompleted or
onError on the child subscription. Otherwise, this Observable will resubscribe to the source Observable.
Example: This retries 3 times, each time incrementing the number of seconds it waits.
Observable.create((Subscriber<? super String> s) -> { System.out.println("subscribing"); s.onError(new RuntimeException("always fails")); }).retryWhen(attempts -> { return attempts.zipWith(Observable.range(1, 3), (n, i) -> i).flatMap(i -> { System.out.println("delay retry by " + i + " second(s)"); return Observable.timer(i, TimeUnit.SECONDS); }); }).toBlocking().forEach(System.out::println); Output is:
subscribing delay retry by 1 second(s) subscribing delay retry by 2 second(s) subscribing delay retry by 3 second(s) subscribing
retryWhen operates by default on the
trampoline
Scheduler.
notificationHandler - receives an Observable of notifications with which a user can complete or error, aborting the retry
public final Observable<T> retryWhen(Func1 <? super Observable <? extends Throwable > ,? extends Observable <?>> notificationHandler, Scheduler scheduler)
onError. An
onError will cause the emission of the
Throwable that cause the error to the Observable returned from
notificationHandler. If that Observable calls
onComplete or
onError then
retry will call
onCompleted or
onError on the child subscription. Otherwise, this Observable will resubscribe to the source observable, on a particular Scheduler.
Scheduler this operator will use
notificationHandler - receives an Observable of notifications with which a user can complete or error, aborting the retry
scheduler - the
Scheduler on which to subscribe to the source Observable
public final Observable<T> sample(long period, TimeUnit unit)
sample operates by default on the
computation
Scheduler.
period - the sampling rate
unit - the
TimeUnit in which
period is defined
throttleLast(long, TimeUnit)
public final Observable<T> sample(long period, TimeUnit unit, Scheduler scheduler)
Scheduler this operator will use
period - the sampling rate
unit - the
TimeUnit in which
period is defined
scheduler - the
Scheduler to use when sampling
throttleLast(long, TimeUnit, Scheduler)
public final <U> Observable<T> sample(Observable <U> sampler)
sampler Observable emits an item or completes, emits the most recently emitted item (if any) emitted by the source Observable since the previous emission from the
sampler Observable.
sampler Observable to control data flow.
sample does not operate by default on a particular
Scheduler.
sampler - the Observable to use for sampling the source Observable
sampler Observable emits an item or completes
public final Observable<T> scan(Func2 <T ,T ,T> accumulator)
This sort of function is sometimes called an accumulator.
scan does not operate by default on a particular
Scheduler.
accumulator - an accumulator function to be invoked on each item emitted by the source Observable, whose result will be emitted to
Observers via
onNext and used in the next accumulator call
public final <R> Observable<R> scan(R initialValue, Func2 <R ,? super T ,R> accumulator)
This sort of function is sometimes called an accumulator.
Note that the Observable that results from this method will emit initialValue as its first emitted item.
scan does not operate by default on a particular
Scheduler.
initialValue - the initial (seed) accumulator item
accumulator - an accumulator function to be invoked on each item emitted by the source Observable, whose result will be emitted to
Observers via
onNext and used in the next accumulator call
initialValue followed by the results of each call to the accumulator function
public final Observable<T> serialize()
It is possible for an Observable to invoke its Subscribers' methods asynchronously, perhaps from different threads. This could make such an Observable poorly-behaved, in that it might try to invoke onCompleted or onError before one of its onNext invocations, or it might call onNext from two different threads concurrently. You can force such an Observable to be well-behaved and sequential by applying the serialize method to it.
serialize does not operate by default on a particular
Scheduler.
Observable that is guaranteed to be well-behaved and to make only serialized calls to its observers
public final Observable<T> share()
Observable that multicasts (shares) the original
Observable. As long as there is at least one
Subscriber this
Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will unsubscribe from the source
Observable.
This is an alias for publish().ConnectableObservable.
onBackpressureDrop() and
onBackpressureBuffer().
share does not operate by default on a particular
Scheduler.
Observable that upon connection causes the source
Observable to emit items to its
Observers
public final Observable<T> single()
IllegalArgumentException or
NoSuchElementException respectively.
single does not operate by default on a particular
Scheduler.
IllegalArgumentException - if the source emits more than one item
NoSuchElementException - if the source emits no items
public final Observable<T> single(Func1 <? super T ,Boolean > predicate)
IllegalArgumentException or
NoSuchElementException respectively.
single does not operate by default on a particular
Scheduler.
predicate - a predicate function to evaluate items emitted by the source Observable
IllegalArgumentException - if the source Observable emits more than one item that matches the predicate
NoSuchElementException - if the source Observable emits no item that matches the predicate
public final Observable<T> singleOrDefault(T defaultValue)
IllegalArgumentException.
singleOrDefault does not operate by default on a particular
Scheduler.
defaultValue - a default value to emit if the source Observable emits no item
IllegalArgumentException - if the source Observable emits more than one item
public final Observable<T> singleOrDefault(T defaultValue, Func1 <? super T ,Boolean > predicate)
IllegalArgumentException.
singleOrDefault does not operate by default on a particular
Scheduler.
defaultValue - a default item to emit if the source Observable emits no matching items
predicate - a predicate function to evaluate items emitted by the source Observable
IllegalArgumentException - if the source Observable emits more than one item that matches the predicate
public final Observable<T> skip(int num)
num items emitted by the source Observable and emits the remainder.
skip does not operate by default on a particular
Scheduler.
num - the number of items to skip
num items that the source Observable emits
public final Observable<T> skip(long time, TimeUnit unit)
skip operates by default on the
computation
Scheduler.
time - the length of the time window to skip
unit - the time unit of
time
time elapses and the emits the remainder
public final Observable<T> skip(long time, TimeUnit unit, Scheduler scheduler)
Scheduler elapses.
Scheduler this operator will use
time - the length of the time window to skip
unit - the time unit of
time
scheduler - the
Scheduler on which the timed wait happens
time and
scheduler elapses, and then emits the remainder
public final Observable<T> skipLast(int count)
This Observer accumulates a queue long enough to store the first count items. As more items are received, items are taken from the front of the queue and emitted by the returned Observable. This causes such items to be delayed.
skipLast does not operate by default on a particular
Scheduler.
count - number of items to drop from the end of the source sequence
IndexOutOfBoundsException - if
count is less than zero
public final Observable<T> skipLast(long time, TimeUnit unit)
Note: this action will cache the latest items arriving in the specified time window.
skipLast operates by default on the
computation
Scheduler.
time - the length of the time window
unit - the time unit of
time
time
public final Observable<T> skipLast(long time, TimeUnit unit, Scheduler scheduler)
Note: this action will cache the latest items arriving in the specified time window.
Scheduler this operator will use
time - the length of the time window
unit - the time unit of
time
scheduler - the scheduler used as the time source
time and
scheduler
public final <U> Observable<T> skipUntil(Observable <U> other)
skipUntil does not operate by default on a particular
Scheduler.
other - the second Observable that has to emit an item before the source Observable's elements begin to be mirrored by the resulting Observable
public final Observable<T> skipWhile(Func1 <? super T ,Boolean > predicate)
skipWhile does not operate by default on a particular
Scheduler.
predicate - a function to test each item emitted from the source Observable
public final Observable<T> startWith(Observable <T> values)
Observable before it begins to emit items emitted by the source Observable.
startWith does not operate by default on a particular
Scheduler.
values - an Observable that contains the items you want the modified Observable to emit first
Observable and then emits the items emitted by the source Observable
public final Observable<T> startWith(Iterable <T> values)
Iterable before it begins to emit items emitted by the source Observable.
startWith does not operate by default on a particular
Scheduler.
values - an Iterable that contains the items you want the modified Observable to emit first
Iterable and then emits the items emitted by the source Observable
public final Observable<T> startWith(T t1)
startWith does not operate by default on a particular
Scheduler.
t1 - the item to emit
public final Observable<T> startWith(T t1, T t2)
startWith does not operate by default on a particular
Scheduler.
t1 - the first item to emit
t2 - the second item to emit
public final Observable<T> startWith(T t1, T t2, T t3)
startWith does not operate by default on a particular
Scheduler.
t1 - the first item to emit
t2 - the second item to emit
t3 - the third item to emit
public final Observable<T> startWith(T t1, T t2, T t3, T t4)
startWith does not operate by default on a particular
Scheduler.
t1 - the first item to emit
t2 - the second item to emit
t3 - the third item to emit
t4 - the fourth item to emit
public final Observable<T> startWith(T t1, T t2, T t3, T t4, T t5)
startWith does not operate by default on a particular
Scheduler.
t1 - the first item to emit
t2 - the second item to emit
t3 - the third item to emit
t4 - the fourth item to emit
t5 - the fifth item to emit
public final Observable<T> startWith(T t1, T t2, T t3, T t4, T t5, T t6)
startWith does not operate by default on a particular
Scheduler.
t1 - the first item to emit
t2 - the second item to emit
t3 - the third item to emit
t4 - the fourth item to emit
t5 - the fifth item to emit
t6 - the sixth item to emit
public final Observable<T> startWith(T t1, T t2, T t3, T t4, T t5, T t6, T t7)
startWith does not operate by default on a particular
Scheduler.
t1 - the first item to emit
t2 - the second item to emit
t3 - the third item to emit
t4 - the fourth item to emit
t5 - the fifth item to emit
t6 - the sixth item to emit
t7 - the seventh item to emit
public final Observable<T> startWith(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8)
startWith does not operate by default on a particular
Scheduler.
t1 - the first item to emit
t2 - the second item to emit
t3 - the third item to emit
t4 - the fourth item to emit
t5 - the fifth item to emit
t6 - the sixth item to emit
t7 - the seventh item to emit
t8 - the eighth item to emit
public final Observable<T> startWith(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8, T t9)
startWith does not operate by default on a particular
Scheduler.
t1 - the first item to emit
t2 - the second item to emit
t3 - the third item to emit
t4 - the fourth item to emit
t5 - the fifth item to emit
t6 - the sixth item to emit
t7 - the seventh item to emit
t8 - the eighth item to emit
t9 - the ninth item to emit
public final Subscriptionsubscribe()
subscribe does not operate by default on a particular
Scheduler.
Subscription reference with which the
Observer can stop receiving items before the Observable has finished sending them
OnErrorNotImplementedException - if the Observable tries to call
onError
public final Subscriptionsubscribe(Action1 <? super T> onNext)
subscribe does not operate by default on a particular
Scheduler.
onNext - the
Action1<T> you have designed to accept emissions from the Observable
Subscription reference with which the
Observer can stop receiving items before the Observable has finished sending them
IllegalArgumentException - if
onNext is null
OnErrorNotImplementedException - if the Observable tries to call
onError
public final Subscriptionsubscribe(Action1 <? super T> onNext, Action1 <Throwable > onError)
subscribe does not operate by default on a particular
Scheduler.
onNext - the
Action1<T> you have designed to accept emissions from the Observable
onError - the
Action1<Throwable> you have designed to accept any error notification from the Observable
Subscription reference with which the
Observer can stop receiving items before the Observable has finished sending them
IllegalArgumentException - if
onNext is null, or if
onError is null
public final Subscriptionsubscribe(Action1 <? super T> onNext, Action1 <Throwable > onError, Action0 onComplete)
subscribe does not operate by default on a particular
Scheduler.
onNext - the
Action1<T> you have designed to accept emissions from the Observable
onError - the
Action1<Throwable> you have designed to accept any error notification from the Observable
onComplete - the
Action0 you have designed to accept a completion notification from the Observable
Subscription reference with which the
Observer can stop receiving items before the Observable has finished sending them
IllegalArgumentException - if
onNext is null, or if
onError is null, or if
onComplete is null
public final Subscriptionsubscribe(Observer <? super T> observer)
subscribe does not operate by default on a particular
Scheduler.
observer - the Observer that will handle emissions and notifications from the Observable
Subscription reference with which the
Observer can stop receiving items before the Observable has completed
public final SubscriptionunsafeSubscribe(Subscriber <? super T> subscriber)
Observable.OnSubscribe function without any contract protection, error handling, unsubscribe, or execution hooks.
Use this only for implementing an Observable.Operator that requires nested subscriptions. For other purposes, use subscribe(Subscriber) which ensures the Rx contract and other functionality.
unsafeSubscribe does not operate by default on a particular
Scheduler.
subscriber - the Subscriber that will handle emissions and notifications from the Observable
Subscription reference with which the
Subscriber can stop receiving items before the Observable has completed
public final Subscriptionsubscribe(Subscriber <? super T> subscriber)
A typical implementation of subscribe does the following:
List<T> object.Subscription interface. This enables Subscribers to unsubscribe, that is, to stop receiving items and notifications before the Observable completes, which also invokes the Subscriber's onCompleted method. An Observable<T> instance is responsible for accepting all subscriptions and notifying all Subscribers. Unless the documentation for a particular Observable<T> implementation indicates otherwise, Subscriber should make no assumptions about the order in which multiple Subscribers will receive their notifications.
For more information see the RxJava wiki.
subscribe does not operate by default on a particular
Scheduler.
subscriber - the
Subscriber that will handle emissions and notifications from the Observable
Subscription reference with which Subscribers that are
Observers can unsubscribe from the Observable
IllegalStateException - if
subscribe is unable to obtain an
OnSubscribe<> function
IllegalArgumentException - if the
Subscriber provided as the argument to
subscribe is
null
OnErrorNotImplementedException - if the
Subscriber's
onError method is null
RuntimeException - if the
Subscriber's
onError method itself threw a
Throwable
public final Observable<T> subscribeOn(Scheduler scheduler)
Scheduler.
Scheduler this operator will use
scheduler - the
Scheduler to perform subscription actions on
Scheduler
observeOn(rx.Scheduler)
public final <R> Observable<R> switchMap(Func1 <? super T ,? extends Observable <? extends R>> func)
switchMap does not operate by default on a particular
Scheduler.
func - a function that, when applied to an item emitted by the source Observable, returns an Observable
func to the most recently emitted item emitted by the source Observable
public final Observable<T> take(int num)
num items emitted by the source Observable.
This method returns an Observable that will invoke a subscribing Observer's onNext function a maximum of num times before invoking onCompleted.
take does not operate by default on a particular
Scheduler.
num - the maximum number of items to emit
num items emitted by the source Observable, or all of the items from the source Observable if that Observable emits fewer than
num items
public final Observable<T> take(long time, TimeUnit unit)
take operates by default on the
computation
Scheduler.
time - the length of the time window
unit - the time unit of
time
public final Observable<T> take(long time, TimeUnit unit, Scheduler scheduler)
Scheduler this operator will use
time - the length of the time window
unit - the time unit of
time
scheduler - the Scheduler used for time source
public final Observable<T> takeFirst(Func1 <? super T ,Boolean > predicate)
takeFirst does not operate by default on a particular
Scheduler.
predicate - the condition any item emitted by the source Observable has to satisfy
public final Observable<T> takeLast(int count)
count items emitted by the source Observable.
takeLast does not operate by default on a particular
Scheduler.
count - the number of items to emit from the end of the sequence of items emitted by the source Observable
count items emitted by the source Observable
IndexOutOfBoundsException - if
count is less than zero
public final Observable<T> takeLast(int count, long time, TimeUnit unit)
takeLast operates by default on the
computation
Scheduler.
count - the maximum number of items to emit
time - the length of the time window
unit - the time unit of
time
count items from the source Observable that were emitted in a specified window of time before the Observable completed
public final Observable<T> takeLast(int count, long time, TimeUnit unit, Scheduler scheduler)
Scheduler this operator will use
count - the maximum number of items to emit
time - the length of the time window
unit - the time unit of
time
scheduler - the
Scheduler that provides the timestamps for the observed items
count items from the source Observable that were emitted in a specified window of time before the Observable completed, where the timing information is provided by the given
scheduler
IndexOutOfBoundsException - if
count is less than zero
public final Observable<T> takeLast(long time, TimeUnit unit)
takeLast operates by default on the
computation
Scheduler.
time - the length of the time window
unit - the time unit of
time
time
public final Observable<T> takeLast(long time, TimeUnit unit, Scheduler scheduler)
Scheduler this operator will use
time - the length of the time window
unit - the time unit of
time
scheduler - the Scheduler that provides the timestamps for the Observed items
time, where the timing information is provided by
scheduler
public final Observable<List <T>> takeLastBuffer(int count)
count elements emitted by the source Observable.
takeLastBuffer does not operate by default on a particular
Scheduler.
count - the number of items to emit in the list
count elements emitted by the source Observable
public final Observable<List <T>> takeLastBuffer(int count, long time, TimeUnit unit)
count items from the source Observable that were emitted during a specified window of time before the source Observable completed.
takeLastBuffer operates by default on the
computation
Scheduler.
count - the maximum number of items to emit
time - the length of the time window
unit - the time unit of
time
count items emitted by the source Observable during the time window defined by
time before the source Observable completed
public final Observable<List <T>> takeLastBuffer(int count, long time, TimeUnit unit, Scheduler scheduler)
count items from the source Observable that were emitted during a specified window of time (on a specified Scheduler) before the source Observable completed.
Scheduler this operator will use
count - the maximum number of items to emit
time - the length of the time window
unit - the time unit of
time
scheduler - the Scheduler that provides the timestamps for the observed items
count items emitted by the source Observable during the time window defined by
time before the source Observable completed
public final Observable<List <T>> takeLastBuffer(long time, TimeUnit unit)
takeLastBuffer operates by default on the
computation
Scheduler.
time - the length of the time window
unit - the time unit of
time
time before the source Observable completed
public final Observable<List <T>> takeLastBuffer(long time, TimeUnit unit, Scheduler scheduler)
Scheduler this operator will use
time - the length of the time window
unit - the time unit of
time
scheduler - the Scheduler that provides the timestamps for the observed items
time before the source Observable completed, where the timing information is provided by
scheduler
public final <E> Observable<T> takeUntil(Observable <? extends E> other)
takeUntil does not operate by default on a particular
Scheduler.
E - the type of items emitted by
other
other - the Observable whose first emitted item will cause
takeUntil to stop emitting items from the source Observable
other emits its first item
public final Observable<T> takeWhile(Func1 <? super T ,Boolean > predicate)
takeWhile does not operate by default on a particular
Scheduler.
predicate - a function that evaluates an item emitted by the source Observable and returns a Boolean
predicate, then completes
public final Observable<T> throttleFirst(long windowDuration, TimeUnit unit)
This differs from throttleLast(long, java.util.concurrent.TimeUnit) in that this only tracks passage of time whereas throttleLast(long, java.util.concurrent.TimeUnit) ticks at scheduled intervals.
throttleFirst operates by default on the
computation
Scheduler.
windowDuration - time to wait before emitting another item after emitting the last item
unit - the unit of time of
windowDuration
public final Observable<T> throttleFirst(long skipDuration, TimeUnit unit, Scheduler scheduler)
This differs from throttleLast(long, java.util.concurrent.TimeUnit) in that this only tracks passage of time whereas throttleLast(long, java.util.concurrent.TimeUnit) ticks at scheduled intervals.
Scheduler this operator will use
skipDuration - time to wait before emitting another item after emitting the last item
unit - the unit of time of
skipDuration
scheduler - the
Scheduler to use internally to manage the timers that handle timeout for each event
public final Observable<T> throttleLast(long intervalDuration, TimeUnit unit)
This differs from throttleFirst(long, java.util.concurrent.TimeUnit) in that this ticks along at a scheduled interval whereas throttleFirst(long, java.util.concurrent.TimeUnit) does not tick, it just tracks passage of time.
throttleLast operates by default on the
computation
Scheduler.
intervalDuration - duration of windows within which the last item emitted by the source Observable will be emitted
unit - the unit of time of
intervalDuration
sample(long, TimeUnit)
public final Observable<T> throttleLast(long intervalDuration, TimeUnit unit, Scheduler scheduler)
This differs from throttleFirst(long, java.util.concurrent.TimeUnit) in that this ticks along at a scheduled interval whereas throttleFirst(long, java.util.concurrent.TimeUnit) does not tick, it just tracks passage of time.
Scheduler this operator will use
intervalDuration - duration of windows within which the last item emitted by the source Observable will be emitted
unit - the unit of time of
intervalDuration
scheduler - the
Scheduler to use internally to manage the timers that handle timeout for each event
sample(long, TimeUnit, Scheduler)
public final Observable<T> throttleWithTimeout(long timeout, TimeUnit unit)
Note: If the source Observable keeps emitting items more frequently than the length of the time window then no items will be emitted by the resulting Observable.
Information on debounce vs throttle:
throttleWithTimeout operates by default on the
computation
Scheduler.
timeout - the length of the window of time that must pass after the emission of an item from the source Observable in which that Observable emits no items in order for the item to be emitted by the resulting Observable
unit - the
TimeUnit of
timeout
debounce(long, TimeUnit)
public final Observable<T> throttleWithTimeout(long timeout, TimeUnit unit, Scheduler scheduler)
Note: If the source Observable keeps emitting items more frequently than the length of the time window then no items will be emitted by the resulting Observable.
Information on debounce vs throttle:
Scheduler this operator will use
timeout - the length of the window of time that must pass after the emission of an item from the source Observable in which that Observable emits no items in order for the item to be emitted by the resulting Observable
unit - the
TimeUnit of
timeout
scheduler - the
Scheduler to use internally to manage the timers that handle the timeout for each item
debounce(long, TimeUnit, Scheduler)
public final Observable<TimeInterval <T>> timeInterval()
timeInterval operates by default on the
immediate
Scheduler.
public final Observable<TimeInterval <T>> timeInterval(Scheduler scheduler)
Scheduler this operator will use
scheduler - the
Scheduler used to compute time intervals
public final <U,V> Observable <T> timeout(Func0 <? extends Observable <U>> firstTimeoutSelector, Func1 <? super T ,? extends Observable <V>> timeoutSelector)
TimeoutException if either the first item emitted by the source Observable or any subsequent item doesn't arrive within time windows defined by other Observables.
timeout operates by default on the
immediate
Scheduler.
U - the first timeout value type (ignored)
V - the subsequent timeout value type (ignored)
firstTimeoutSelector - a function that returns an Observable that determines the timeout window for the first source item
timeoutSelector - a function that returns an Observable for each item emitted by the source Observable and that determines the timeout window in which the subsequent source item must arrive in order to continue the sequence
TimeoutException if either the first item or any subsequent item doesn't arrive within the time windows specified by the timeout selectors
public final <U,V> Observable <T> timeout(Func0 <? extends Observable <U>> firstTimeoutSelector, Func1 <? super T ,? extends Observable <V>> timeoutSelector, Observable <? extends T> other)
timeout operates by default on the
immediate
Scheduler.
U - the first timeout value type (ignored)
V - the subsequent timeout value type (ignored)
firstTimeoutSelector - a function that returns an Observable which determines the timeout window for the first source item
timeoutSelector - a function that returns an Observable for each item emitted by the source Observable and that determines the timeout window in which the subsequent source item must arrive in order to continue the sequence
other - the fallback Observable to switch to if the source Observable times out
other Observable if either the first item emitted by the source Observable or any subsequent item doesn't arrive within time windows defined by the timeout selectors
NullPointerException - if
timeoutSelector is null
public final <V> Observable<T> timeout(Func1 <? super T ,? extends Observable <V>> timeoutSelector)
TimeoutException if an item emitted by the source 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 Observable that is a function of the previous item.
Note: The arrival of the first source item is never timed out.
timeout operates by default on the
immediate
Scheduler.
V - the timeout value type (ignored)
timeoutSelector - a function that returns an observable for each item emitted by the source Observable and that determines the timeout window for the subsequent item
TimeoutException if an item emitted by the source Observable takes longer to arrive than the time window defined by the selector for the previously emitted item
public final <V> Observable<T> timeout(Func1 <? super T ,? extends Observable <V>> timeoutSelector, Observable <? extends T> other)
Note: The arrival of the first source item is never timed out.
timeout operates by default on the
immediate
Scheduler.
V - the timeout value type (ignored)
timeoutSelector - a function that returns an Observable, for each item emitted by the source Observable, that determines the timeout window for the subsequent item
other - the fallback Observable to switch to if the source Observable times out
public final Observable<T> timeout(long timeout, TimeUnit timeUnit)
TimeoutException.
timeout operates by default on the
computation
Scheduler.
timeout - maximum duration between emitted items before a timeout occurs
timeUnit - the unit of time that applies to the
timeout argument.
TimeoutException in case of a timeout
public final Observable<T> timeout(long timeout, TimeUnit timeUnit, Observable <? extends T> other)
timeout operates by default on the
computation
Scheduler.
timeout - maximum duration between items before a timeout occurs
timeUnit - the unit of time that applies to the
timeout argument
other - the fallback Observable to use in case of a timeout
public final Observable<T> timeout(long timeout, TimeUnit timeUnit, Observable <? extends T> other, Scheduler scheduler)
Scheduler this operator will use
timeout - maximum duration between items before a timeout occurs
timeUnit - the unit of time that applies to the
timeout argument
other - the Observable to use as the fallback in case of a timeout
scheduler - the
Scheduler to run the timeout timers on
public final Observable<T> timeout(long timeout, TimeUnit timeUnit, Scheduler scheduler)
TimeoutException.
Scheduler this operator will use
timeout - maximum duration between items before a timeout occurs
timeUnit - the unit of time that applies to the
timeout argument
scheduler - the Scheduler to run the timeout timers on
TimeoutException in case of a timeout
public final Observable<Timestamped <T>> timestamp()
Timestamped object.
timestamp operates by default on the
immediate
Scheduler.
public final Observable<Timestamped <T>> timestamp(Scheduler scheduler)
Timestamped object whose timestamps are provided by a specified Scheduler.
Scheduler this operator will use
scheduler - the
Scheduler to use as a time source
scheduler
public final BlockingObservable<T> toBlocking()
BlockingObservable (an Observable with blocking operators).
toBlocking does not operate by default on a particular
Scheduler.
BlockingObservable version of this Observable
public final Observable<List <T>> toList()
Normally, an Observable that returns multiple items will do so by invoking its Observer's onNext method for each such item. You can change this behavior, instructing the Observable to compose a list of all of these items and then to invoke the Observer's onNext function once, passing it the entire list, by calling the Observable's toList method prior to calling its subscribe() method.
Be careful not to use this operator on Observables that emit infinite or very large numbers of items, as you do not have the option to unsubscribe.
toList does not operate by default on a particular
Scheduler.
public final <K> Observable<Map <K ,T>> toMap(Func1 <? super T ,? extends K> keySelector)
keySelector function.
If more than one source item maps to the same key, the HashMap will contain the latest of those items.
toMap does not operate by default on a particular
Scheduler.
keySelector - the function that extracts the key from a source item to be used in the HashMap
public final <K,V> Observable <Map <K ,V>> toMap(Func1 <? super T ,? extends K> keySelector, Func1 <? super T ,? extends V> valueSelector)
keySelector function.
If more than one source item maps to the same key, the HashMap will contain a single entry that corresponds to the latest of those items.
toMap does not operate by default on a particular
Scheduler.
keySelector - the function that extracts the key from a source item to be used in the HashMap
valueSelector - the function that extracts the value from a source item to be used in the HashMap
public final <K,V> Observable <Map <K ,V>> toMap(Func1 <? super T ,? extends K> keySelector, Func1 <? super T ,? extends V> valueSelector, Func0 <? extends Map <K ,V>> mapFactory)
mapFactory function, that contains keys and values extracted from the items emitted by the source Observable.
toMap does not operate by default on a particular
Scheduler.
keySelector - the function that extracts the key from a source item to be used in the Map
valueSelector - the function that extracts the value from the source items to be used as value in the Map
mapFactory - the function that returns a Map instance to be used
public final <K> Observable<Map <K ,Collection <T>>> toMultimap(Func1 <? super T ,? extends K> keySelector)
keySelector function.
toMultiMap does not operate by default on a particular
Scheduler.
keySelector - the function that extracts the key from the source items to be used as key in the HashMap
public final <K,V> Observable <Map <K ,Collection <V>>> toMultimap(Func1 <? super T ,? extends K> keySelector, Func1 <? super T ,? extends V> valueSelector)
valueSelector function from items emitted by the source Observable, keyed by a specified
keySelector function.
toMultiMap does not operate by default on a particular
Scheduler.
keySelector - the function that extracts a key from the source items to be used as key in the HashMap
valueSelector - the function that extracts a value from the source items to be used as value in the HashMap
public final <K,V> Observable <Map <K ,Collection <V>>> toMultimap(Func1 <? super T ,? extends K> keySelector, Func1 <? super T ,? extends V> valueSelector, Func0 <? extends Map <K ,Collection <V>>> mapFactory)
mapFactory function, that contains an ArrayList of values, extracted by a specified
valueSelector function from items emitted by the source Observable and keyed by the
keySelector function.
toMultiMap does not operate by default on a particular
Scheduler.
keySelector - the function that extracts a key from the source items to be used as the key in the Map
valueSelector - the function that extracts a value from the source items to be used as the value in the Map
mapFactory - the function that returns a Map instance to be used
public final <K,V> Observable <Map <K ,Collection <V>>> toMultimap(Func1 <? super T ,? extends K> keySelector, Func1 <? super T ,? extends V> valueSelector, Func0 <? extends Map <K ,Collection <V>>> mapFactory, Func1 <? super K ,? extends Collection <V>> collectionFactory)
mapFactory function, that contains a custom collection of values, extracted by a specified
valueSelector function from items emitted by the source Observable, and keyed by the
keySelector function.
toMultiMap does not operate by default on a particular
Scheduler.
keySelector - the function that extracts a key from the source items to be used as the key in the Map
valueSelector - the function that extracts a value from the source items to be used as the value in the Map
mapFactory - the function that returns a Map instance to be used
collectionFactory - the function that returns a Collection instance for a particular key to be used in the Map
public final Observable<List <T>> toSortedList()
Comparable with respect to all other items in the sequence.
toSortedList does not operate by default on a particular
Scheduler.
ClassCastException - if any item emitted by the Observable does not implement
Comparable with respect to all other items emitted by the Observable
public final Observable<List <T>> toSortedList(Func2 <? super T ,? super T ,Integer > sortFunction)
toSortedList does not operate by default on a particular
Scheduler.
sortFunction - a function that compares two items emitted by the source Observable and returns an Integer that indicates their sort order
public final Observable<T> unsubscribeOn(Scheduler scheduler)
public final <TClosing> Observable<Observable <T>> window(Func0 <? extends Observable <? extends TClosing>> closingSelector)
closingSelector emits an item.
closingSelector to control data flow.
window does not operate by default on a particular
Scheduler.
closingSelector - a
Func0 that returns an
Observable that governs the boundary between windows. When this
Observable emits an item,
window emits the current window and begins a new one.
closingSelector emits an item
public final Observable<Observable <T>> window(int count)
count items. When the source Observable completes or encounters an error, the resulting Observable emits the current window and propagates the notification from the source Observable.
count to control data flow.
window does not operate by default on a particular
Scheduler.
count - the maximum size of each window before it should be emitted
count items from the source Observable
public final Observable<Observable <T>> window(int count, int skip)
skip items, each containing no more than
count items. When the source Observable completes or encounters an error, the resulting Observable emits the current window and propagates the notification from the source Observable.
count to control data flow.
window does not operate by default on a particular
Scheduler.
count - the maximum size of each window before it should be emitted
skip - how many items need to be skipped before starting a new window. Note that if
skip and
count are equal this is the same operation as
window(int).
skip items containing at most
count items from the source Observable
public final Observable<Observable <T>> window(long timespan, long timeshift, TimeUnit unit)
timeshift argument. It emits each window after a fixed timespan, specified by the
timespan argument. When the source Observable completes or Observable completes or encounters an error, the resulting Observable emits the current window and propagates the notification from the source Observable.
window operates by default on the
computation
Scheduler.
timespan - the period of time each window collects items before it should be emitted
timeshift - the period of time after which a new window will be created
unit - the unit of time that applies to the
timespan and
timeshift arguments
public final Observable<Observable <T>> window(long timespan, long timeshift, TimeUnit unit, Scheduler scheduler)
timeshift argument. It emits each window after a fixed timespan, specified by the
timespan argument. When the source Observable completes or Observable completes or encounters an error, the resulting Observable emits the current window and propagates the notification from the source Observable.
Scheduler this operator will use
timespan - the period of time each window collects items before it should be emitted
timeshift - the period of time after which a new window will be created
unit - the unit of time that applies to the
timespan and
timeshift arguments
scheduler - the
Scheduler to use when determining the end and start of a window
public final Observable<Observable <T>> window(long timespan, long timeshift, TimeUnit unit, int count, Scheduler scheduler)
timeshift argument or a maximum size as specified by the
count argument (whichever is reached first). It emits each window after a fixed timespan, specified by the
timespan argument. When the source Observable completes or Observable completes or encounters an error, the resulting Observable emits the current window and propagates the notification from the source Observable.
Scheduler this operator will use
timespan - the period of time each window collects items before it should be emitted
timeshift - the period of time after which a new window will be created
unit - the unit of time that applies to the
timespan and
timeshift arguments
count - the maximum size of each window before it should be emitted
scheduler - the
Scheduler to use when determining the end and start of a window
public final Observable<Observable <T>> window(long timespan, TimeUnit unit)
timespan argument. When the source Observable completes or encounters an error, the resulting Observable emits the current window and propagates the notification from the source Observable.
window operates by default on the
computation
Scheduler.
timespan - the period of time each window collects items before it should be emitted and replaced with a new window
unit - the unit of time that applies to the
timespan argument
public final Observable<Observable <T>> window(long timespan, TimeUnit unit, int count)
timespan argument or a maximum size as specified by the
count argument (whichever is reached first). When the source Observable completes or encounters an error, the resulting Observable emits the current window and propagates the notification from the source Observable.
window operates by default on the
computation
Scheduler.
timespan - the period of time each window collects items before it should be emitted and replaced with a new window
unit - the unit of time that applies to the
timespan argument
count - the maximum size of each window before it should be emitted
public final Observable<Observable <T>> window(long timespan, TimeUnit unit, int count, Scheduler scheduler)
timespan argument or a maximum size specified by the
count argument (whichever is reached first). When the source Observable completes or encounters an error, the resulting Observable emits the current window and propagates the notification from the source Observable.
Scheduler this operator will use
timespan - the period of time each window collects items before it should be emitted and replaced with a new window
unit - the unit of time which applies to the
timespan argument
count - the maximum size of each window before it should be emitted
scheduler - the
Scheduler to use when determining the end and start of a window
public final Observable<Observable <T>> window(long timespan, TimeUnit unit, Scheduler scheduler)
timespan argument. When the source Observable completes or encounters an error, the resulting Observable emits the current window and propagates the notification from the source Observable.
Scheduler this operator will use
timespan - the period of time each window collects items before it should be emitted and replaced with a new window
unit - the unit of time which applies to the
timespan argument
scheduler - the
Scheduler to use when determining the end and start of a window
public final <TOpening,TClosing> Observable <Observable <T>> window(Observable <? extends TOpening> windowOpenings, Func1 <? super TOpening ,? extends Observable <? extends TClosing>> closingSelector)
windowOpenings Observable emits an item and when the Observable returned by
closingSelector emits an item.
window does not operate by default on a particular
Scheduler.
windowOpenings - an Observable that, when it emits an item, causes another window to be created
closingSelector - a
Func1 that produces an Observable for every window created. When this Observable emits an item, the associated window is closed and emitted
public final <U> Observable<Observable <T>> window(Observable <U> boundary)
boundary Observable to control data flow.
window does not operate by default on a particular
Scheduler.
U - the window element type (ignored)
boundary - an Observable whose emitted items close and open windows
boundary Observable
public final <T2,R> Observable <R> zipWith(Iterable <? extends T2> other, Func2 <? super T ,? super T2 ,? extends R> zipFunction)
Note that the other Iterable is evaluated as items are observed from the source Observable; it is not pre-consumed. This allows you to zip infinite streams on either side.
zipWith does not operate by default on a particular
Scheduler.
T2 - the type of items in the
other Iterable
R - the type of items emitted by the resulting Observable
other - the Iterable sequence
zipFunction - a function that combines the pairs of items from the Observable and the Iterable to generate the items to be emitted by the resulting Observable
other Iterable sequence and emits the results of
zipFunction applied to these pairs
public final <T2,R> Observable <R> zipWith(Observable <? extends T2> other, Func2 <? super T ,? super T2 ,? extends R> zipFunction)
zipWith does not operate by default on a particular
Scheduler.
T2 - the type of items emitted by the
other Observable
R - the type of items emitted by the resulting Observable
other - the other Observable
zipFunction - a function that combines the pairs of items from the two Observables to generate the items to be emitted by the resulting Observable
other Observable and emits the results of
zipFunction applied to these pairs