|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrx.Observable<T>
T
- public class Observable<T>
The Observable interface that implements the Reactive Pattern.
This interface provides overloaded methods for subscribing as well as delegate methods to the various operators.
The documentation for this interface makes use of marble diagrams. The following legend explains these diagrams:
For more information see the RxJava Wiki
Nested Class Summary | |
---|---|
static interface |
Observable.OnSubscribeFunc<T>
Function interface for work to be performed when an Observable is subscribed to via Observable.subscribe(Observer) |
Constructor Summary | |
---|---|
protected |
Observable(Observable.OnSubscribeFunc<T> onSubscribe)
Observable with Function to execute when subscribed to. |
Method Summary | ||
---|---|---|
Observable<T> |
aggregate(Func2<T,T,T> accumulator)
Synonymous with reduce() . |
|
|
aggregate(R initialValue,
Func2<R,? super T,R> accumulator)
Synonymous with reduce() . |
|
Observable<java.lang.Boolean> |
all(Func1<? super T,java.lang.Boolean> predicate)
Returns an Observable that emits a Boolean that indicates whether all of the items emitted by the source Observable satisfy a condition. |
|
static
|
amb(java.lang.Iterable<? extends Observable<? extends T>> sources)
Propagates the observable sequence that reacts first. |
|
static
|
amb(Observable<? extends T> o1,
Observable<? extends T> o2)
Propagates the observable sequence that reacts first. |
|
static
|
amb(Observable<? extends T> o1,
Observable<? extends T> o2,
Observable<? extends T> o3)
Propagates the observable sequence that reacts first. |
|
static
|
amb(Observable<? extends T> o1,
Observable<? extends T> o2,
Observable<? extends T> o3,
Observable<? extends T> o4)
Propagates the observable sequence that reacts first. |
|
static
|
amb(Observable<? extends T> o1,
Observable<? extends T> o2,
Observable<? extends T> o3,
Observable<? extends T> o4,
Observable<? extends T> o5)
Propagates the observable sequence that reacts first. |
|
static
|
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)
Propagates the observable sequence that reacts first. |
|
static
|
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)
Propagates the observable sequence that reacts first. |
|
static
|
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)
Propagates the observable sequence that reacts first. |
|
static
|
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)
Propagates the observable sequence that reacts first. |
|
static Observable<java.lang.Integer> |
average(Observable<java.lang.Integer> source)
Returns an Observable that computes the average of all elements in the source Observable. |
|
static Observable<java.lang.Double> |
averageDoubles(Observable<java.lang.Double> source)
|
|
static Observable<java.lang.Float> |
averageFloats(Observable<java.lang.Float> source)
|
|
static Observable<java.lang.Long> |
averageLongs(Observable<java.lang.Long> source)
|
|
Observable<java.util.List<T>> |
buffer(Func0<? extends Observable<? extends Closing>> bufferClosingSelector)
Creates an Observable which produces buffers of collected values. |
|
Observable<java.util.List<T>> |
buffer(int count)
Creates an Observable which produces buffers of collected values. |
|
Observable<java.util.List<T>> |
buffer(int count,
int skip)
Creates an Observable which produces buffers of collected values. |
|
Observable<java.util.List<T>> |
buffer(long timespan,
long timeshift,
java.util.concurrent.TimeUnit unit)
Creates an Observable which produces buffers of collected values. |
|
Observable<java.util.List<T>> |
buffer(long timespan,
long timeshift,
java.util.concurrent.TimeUnit unit,
Scheduler scheduler)
Creates an Observable which produces buffers of collected values. |
|
Observable<java.util.List<T>> |
buffer(long timespan,
java.util.concurrent.TimeUnit unit)
Creates an Observable which produces buffers of collected values. |
|
Observable<java.util.List<T>> |
buffer(long timespan,
java.util.concurrent.TimeUnit unit,
int count)
Creates an Observable which produces buffers of collected values. |
|
Observable<java.util.List<T>> |
buffer(long timespan,
java.util.concurrent.TimeUnit unit,
int count,
Scheduler scheduler)
Creates an Observable which produces buffers of collected values. |
|
Observable<java.util.List<T>> |
buffer(long timespan,
java.util.concurrent.TimeUnit unit,
Scheduler scheduler)
Creates an Observable which produces buffers of collected values. |
|
Observable<java.util.List<T>> |
buffer(Observable<? extends Opening> bufferOpenings,
Func1<Opening,? extends Observable<? extends Closing>> bufferClosingSelector)
Creates an Observable which produces buffers of collected values. |
|
Observable<T> |
cache()
This method has similar behavior to Observable.replay() except that this auto-subscribes to
the source Observable rather than returning a ConnectableObservable . |
|
|
cast(java.lang.Class<R> klass)
Converts the elements of an observable sequence to the specified type. |
|
static
|
combineLatest(Observable<? extends T1> o1,
Observable<? extends T2> o2,
Func2<? super T1,? super T2,? extends R> combineFunction)
Combines the given observables, emitting an event containing an aggregation of the latest values of each of the source observables each time an event is received from one of the source observables, where the aggregation is defined by the given function. |
|
static
|
combineLatest(Observable<? extends T1> o1,
Observable<? extends T2> o2,
Observable<? extends T3> o3,
Func3<? super T1,? super T2,? super T3,? extends R> combineFunction)
|
|
static
|
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)
|
|
static
|
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)
|
|
static
|
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)
|
|
static
|
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)
|
|
static
|
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)
|
|
static
|
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)
|
|
static
|
concat(Observable<? extends Observable<? extends T>> observables)
Returns an Observable that emits the items emitted by two or more Observables, one after the other. |
|
static
|
concat(Observable<? extends T> t1,
Observable<? extends T> t2)
Returns an Observable that emits the items emitted by two or more Observables, one after the other. |
|
static
|
concat(Observable<? extends T> t1,
Observable<? extends T> t2,
Observable<? extends T> t3)
Returns an Observable that emits the items emitted by two or more Observables, one after the other. |
|
static
|
concat(Observable<? extends T> t1,
Observable<? extends T> t2,
Observable<? extends T> t3,
Observable<? extends T> t4)
Returns an Observable that emits the items emitted by two or more Observables, one after the other. |
|
static
|
concat(Observable<? extends T> t1,
Observable<? extends T> t2,
Observable<? extends T> t3,
Observable<? extends T> t4,
Observable<? extends T> t5)
Returns an Observable that emits the items emitted by two or more Observables, one after the other. |
|
static
|
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)
Returns an Observable that emits the items emitted by two or more Observables, one after the other. |
|
static
|
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)
Returns an Observable that emits the items emitted by two or more Observables, one after the other. |
|
static
|
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)
Returns an Observable that emits the items emitted by two or more Observables, one after the other. |
|
static
|
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)
Returns an Observable that emits the items emitted by two or more Observables, one after the other. |
|
Observable<java.lang.Boolean> |
contains(T element)
Determines whether an observable sequence contains a specified element. |
|
Observable<java.lang.Integer> |
count()
Returns an Observable that counts the total number of elements in the source Observable. |
|
static
|
create(Observable.OnSubscribeFunc<T> func)
Creates an Observable that will execute the given function when an Observer subscribes to it. |
|
Observable<T> |
debounce(long timeout,
java.util.concurrent.TimeUnit unit)
Debounces by dropping all values that are followed by newer values before the timeout value expires. |
|
Observable<T> |
debounce(long timeout,
java.util.concurrent.TimeUnit unit,
Scheduler scheduler)
Debounces by dropping all values that are followed by newer values before the timeout value expires. |
|
Observable<T> |
defaultIfEmpty(T defaultValue)
Returns the elements of the specified sequence or the specified default value in a singleton sequence if the sequence is empty. |
|
static
|
defer(Func0<? extends Observable<? extends T>> observableFactory)
Returns an Observable that calls an Observable factory to create its Observable for each new Observer that subscribes. |
|
|
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<T> |
distinct()
Returns an Observable that forwards all distinct items emitted from the source Observable. |
|
|
distinct(Func1<? super T,? extends U> keySelector)
Returns an Observable that forwards all items emitted from the source Observable that are distinct according to a key selector function. |
|
Observable<T> |
distinctUntilChanged()
Returns an Observable that forwards all sequentially distinct items emitted from the source Observable. |
|
|
distinctUntilChanged(Func1<? super T,? extends U> keySelector)
Returns an Observable that forwards all items emitted from the source Observable that are sequentially distinct according to a key selector function. |
|
Observable<T> |
doOnEach(Action1<T> onNext)
Invokes an action for each element in the observable sequence. |
|
Observable<T> |
doOnEach(Action1<T> onNext,
Action0 onCompleted)
Invokes an action for each element in the observable sequence. |
|
Observable<T> |
doOnEach(Action1<T> onNext,
Action1<java.lang.Throwable> onError)
Invokes an action for each element in the observable sequence. |
|
Observable<T> |
doOnEach(Action1<T> onNext,
Action1<java.lang.Throwable> onError,
Action0 onCompleted)
Invokes an action for each element in the observable sequence. |
|
Observable<T> |
doOnEach(Observer<? super T> observer)
Invokes an action for each element in the observable sequence. |
|
Observable<T> |
elementAt(int index)
Returns the element at a specified index in a sequence. |
|
Observable<T> |
elementAtOrDefault(int index,
T defaultValue)
Returns the element at a specified index in a sequence or the default value if the index is out of range. |
|
static
|
empty()
Returns an Observable that emits no data to the Observer and immediately invokes
its onCompleted method. |
|
static
|
empty(Scheduler scheduler)
Returns an Observable that emits no data to the Observer and immediately invokes
its onCompleted method with the specified scheduler. |
|
static
|
error(java.lang.Throwable exception)
Returns an Observable that invokes an Observer 's onError method when the Observer subscribes to it |
|
static
|
error(java.lang.Throwable exception,
Scheduler scheduler)
Returns an Observable that invokes an Observer 's onError method with the specified scheduler. |
|
Observable<java.lang.Boolean> |
exists(Func1<? super T,java.lang.Boolean> predicate)
Returns an Observable that emits true if any element of the source Observable satisfies
the given condition, otherwise false . |
|
Observable<T> |
filter(Func1<? super T,java.lang.Boolean> predicate)
Filter items emitted by an Observable. |
|
Observable<T> |
finallyDo(Action0 action)
Registers an Action0 to be called when this Observable invokes onCompleted or onError . |
|
Observable<T> |
first()
Returns an Observable that emits only the very first item emitted by the source Observable. |
|
Observable<T> |
first(Func1<? super T,java.lang.Boolean> predicate)
Returns an Observable that emits only the very first item emitted by the source Observable that satisfies a given condition. |
|
Observable<T> |
firstOrDefault(Func1<? super T,java.lang.Boolean> predicate,
T defaultValue)
Returns an Observable that emits only the very first item emitted by the source Observable that satisfies a given condition, or a default value otherwise. |
|
Observable<T> |
firstOrDefault(T defaultValue)
Returns an Observable that emits only the very first item emitted by the source Observable, or a default value. |
|
|
flatMap(Func1<? super T,? extends Observable<? extends R>> func)
Creates a new Observable by 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. |
|
static
|
from(java.util.concurrent.Future<? extends T> future)
Converts a Future into an Observable. |
|
static
|
from(java.util.concurrent.Future<? extends T> future,
long timeout,
java.util.concurrent.TimeUnit unit)
Converts a Future into an Observable with timeout. |
|
static
|
from(java.util.concurrent.Future<? extends T> future,
Scheduler scheduler)
Converts a Future into an Observable. |
|
static
|
from(java.lang.Iterable<? extends T> iterable)
Converts an Iterable sequence into an Observable. |
|
static
|
from(T t1)
Converts a series of items into an Observable. |
|
static
|
from(T[] items)
Converts an Array into an Observable. |
|
static
|
from(T t1,
T t2)
Converts a series of items into an Observable. |
|
static
|
from(T t1,
T t2,
T t3)
Converts a series of items into an Observable. |
|
static
|
from(T t1,
T t2,
T t3,
T t4)
Converts a series of items into an Observable. |
|
static
|
from(T t1,
T t2,
T t3,
T t4,
T t5)
Converts a series of items into an Observable. |
|
static
|
from(T t1,
T t2,
T t3,
T t4,
T t5,
T t6)
Converts a series of items into an Observable. |
|
static
|
from(T t1,
T t2,
T t3,
T t4,
T t5,
T t6,
T t7)
Converts a series of items into an Observable. |
|
static
|
from(T t1,
T t2,
T t3,
T t4,
T t5,
T t6,
T t7,
T t8)
Converts a series of items into an Observable. |
|
static
|
from(T t1,
T t2,
T t3,
T t4,
T t5,
T t6,
T t7,
T t8,
T t9)
Converts a series of items into an Observable. |
|
static
|
from(T t1,
T t2,
T t3,
T t4,
T t5,
T t6,
T t7,
T t8,
T t9,
T t10)
Converts a series of items into an Observable. |
|
|
groupBy(Func1<? super T,? extends K> keySelector)
Groups the items emitted by an Observable according to a specified criterion, and emits these grouped items as GroupedObservable s, one GroupedObservable per group. |
|
|
groupBy(Func1<? super T,? extends K> keySelector,
Func1<? super T,? extends R> elementSelector)
Groups the items emitted by an Observable according to a specified criterion, and emits these grouped items as GroupedObservable s, one GroupedObservable per group. |
|
Observable<T> |
ignoreElements()
Ignores all values in an observable sequence and only calls onCompleted or onError method. |
|
static Observable<java.lang.Long> |
interval(long interval,
java.util.concurrent.TimeUnit unit)
Emits an item each time interval (containing a sequential number). |
|
static Observable<java.lang.Long> |
interval(long interval,
java.util.concurrent.TimeUnit unit,
Scheduler scheduler)
Emits an item each time interval (containing a sequential number). |
|
Observable<java.lang.Boolean> |
isEmpty()
Returns an Observable that emits true if the source Observable is empty, otherwise false . |
|
static
|
just(T value)
Returns an Observable that emits a single item and then completes. |
|
static
|
just(T value,
Scheduler scheduler)
Returns an Observable that emits a single item and then completes on a specified scheduler. |
|
Observable<T> |
last()
Returns an Observable that emits the last element of the source or an IllegalArgumentException if the source Observable is empty. |
|
|
map(Func1<? super T,? extends R> func)
Returns an Observable that applies the given function to each item emitted by an Observable and emits the result. |
|
|
mapMany(Func1<? super T,? extends Observable<? extends R>> func)
Creates a new Observable by 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. |
|
|
mapWithIndex(Func2<? super T,java.lang.Integer,? extends R> func)
Returns an Observable that applies the given function to each item emitted by an Observable and emits the result. |
|
Observable<Notification<T>> |
materialize()
Turns all of the notifications from a source Observable into onNext emissions, and marks them with their original notification types within Notification objects. |
|
Observable<T> |
max(java.util.Comparator<T> comparator)
Returns the maximum element in an observable sequence according to the specified comparator. |
|
static
|
max(Observable<T> source)
Returns the maximum element in an observable sequence. |
|
|
maxBy(Func1<T,R> selector)
Returns the elements in an observable sequence with the maximum key value. |
|
|
maxBy(Func1<T,R> selector,
java.util.Comparator<R> comparator)
Returns the elements in an observable sequence with the maximum key value according to the specified comparator. |
|
static
|
merge(Observable<? extends Observable<? extends T>> source)
Flattens a sequence of Observables emitted by an Observable into one Observable, without any transformation. |
|
static
|
merge(Observable<? extends T> t1,
Observable<? extends T> t2)
Flattens a series of Observables into one Observable, without any transformation. |
|
static
|
merge(Observable<? extends T> t1,
Observable<? extends T> t2,
Observable<? extends T> t3)
Flattens a series of Observables into one Observable, without any transformation. |
|
static
|
merge(Observable<? extends T> t1,
Observable<? extends T> t2,
Observable<? extends T> t3,
Observable<? extends T> t4)
Flattens a series of Observables into one Observable, without any transformation. |
|
static
|
merge(Observable<? extends T> t1,
Observable<? extends T> t2,
Observable<? extends T> t3,
Observable<? extends T> t4,
Observable<? extends T> t5)
Flattens a series of Observables into one Observable, without any transformation. |
|
static
|
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)
Flattens a series of Observables into one Observable, without any transformation. |
|
static
|
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)
Flattens a series of Observables into one Observable, without any transformation. |
|
static
|
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)
Flattens a series of Observables into one Observable, without any transformation. |
|
static
|
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)
Flattens a series of Observables into one Observable, without any transformation. |
|
static
|
mergeDelayError(Observable<? extends Observable<? extends T>> source)
This behaves like Observable.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. |
|
static
|
mergeDelayError(Observable<? extends T> t1,
Observable<? extends T> t2)
This behaves like Observable.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. |
|
static
|
mergeDelayError(Observable<? extends T> t1,
Observable<? extends T> t2,
Observable<? extends T> t3)
This behaves like Observable.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. |
|
static
|
mergeDelayError(Observable<? extends T> t1,
Observable<? extends T> t2,
Observable<? extends T> t3,
Observable<? extends T> t4)
This behaves like Observable.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. |
|
static
|
mergeDelayError(Observable<? extends T> t1,
Observable<? extends T> t2,
Observable<? extends T> t3,
Observable<? extends T> t4,
Observable<? extends T> t5)
This behaves like Observable.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. |
|
static
|
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 Observable.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. |
|
static
|
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 Observable.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. |
|
static
|
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 Observable.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. |
|
static
|
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 Observable.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. |
|
Observable<T> |
min(java.util.Comparator<T> comparator)
Returns the minimum element in an observable sequence according to the specified comparator. |
|
static
|
min(Observable<T> source)
Returns the minimum element in an observable sequence. |
|
|
minBy(Func1<T,R> selector)
Returns the elements in an observable sequence with the minimum key value. |
|
|
minBy(Func1<T,R> selector,
java.util.Comparator<R> comparator)
Returns the elements in an observable sequence with the minimum key value according to the specified comparator. |
|
|
multicast(Subject<? super T,? extends R> subject)
Returns a ConnectableObservable that upon connection causes the source Observable to
push results into the specified subject. |
|
static
|
never()
Returns an Observable that never sends any items or notifications to an Observer . |
|
Observable<T> |
observeOn(Scheduler scheduler)
Asynchronously notify Observer s on the specified Scheduler . |
|
|
ofType(java.lang.Class<R> klass)
Filters the elements of an observable sequence based on the specified type. |
|
Observable<T> |
onErrorResumeNext(Func1<java.lang.Throwable,? extends Observable<? extends T>> resumeFunction)
Instruct an Observable to pass control to another Observable rather than invoking onError if it encounters an error. |
|
Observable<T> |
onErrorResumeNext(Observable<? extends T> resumeSequence)
Instruct an Observable to pass control to another Observable rather than invoking onError if it encounters an error. |
|
Observable<T> |
onErrorReturn(Func1<java.lang.Throwable,? extends T> resumeFunction)
Instruct an Observable to emit an item (returned by a specified function) rather than invoking onError if it encounters an error. |
|
Observable<T> |
onExceptionResumeNext(Observable<? extends T> resumeSequence)
Instruct an Observable to pass control to another Observable rather than invoking onError if it encounters an error of type Exception . |
|
|
parallel(Func1<Observable<T>,Observable<R>> f)
Perform work in parallel by sharding an Observable<T> on a Schedulers.threadPoolForComputation() Scheduler and return an Observable<R> with the output. |
|
|
parallel(Func1<Observable<T>,Observable<R>> f,
Scheduler s)
Perform work in parallel by sharding an Observable<T> on a Scheduler and return an Observable<R> with the output. |
|
ConnectableObservable<T> |
publish()
Returns a ConnectableObservable , which waits until its connect method is called before it begins emitting
items to those Observer s that have subscribed to it. |
|
ConnectableObservable<T> |
publishLast()
Returns a ConnectableObservable that shares a single subscription that contains the last notification only. |
|
static Observable<java.lang.Integer> |
range(int start,
int count)
Generates an Observable that emits a sequence of integers within a specified range. |
|
Observable<T> |
reduce(Func2<T,T,T> accumulator)
Returns an Observable that applies a function of your choosing 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. |
|
|
reduce(R initialValue,
Func2<R,? super T,R> accumulator)
Returns an Observable that applies a function of your choosing to the first item emitted by a source Observable, 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. |
|
ConnectableObservable<T> |
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 . |
|
Observable<T> |
retry()
Retry subscription to origin Observable whenever onError is called (infinite retry count). |
|
Observable<T> |
retry(int retryCount)
Retry subscription to origin Observable upto given retry count. |
|
Observable<T> |
sample(long period,
java.util.concurrent.TimeUnit unit)
Returns an Observable that emits the results of sampling the items emitted by the source Observable at a specified time interval. |
|
Observable<T> |
sample(long period,
java.util.concurrent.TimeUnit unit,
Scheduler scheduler)
Returns an Observable that emits the results of sampling the items emitted by the source Observable at a specified time interval. |
|
Observable<T> |
scan(Func2<T,T,T> accumulator)
Returns an Observable that applies a function of your choosing to the first item emitted by a source Observable, 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 result of each of these iterations. |
|
|
scan(R initialValue,
Func2<R,? super T,R> accumulator)
Returns an Observable that applies a function of your choosing to the first item emitted by a source Observable, 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 result of each of these iterations. |
|
static
|
sequenceEqual(Observable<? extends T> first,
Observable<? extends T> second)
Returns an Observable that emits Boolean values that indicate whether the pairs of items emitted by two source Observables are equal. |
|
static
|
sequenceEqual(Observable<? extends T> first,
Observable<? extends T> second,
Func2<? super T,? super T,java.lang.Boolean> equality)
Returns an Observable that emits Boolean values that indicate whether the pairs of items emitted by two source Observables are equal based on the results of a specified equality function. |
|
Observable<T> |
skip(int num)
Returns an Observable that skips the first num items emitted by the source
Observable and emits the remainder. |
|
Observable<T> |
skipLast(int count)
Bypasses a specified number of elements at the end of an observable sequence. |
|
Observable<T> |
skipWhile(Func1<? super T,java.lang.Boolean> predicate)
Returns an Observable that bypasses all items from the source Observable as long as the specified condition holds true. |
|
Observable<T> |
skipWhileWithIndex(Func2<? super T,java.lang.Integer,java.lang.Boolean> predicate)
Returns an Observable that bypasses all items from the source Observable as long as the specified condition holds true. |
|
Observable<T> |
startWith(java.lang.Iterable<T> values)
Emit a specified set of items before beginning to emit items from the source Observable. |
|
Observable<T> |
startWith(T t1)
Emit a specified set of items before beginning to emit items from the source Observable. |
|
Observable<T> |
startWith(T t1,
T t2)
Emit a specified set of items before beginning to emit items from the source Observable. |
|
Observable<T> |
startWith(T t1,
T t2,
T t3)
Emit a specified set of items before beginning to emit items from the source Observable. |
|
Observable<T> |
startWith(T t1,
T t2,
T t3,
T t4)
Emit a specified set of items before beginning to emit items from the source Observable. |
|
Observable<T> |
startWith(T t1,
T t2,
T t3,
T t4,
T t5)
Emit a specified set of items before beginning to emit items from the source Observable. |
|
Observable<T> |
startWith(T t1,
T t2,
T t3,
T t4,
T t5,
T t6)
Emit a specified set of items before beginning to emit items from the source Observable. |
|
Observable<T> |
startWith(T t1,
T t2,
T t3,
T t4,
T t5,
T t6,
T t7)
Emit a specified set of items before beginning to emit items from the source Observable. |
|
Observable<T> |
startWith(T t1,
T t2,
T t3,
T t4,
T t5,
T t6,
T t7,
T t8)
Emit a specified set of items before beginning to emit items from the source Observable. |
|
Observable<T> |
startWith(T t1,
T t2,
T t3,
T t4,
T t5,
T t6,
T t7,
T t8,
T t9)
Emit a specified set of items before beginning to emit items from the source Observable. |
|
Subscription |
subscribe(Action1<? super T> onNext)
An Observer must call an Observable's subscribe method in order to
receive items and notifications from the Observable. |
|
Subscription |
subscribe(Action1<? super T> onNext,
Action1<java.lang.Throwable> onError)
|
|
Subscription |
subscribe(Action1<? super T> onNext,
Action1<java.lang.Throwable> onError,
Action0 onComplete)
An Observer must call an Observable's subscribe method in order to
receive items and notifications from the Observable. |
|
Subscription |
subscribe(Action1<? super T> onNext,
Action1<java.lang.Throwable> onError,
Action0 onComplete,
Scheduler scheduler)
An Observer must call an Observable's subscribe method in order to
receive items and notifications from the Observable. |
|
Subscription |
subscribe(Action1<? super T> onNext,
Action1<java.lang.Throwable> onError,
Scheduler scheduler)
An Observer must call an Observable's subscribe method in order to
receive items and notifications from the Observable. |
|
Subscription |
subscribe(Action1<? super T> onNext,
Scheduler scheduler)
An Observer must call an Observable's subscribe method in order to
receive items and notifications from the Observable. |
|
Subscription |
subscribe(Observer<? super T> observer)
An Observer must call an Observable's subscribe method in order to
receive items and notifications from the Observable. |
|
Subscription |
subscribe(Observer<? super T> observer,
Scheduler scheduler)
An Observer must call an Observable's subscribe method in order to
receive items and notifications from the Observable. |
|
Observable<T> |
subscribeOn(Scheduler scheduler)
Asynchronously subscribes and unsubscribes Observers on the specified Scheduler . |
|
static Observable<java.lang.Integer> |
sum(Observable<java.lang.Integer> source)
Returns an Observable that sums up the elements in the source Observable. |
|
static Observable<java.lang.Double> |
sumDoubles(Observable<java.lang.Double> source)
|
|
static Observable<java.lang.Float> |
sumFloats(Observable<java.lang.Float> source)
|
|
static Observable<java.lang.Long> |
sumLongs(Observable<java.lang.Long> source)
|
|
static
|
switchDo(Observable<? extends Observable<? extends T>> sequenceOfSequences)
Deprecated. Being renamed to Observable.switchOnNext(rx.Observable extends rx.Observable extends T>>) |
|
static
|
switchOnNext(Observable<? extends Observable<? extends T>> sequenceOfSequences)
Given an Observable that emits Observables, creates a single Observable that emits the items emitted by the most recently published of those Observables. |
|
Observable<T> |
synchronize()
Accepts an Observable and wraps it in another Observable that ensures that the resulting Observable is chronologically well-behaved. |
|
Observable<T> |
synchronize(java.lang.Object lock)
Accepts an Observable and wraps it in another Observable that ensures that the resulting Observable is chronologically well-behaved. |
|
static
|
synchronize(Observable<T> source)
Deprecated. Replaced with instance method. |
|
Observable<T> |
take(int num)
Returns an Observable that emits only the first num items emitted by the source
Observable. |
|
Observable<T> |
takeFirst()
Returns an Observable that emits only the very first item emitted by the source Observable. |
|
Observable<T> |
takeFirst(Func1<? super T,java.lang.Boolean> predicate)
Returns an Observable that emits only the very first item emitted by the source Observable that satisfies a given condition. |
|
Observable<T> |
takeLast(int count)
Returns an Observable that emits only the last count items emitted by the source
Observable. |
|
|
takeUntil(Observable<? extends E> other)
Returns an Observable that emits the items from the source Observable only until the other Observable emits an item. |
|
Observable<T> |
takeWhile(Func1<? super T,java.lang.Boolean> predicate)
Returns an Observable that emits items emitted by the source Observable so long as a specified condition is true. |
|
Observable<T> |
takeWhileWithIndex(Func2<? super T,? super java.lang.Integer,java.lang.Boolean> predicate)
Returns an Observable that emits the items emitted by a source Observable so long as a given predicate remains true, where the predicate can operate on both the item and its index relative to the complete sequence. |
|
Observable<T> |
throttleFirst(long windowDuration,
java.util.concurrent.TimeUnit unit)
Throttles by skipping value until `skipDuration` passes and then emits the next received value. |
|
Observable<T> |
throttleFirst(long skipDuration,
java.util.concurrent.TimeUnit unit,
Scheduler scheduler)
Throttles by skipping value until `skipDuration` passes and then emits the next received value. |
|
Observable<T> |
throttleLast(long intervalDuration,
java.util.concurrent.TimeUnit unit)
Throttles by returning the last value of each interval defined by 'intervalDuration'. |
|
Observable<T> |
throttleLast(long intervalDuration,
java.util.concurrent.TimeUnit unit,
Scheduler scheduler)
Throttles by returning the last value of each interval defined by 'intervalDuration'. |
|
Observable<T> |
throttleWithTimeout(long timeout,
java.util.concurrent.TimeUnit unit)
Debounces by dropping all values that are followed by newer values before the timeout value expires. |
|
Observable<T> |
throttleWithTimeout(long timeout,
java.util.concurrent.TimeUnit unit,
Scheduler scheduler)
Debounces by dropping all values that are followed by newer values before the timeout value expires. |
|
Observable<TimeInterval<T>> |
timeInterval()
Records the time interval between consecutive elements in an observable sequence. |
|
Observable<TimeInterval<T>> |
timeInterval(Scheduler scheduler)
Records the time interval between consecutive elements in an observable sequence, using the specified scheduler to compute time intervals. |
|
Observable<T> |
timeout(long timeout,
java.util.concurrent.TimeUnit timeUnit)
Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers. |
|
Observable<T> |
timeout(long timeout,
java.util.concurrent.TimeUnit timeUnit,
Observable<? extends T> other)
Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers. |
|
Observable<T> |
timeout(long timeout,
java.util.concurrent.TimeUnit timeUnit,
Observable<? extends T> other,
Scheduler scheduler)
Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers. |
|
Observable<T> |
timeout(long timeout,
java.util.concurrent.TimeUnit timeUnit,
Scheduler scheduler)
Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers. |
|
Observable<Timestamped<T>> |
timestamp()
Wraps each item emitted by a source Observable in a Timestamped object. |
|
BlockingObservable<T> |
toBlockingObservable()
Converts an Observable into a BlockingObservable (an Observable with blocking
operators). |
|
Observable<java.util.List<T>> |
toList()
Returns an Observable that emits a single item, a list composed of all the items emitted by the source Observable. |
|
Observable<java.util.List<T>> |
toSortedList()
Return an Observable that emits the items emitted by the source Observable, in a sorted order (each item emitted by the Observable must implement Comparable with respect to
all other items in the sequence). |
|
Observable<java.util.List<T>> |
toSortedList(Func2<? super T,? super T,java.lang.Integer> sortFunction)
Return an Observable that emits the items emitted by the source Observable, in a sorted order based on a specified comparison function |
|
static
|
using(Func0<RESOURCE> resourceFactory,
Func1<RESOURCE,Observable<T>> observableFactory)
Constructs an observable sequence that depends on a resource object. |
|
Observable<T> |
where(Func1<? super T,java.lang.Boolean> predicate)
Filter items emitted by an Observable. |
|
Observable<Observable<T>> |
window(Func0<? extends Observable<? extends Closing>> closingSelector)
Creates an Observable which produces windows of collected values. |
|
Observable<Observable<T>> |
window(int count)
Creates an Observable which produces windows of collected values. |
|
Observable<Observable<T>> |
window(int count,
int skip)
Creates an Observable which produces windows of collected values. |
|
Observable<Observable<T>> |
window(long timespan,
long timeshift,
java.util.concurrent.TimeUnit unit)
Creates an Observable which produces windows of collected values. |
|
Observable<Observable<T>> |
window(long timespan,
long timeshift,
java.util.concurrent.TimeUnit unit,
Scheduler scheduler)
Creates an Observable which produces windows of collected values. |
|
Observable<Observable<T>> |
window(long timespan,
java.util.concurrent.TimeUnit unit)
Creates an Observable which produces windows of collected values. |
|
Observable<Observable<T>> |
window(long timespan,
java.util.concurrent.TimeUnit unit,
int count)
Creates an Observable which produces windows of collected values. |
|
Observable<Observable<T>> |
window(long timespan,
java.util.concurrent.TimeUnit unit,
int count,
Scheduler scheduler)
Creates an Observable which produces windows of collected values. |
|
Observable<Observable<T>> |
window(long timespan,
java.util.concurrent.TimeUnit unit,
Scheduler scheduler)
Creates an Observable which produces windows of collected values. |
|
Observable<Observable<T>> |
window(Observable<? extends Opening> windowOpenings,
Func1<Opening,? extends Observable<? extends Closing>> closingSelector)
Creates an Observable which produces windows of collected values. |
|
static
|
zip(java.lang.Iterable<? extends Observable<?>> ws,
FuncN<? extends R> zipFunction)
Returns an Observable that emits the results of a function of your choosing applied to combinations of four items emitted, in sequence, by four other Observables. |
|
static
|
zip(Observable<? extends Observable<?>> ws,
FuncN<? extends R> zipFunction)
Returns an Observable that emits the results of a function of your choosing applied to combinations of N items emitted, in sequence, by N other Observables as provided by an Iterable. |
|
static
|
zip(Observable<? extends T1> o1,
Observable<? extends T2> o2,
Func2<? super T1,? super T2,? extends R> zipFunction)
Returns an Observable that emits the results of a function of your choosing applied to combinations of two items emitted, in sequence, by two other Observables. |
|
static
|
zip(Observable<? extends T1> o1,
Observable<? extends T2> o2,
Observable<? extends T3> o3,
Func3<? super T1,? super T2,? super T3,? extends R> zipFunction)
Returns an Observable that emits the results of a function of your choosing applied to combinations of three items emitted, in sequence, by three other Observables. |
|
static
|
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)
Returns an Observable that emits the results of a function of your choosing applied to combinations of four items emitted, in sequence, by four other Observables. |
|
static
|
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)
Returns an Observable that emits the results of a function of your choosing applied to combinations of five items emitted, in sequence, by five other Observables. |
|
static
|
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)
Returns an Observable that emits the results of a function of your choosing applied to combinations of six items emitted, in sequence, by six other Observables. |
|
static
|
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)
Returns an Observable that emits the results of a function of your choosing applied to combinations of seven items emitted, in sequence, by seven other Observables. |
|
static
|
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)
Returns an Observable that emits the results of a function of your choosing applied to combinations of eight items emitted, in sequence, by eight other Observables. |
|
static
|
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)
Returns an Observable that emits the results of a function of your choosing applied to combinations of nine items emitted, in sequence, by nine other Observables. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Observable(Observable.OnSubscribeFunc<T> onSubscribe)
NOTE: Use Observable.create(OnSubscribeFunc)
to create an Observable instead of this constructor unless you
specifically have a need for inheritance.
onSubscribe
- Observable.OnSubscribeFunc
to be executed when Observable.subscribe(Observer)
is called.Method Detail |
---|
public Subscription subscribe(Observer<? super T> observer)
Observer
must call an Observable's subscribe
method in order to
receive items and notifications from the Observable.
A typical implementation of subscribe
does the following:
It stores a reference to the Observer in a collection object, such as a List<T>
object.
It returns a reference to the Subscription
interface. This enables Observers to
unsubscribe, that is, to stop receiving items and notifications before the Observable stops
sending them, which also invokes the Observer's onCompleted
method.
An Observable<T>
instance is responsible for accepting all subscriptions
and notifying all Observers. Unless the documentation for a particular
Observable<T>
implementation indicates otherwise, Observers should make no
assumptions about the order in which multiple Observers will receive their notifications.
For more information see the RxJava Wiki
observer
- the observer
Subscription
reference with which the Observer
can stop receiving items
before the Observable has finished sending them
java.lang.IllegalArgumentException
- if the Observer
provided as the argument to subscribe()
is null
public Subscription subscribe(Observer<? super T> observer, Scheduler scheduler)
Observer
must call an Observable's subscribe
method in order to
receive items and notifications from the Observable.
A typical implementation of subscribe
does the following:
It stores a reference to the Observer in a collection object, such as a List<T>
object.
It returns a reference to the Subscription
interface. This enables Observers to
unsubscribe, that is, to stop receiving items and notifications before the Observable stops
sending them, which also invokes the Observer's onCompleted
method.
An Observable<T>
instance is responsible for accepting all subscriptions
and notifying all Observers. Unless the documentation for a particular Observable<T>
implementation indicates otherwise, Observers should make no
assumptions about the order in which multiple Observers will receive their notifications.
For more information see the RxJava Wiki
observer
- the observerscheduler
- the Scheduler
on which Observers subscribe to the Observable
Subscription
reference with which Observers can stop receiving items and
notifications before the Observable has finished sending them
java.lang.IllegalArgumentException
- if an argument to subscribe()
is null
public Subscription subscribe(Action1<? super T> onNext)
Observer
must call an Observable's subscribe
method in order to
receive items and notifications from the Observable.
onNext
- public Subscription subscribe(Action1<? super T> onNext, Scheduler scheduler)
Observer
must call an Observable's subscribe
method in order to
receive items and notifications from the Observable.
onNext
- scheduler
- public Subscription subscribe(Action1<? super T> onNext, Action1<java.lang.Throwable> onError)
public Subscription subscribe(Action1<? super T> onNext, Action1<java.lang.Throwable> onError, Scheduler scheduler)
Observer
must call an Observable's subscribe
method in order to
receive items and notifications from the Observable.
onNext
- onError
- scheduler
- public Subscription subscribe(Action1<? super T> onNext, Action1<java.lang.Throwable> onError, Action0 onComplete)
Observer
must call an Observable's subscribe
method in order to
receive items and notifications from the Observable.
onNext
- onError
- onComplete
- public Subscription subscribe(Action1<? super T> onNext, Action1<java.lang.Throwable> onError, Action0 onComplete, Scheduler scheduler)
Observer
must call an Observable's subscribe
method in order to
receive items and notifications from the Observable.
onNext
- onError
- onComplete
- scheduler
- public <R> ConnectableObservable<R> multicast(Subject<? super T,? extends R> subject)
ConnectableObservable
that upon connection causes the source Observable to
push results into the specified subject.
R
- result typesubject
- the Subject
for the ConnectableObservable
to push source items
into
ConnectableObservable
that upon connection causes the source Observable to
push results into the specified Subject
public static <T> Observable<T> create(Observable.OnSubscribeFunc<T> func)
Observer
subscribes to it.
Write the function you pass to create
so that it behaves as an Observable: It
should invoke the Observer's onNext
, onError
, and onCompleted
methods
appropriately.
A well-formed Observable must invoke either the Observer's onCompleted
method
exactly once or its onError
method exactly once.
See Rx Design Guidelines (PDF) for detailed information.
T
- the type of the items that this Observable emitsfunc
- a function that accepts an Observer<T>
, invokes its onNext
, onError
, and onCompleted
methods
as appropriate, and returns a Subscription
to allow the Observer to
canceling the subscription
Observer
subscribes to it, will execute the given
functionpublic static <T> Observable<T> empty()
Observer
and immediately invokes
its onCompleted
method.
T
- the type of the items (ostensibly) emitted by the Observable
Observer
and immediately invokes
the Observer
's onCompleted
methodpublic static <T> Observable<T> empty(Scheduler scheduler)
Observer
and immediately invokes
its onCompleted
method with the specified scheduler.
T
- the type of the items (ostensibly) emitted by the Observablescheduler
- the scheduler to call the onCompleted
method.
Observer
and immediately invokes
the Observer
's onCompleted
method with
the specified scheduler.public static <T> Observable<T> error(java.lang.Throwable exception)
Observer
's onError
method when the Observer subscribes to it
T
- the type of the items (ostensibly) emitted by the Observableexception
- the particular error to report
Observer
's onError
method when the Observer subscribes to itpublic static <T> Observable<T> error(java.lang.Throwable exception, Scheduler scheduler)
Observer
's onError
method with the specified scheduler.
T
- the type of the items (ostensibly) emitted by the Observableexception
- the particular error to reportscheduler
- the scheduler to call the onError
method.
Observer
's onError
method with the specified scheduler.public static <T> Observable<T> from(java.lang.Iterable<? extends T> iterable)
Iterable
sequence into an Observable.
Implementation note: the entire iterable sequence will be immediately emitted each time an Observer
subscribes. Since this occurs before the Subscription
is returned,
it in not possible to unsubscribe from the sequence before it completes.
T
- the type of items in the Iterable
sequence and the type of items to be
emitted by the resulting Observableiterable
- the source Iterable
sequence
Iterable
sequencepublic static <T> Observable<T> from(T[] items)
Implementation note: the entire iterable sequence will be immediately emitted each time an Observer
subscribes. Since this occurs before the Subscription
is returned,
it in not possible to unsubscribe from the sequence before it completes.
T
- the type of items in the Iterable
sequence and the type of items to be
emitted by the resulting Observableitems
- the source sequence
Iterable
sequencepublic static <T> Observable<T> from(T t1)
Implementation note: the entire array will be immediately emitted each time an Observer
subscribes. Since this occurs before the Subscription
is returned,
it in not possible to unsubscribe from the sequence before it completes.
T
- the type of items in the Array, and the type of items to be emitted by the
resulting Observablet1
- item
public static <T> Observable<T> from(T t1, T t2)
Implementation note: the entire array will be immediately emitted each time an Observer
subscribes. Since this occurs before the Subscription
is returned,
it in not possible to unsubscribe from the sequence before it completes.
T
- the type of items in the Array, and the type of items to be emitted by the
resulting Observablet1
- itemt2
- item
public static <T> Observable<T> from(T t1, T t2, T t3)
Implementation note: the entire array will be immediately emitted each time an Observer
subscribes. Since this occurs before the Subscription
is returned,
it in not possible to unsubscribe from the sequence before it completes.
T
- the type of items in the Array, and the type of items to be emitted by the
resulting Observablet1
- itemt2
- itemt3
- item
public static <T> Observable<T> from(T t1, T t2, T t3, T t4)
Implementation note: the entire array will be immediately emitted each time an Observer
subscribes. Since this occurs before the Subscription
is returned,
it in not possible to unsubscribe from the sequence before it completes.
T
- the type of items in the Array, and the type of items to be emitted by the
resulting Observablet1
- itemt2
- itemt3
- itemt4
- item
public static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5)
Implementation note: the entire array will be immediately emitted each time an Observer
subscribes. Since this occurs before the Subscription
is returned,
it in not possible to unsubscribe from the sequence before it completes.
T
- the type of items in the Array, and the type of items to be emitted by the
resulting Observablet1
- itemt2
- itemt3
- itemt4
- itemt5
- item
public static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6)
Implementation note: the entire array will be immediately emitted each time an Observer
subscribes. Since this occurs before the Subscription
is returned,
it in not possible to unsubscribe from the sequence before it completes.
T
- the type of items in the Array, and the type of items to be emitted by the
resulting Observablet1
- itemt2
- itemt3
- itemt4
- itemt5
- itemt6
- item
public static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6, T t7)
Implementation note: the entire array will be immediately emitted each time an Observer
subscribes. Since this occurs before the Subscription
is returned,
it in not possible to unsubscribe from the sequence before it completes.
T
- the type of items in the Array, and the type of items to be emitted by the
resulting Observablet1
- itemt2
- itemt3
- itemt4
- itemt5
- itemt6
- itemt7
- item
public static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8)
Implementation note: the entire array will be immediately emitted each time an Observer
subscribes. Since this occurs before the Subscription
is returned,
it in not possible to unsubscribe from the sequence before it completes.
T
- the type of items in the Array, and the type of items to be emitted by the
resulting Observablet1
- itemt2
- itemt3
- itemt4
- itemt5
- itemt6
- itemt7
- itemt8
- item
public static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8, T t9)
Implementation note: the entire array will be immediately emitted each time an Observer
subscribes. Since this occurs before the Subscription
is returned,
it in not possible to unsubscribe from the sequence before it completes.
T
- the type of items in the Array, and the type of items to be emitted by the
resulting Observablet1
- itemt2
- itemt3
- itemt4
- itemt5
- itemt6
- itemt7
- itemt8
- itemt9
- item
public static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8, T t9, T t10)
Implementation note: the entire array will be immediately emitted each time an Observer
subscribes. Since this occurs before the Subscription
is returned,
it in not possible to unsubscribe from the sequence before it completes.
T
- the type of items in the Array, and the type of items to be emitted by the
resulting Observablet1
- itemt2
- itemt3
- itemt4
- itemt5
- itemt6
- itemt7
- itemt8
- itemt10
- item
public static Observable<java.lang.Integer> range(int start, int count)
Implementation note: the entire range will be immediately emitted each time an Observer
subscribes. Since this occurs before the Subscription
is returned,
it in not possible to unsubscribe from the sequence before it completes.
start
- the value of the first integer in the sequencecount
- the number of sequential integers to generate
public static <T> Observable<T> defer(Func0<? extends Observable<? extends T>> observableFactory)
The defer operator 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.
T
- the type of the items emitted by the ObservableobservableFactory
- the Observable factory function to invoke for each Observer
that
subscribes to the resulting Observable
Observer
s trigger an invocation of the given Observable
factory functionpublic static <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 Observable.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.
T
- the type of that itemvalue
- the item to pass to the Observer
's onNext
method
public static <T> Observable<T> just(T value, Scheduler scheduler)
This is a scheduler version of Observable.just(Object)
.
T
- the type of that itemvalue
- the item to pass to the Observer
's onNext
methodscheduler
- the scheduler to send the single element on
public static <T> Observable<T> merge(Observable<? extends Observable<? extends T>> source)
You can combine the items emitted by multiple Observables so that they act like a single
Observable, by using the merge
method.
source
- an Observable that emits Observables
source
Observablepublic static <T> Observable<T> merge(Observable<? extends T> t1, Observable<? extends T> t2)
You can combine items emitted by multiple Observables so that they act like a single
Observable, by using the merge
method.
t1
- an Observable to be mergedt2
- an Observable to be merged
source
Observablespublic static <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 act like a single
Observable, by using the merge
method.
t1
- an Observable to be mergedt2
- an Observable to be mergedt3
- an Observable to be merged
source
Observablespublic static <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 act like a single
Observable, by using the merge
method.
t1
- an Observable to be mergedt2
- an Observable to be mergedt3
- an Observable to be mergedt4
- an Observable to be merged
source
Observablespublic static <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 act like a single
Observable, by using the merge
method.
t1
- an Observable to be mergedt2
- an Observable to be mergedt3
- an Observable to be mergedt4
- an Observable to be mergedt5
- an Observable to be merged
source
Observablespublic static <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 act like a single
Observable, by using the merge
method.
t1
- an Observable to be mergedt2
- an Observable to be mergedt3
- an Observable to be mergedt4
- an Observable to be mergedt5
- an Observable to be mergedt6
- an Observable to be merged
source
Observablespublic static <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 act like a single
Observable, by using the merge
method.
t1
- an Observable to be mergedt2
- an Observable to be mergedt3
- an Observable to be mergedt4
- an Observable to be mergedt5
- an Observable to be mergedt6
- an Observable to be mergedt7
- an Observable to be merged
source
Observablespublic static <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 act like a single
Observable, by using the merge
method.
t1
- an Observable to be mergedt2
- an Observable to be mergedt3
- an Observable to be mergedt4
- an Observable to be mergedt5
- an Observable to be mergedt6
- an Observable to be mergedt7
- an Observable to be mergedt8
- an Observable to be merged
source
Observablespublic static <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 act like a single
Observable, by using the merge
method.
t1
- an Observable to be mergedt2
- an Observable to be mergedt3
- an Observable to be mergedt4
- an Observable to be mergedt5
- an Observable to be mergedt6
- an Observable to be mergedt7
- an Observable to be mergedt8
- an Observable to be mergedt9
- an Observable to be merged
source
Observablespublic static <T> Observable<T> concat(Observable<? extends Observable<? extends T>> observables)
observables
- an Observable of Observables
source
Observables, one after the otherpublic static <T> Observable<T> concat(Observable<? extends T> t1, Observable<? extends T> t2)
t1
- an Observable to be concatenatedt2
- an Observable to be concatenated
an Observable to be concatenated
source
Observables, one after the otherpublic static <T> Observable<T> concat(Observable<? extends T> t1, Observable<? extends T> t2, Observable<? extends T> t3)
t1
- an Observable to be concatenatedt2
- an Observable to be concatenatedt3
- an Observable to be concatenated
an Observable to be concatenated
source
Observables, one after the otherpublic static <T> Observable<T> concat(Observable<? extends T> t1, Observable<? extends T> t2, Observable<? extends T> t3, Observable<? extends T> t4)
t1
- an Observable to be concatenatedt2
- an Observable to be concatenatedt3
- an Observable to be concatenatedt4
- an Observable to be concatenated
source
Observables, one after the otherpublic static <T> Observable<T> concat(Observable<? extends T> t1, Observable<? extends T> t2, Observable<? extends T> t3, Observable<? extends T> t4, Observable<? extends T> t5)
t1
- an Observable to be concatenatedt2
- an Observable to be concatenatedt3
- an Observable to be concatenatedt4
- an Observable to be concatenatedt5
- an Observable to be concatenated
source
Observables, one after the otherpublic static <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)
t1
- an Observable to be concatenatedt2
- an Observable to be concatenatedt3
- an Observable to be concatenatedt4
- an Observable to be concatenatedt5
- an Observable to be concatenatedt6
- an Observable to be concatenated
source
Observables, one after the otherpublic static <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)
t1
- an Observable to be concatenatedt2
- an Observable to be concatenatedt3
- an Observable to be concatenatedt4
- an Observable to be concatenatedt5
- an Observable to be concatenatedt6
- an Observable to be concatenatedt7
- an Observable to be concatenated
source
Observables, one after the otherpublic static <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)
t1
- an Observable to be concatenatedt2
- an Observable to be concatenatedt3
- an Observable to be concatenatedt4
- an Observable to be concatenatedt5
- an Observable to be concatenatedt6
- an Observable to be concatenatedt7
- an Observable to be concatenatedt8
- an Observable to be concatenated
source
Observables, one after the otherpublic static <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)
t1
- an Observable to be concatenatedt2
- an Observable to be concatenatedt3
- an Observable to be concatenatedt4
- an Observable to be concatenatedt5
- an Observable to be concatenatedt6
- an Observable to be concatenatedt7
- an Observable to be concatenatedt8
- an Observable to be concatenatedt9
- an Observable to be concatenated
source
Observables, one after the otherpublic static <T> Observable<T> mergeDelayError(Observable<? extends Observable<? extends T>> source)
Observable.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.
This method 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.
source
- an Observable that emits Observables
source
Observablepublic static <T> Observable<T> mergeDelayError(Observable<? extends T> t1, Observable<? extends T> t2)
Observable.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 multiple merged Observables send onError
notifications, mergeDelayError
will only invoke the onError
method of its
Observers once.
This method 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.
t1
- an Observable to be mergedt2
- an Observable to be merged
source
Observablespublic static <T> Observable<T> mergeDelayError(Observable<? extends T> t1, Observable<? extends T> t2, Observable<? extends T> t3)
Observable.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.
This method 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.
t1
- an Observable to be mergedt2
- an Observable to be mergedt3
- an Observable to be merged
source
Observablespublic static <T> Observable<T> mergeDelayError(Observable<? extends T> t1, Observable<? extends T> t2, Observable<? extends T> t3, Observable<? extends T> t4)
Observable.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.
This method 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.
t1
- an Observable to be mergedt2
- an Observable to be mergedt3
- an Observable to be mergedt4
- an Observable to be merged
source
Observablespublic static <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.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.
This method 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.
t1
- an Observable to be mergedt2
- an Observable to be mergedt3
- an Observable to be mergedt4
- an Observable to be mergedt5
- an Observable to be merged
source
Observablespublic static <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.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.
This method 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.
t1
- an Observable to be mergedt2
- an Observable to be mergedt3
- an Observable to be mergedt4
- an Observable to be mergedt5
- an Observable to be mergedt6
- an Observable to be merged
source
Observablespublic static <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.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.
This method 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.
t1
- an Observable to be mergedt2
- an Observable to be mergedt3
- an Observable to be mergedt4
- an Observable to be mergedt5
- an Observable to be mergedt6
- an Observable to be mergedt7
- an Observable to be merged
source
Observablespublic static <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.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.
This method 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.
t1
- an Observable to be mergedt2
- an Observable to be mergedt3
- an Observable to be mergedt4
- an Observable to be mergedt5
- an Observable to be mergedt6
- an Observable to be mergedt7
- an Observable to be mergedt8
- an Observable to be merged
source
Observablespublic static <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)
Observable.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.
This method 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.
t1
- an Observable to be mergedt2
- an Observable to be mergedt3
- an Observable to be mergedt4
- an Observable to be mergedt5
- an Observable to be mergedt6
- an Observable to be mergedt7
- an Observable to be mergedt8
- an Observable to be mergedt9
- an Observable to be merged
source
Observablespublic static <T> Observable<T> never()
Observer
.
This Observable is useful primarily for testing purposes.
T
- the type of items (not) emitted by the Observable
Observer
@Deprecated public static <T> Observable<T> switchDo(Observable<? extends Observable<? extends T>> sequenceOfSequences)
Observable.switchOnNext(rx.Observable extends rx.Observable extends T>>)
sequenceOfSequences
- the source Observable that emits Observables
public static <T> Observable<T> switchOnNext(Observable<? extends Observable<? extends T>> sequenceOfSequences)
sequenceOfSequences
- the source Observable that emits Observables
public Observable<T> synchronize()
A well-behaved Observable does not interleave its invocations of the onNext
, onCompleted
, and onError
methods of
its Observer
s; it invokes onCompleted
or onError
only once; and it never invokes onNext
after invoking either onCompleted
or onError
.
synchronize
enforces this, and the Observable it returns invokes onNext
and onCompleted
or onError
synchronously.
Observer
spublic Observable<T> synchronize(java.lang.Object lock)
A well-behaved Observable does not interleave its invocations of the onNext
, onCompleted
, and onError
methods of
its Observer
s; it invokes onCompleted
or onError
only once; and it never invokes onNext
after invoking either onCompleted
or onError
.
synchronize
enforces this, and the Observable it returns invokes onNext
and onCompleted
or onError
synchronously.
lock
- The lock object to synchronize each observer call on
Observer
s@Deprecated public static <T> Observable<T> synchronize(Observable<T> source)
public static Observable<java.lang.Long> interval(long interval, java.util.concurrent.TimeUnit unit)
interval
- Interval size in time units (see below).unit
- Time units to use for the interval size.
public static Observable<java.lang.Long> interval(long interval, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
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 Observable<T> debounce(long timeout, java.util.concurrent.TimeUnit unit)
NOTE: If events keep firing faster than the timeout then no data will be emitted.
Information on debounce vs throttle:
timeout
- The time each value has to be 'the most recent' of the Observable
to ensure that it's not dropped.unit
- The TimeUnit
for the timeout.
Observable
which filters out values which are too quickly followed up with newer values.Observable.throttleWithTimeout(long, TimeUnit)
public Observable<T> debounce(long timeout, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
NOTE: If events keep firing faster than the timeout then no data will be emitted.
Information on debounce vs throttle:
timeout
- The time each value has to be 'the most recent' of the 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 which handle timeout for each event.
Observable.throttleWithTimeout(long, TimeUnit, Scheduler)
public Observable<T> throttleWithTimeout(long timeout, java.util.concurrent.TimeUnit unit)
NOTE: If events keep firing faster than the timeout then no data will be emitted.
Information on debounce vs throttle:
timeout
- The time each value has to be 'the most recent' of the Observable
to ensure that it's not dropped.unit
- The TimeUnit
for the timeout.
Observable
which filters out values which are too quickly followed up with newer values.Observable.debounce(long, TimeUnit)
public Observable<T> throttleWithTimeout(long timeout, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
NOTE: If events keep firing faster than the timeout then no data will be emitted.
timeout
- The time each value has to be 'the most recent' of the 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 which handle timeout for each event.
Observable.debounce(long, TimeUnit, Scheduler)
public Observable<T> throttleFirst(long windowDuration, java.util.concurrent.TimeUnit unit)
This differs from Observable.throttleLast(long, java.util.concurrent.TimeUnit)
in that this only tracks passage of time whereas Observable.throttleLast(long, java.util.concurrent.TimeUnit)
ticks at scheduled intervals.
windowDuration
- Time to wait before sending another value after emitting last value.unit
- The unit of time for the specified timeout.
public Observable<T> throttleFirst(long skipDuration, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
This differs from Observable.throttleLast(long, java.util.concurrent.TimeUnit)
in that this only tracks passage of time whereas Observable.throttleLast(long, java.util.concurrent.TimeUnit)
ticks at scheduled intervals.
skipDuration
- Time to wait before sending another value after emitting last value.unit
- The unit of time for the specified timeout.scheduler
- The Scheduler
to use internally to manage the timers which handle timeout for each event.
public Observable<T> throttleLast(long intervalDuration, java.util.concurrent.TimeUnit unit)
This differs from Observable.throttleFirst(long, java.util.concurrent.TimeUnit)
in that this ticks along at a scheduled interval whereas Observable.throttleFirst(long, java.util.concurrent.TimeUnit)
does not tick, it just tracks passage of time.
intervalDuration
- Duration of windows within with the last value will be chosen.unit
- The unit of time for the specified interval.
Observable.sample(long, TimeUnit)
public Observable<T> throttleLast(long intervalDuration, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
This differs from Observable.throttleFirst(long, java.util.concurrent.TimeUnit)
in that this ticks along at a scheduled interval whereas Observable.throttleFirst(long, java.util.concurrent.TimeUnit)
does not tick, it just tracks passage of time.
intervalDuration
- Duration of windows within with the last value will be chosen.unit
- The unit of time for the specified interval.
Observable.sample(long, TimeUnit, Scheduler)
public Observable<Timestamped<T>> timestamp()
Timestamped
object.
public static <T> Observable<T> from(java.util.concurrent.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.get()
method of that object, by passing the
object into the from
method.
Important note: This Observable is blocking; you cannot unsubscribe from it.
T
- the type of object that the Future
returns, and also the type of item to
be emitted by the resulting Observablefuture
- the source Future
public static <T> Observable<T> from(java.util.concurrent.Future<? extends T> future, Scheduler scheduler)
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.get()
method of that object, by passing the
object into the from
method.
T
- the type of object that the Future
returns, and also the type of item to
be emitted by the resulting Observablefuture
- the source Future
scheduler
- the Scheduler
to wait for the Future on. Use a Scheduler such as Schedulers.threadPoolForIO()
that can block and wait on the future.
public static <T> Observable<T> from(java.util.concurrent.Future<? extends T> future, long timeout, java.util.concurrent.TimeUnit unit)
Future
into an Observable with timeout.
You can convert any object that supports the Future
interface into an Observable that
emits the return value of the {link Future#get} method of that object, by passing the
object into the from
method.
Important note: This Observable is blocking; you cannot unsubscribe from it.
T
- the type of object that the Future
returns, and also the type of item to
be emitted by the resulting Observablefuture
- the source Future
timeout
- the maximum time to wait before calling get()
unit
- the TimeUnit
of the time argument
Future
public static <T> Observable<java.lang.Boolean> sequenceEqual(Observable<? extends T> first, Observable<? extends T> second)
T
- the type of items emitted by each Observablefirst
- one Observable to comparesecond
- the second Observable to compare
public static <T> Observable<java.lang.Boolean> sequenceEqual(Observable<? extends T> first, Observable<? extends T> second, Func2<? super T,? super T,java.lang.Boolean> equality)
T
- the type of items emitted by each Observablefirst
- one Observable to comparesecond
- the second Observable to compareequality
- a function used to compare items emitted by both Observables
public static <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 w0
and the first item emitted by w1
; the second item emitted by
the new Observable will be the result of the function applied to the second item emitted by w0
and the second item emitted by w1
; 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.
o1
- one source Observableo2
- another source ObservablezipFunction
- 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 <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 w0
, the first item emitted by w1
, and the first item emitted by w2
; the second
item emitted by the new Observable will be the result of the
function applied to the second item emitted by w0
, the second item emitted by w1
, and the second item emitted by w2
; 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.
o1
- one source Observableo2
- a second source Observableo3
- a third source ObservablezipFunction
- 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 <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 w0
, the first item emitted by w1
, the first item emitted by w2
, and the first item
emitted by w3
; 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.
o1
- one source Observableo2
- a second source Observableo3
- a third source Observableo4
- a fourth source ObservablezipFunction
- 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 <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 w0
, the first item emitted by w1
, the first item emitted by w2
, and the first item
emitted by w3
; 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.
o1
- one source Observableo2
- a second source Observableo3
- a third source Observableo4
- a fourth source Observableo5
- a fifth source ObservablezipFunction
- 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 <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 w0
, the first item emitted by w1
, the first item emitted by w2
, and the first item
emitted by w3
; 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.
o1
- one source Observableo2
- a second source Observableo3
- a third source Observableo4
- a fourth source Observableo5
- a fifth source Observableo6
- a sixth source ObservablezipFunction
- 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 <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 w0
, the first item emitted by w1
, the first item emitted by w2
, and the first item
emitted by w3
; 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.
o1
- one source Observableo2
- a second source Observableo3
- a third source Observableo4
- a fourth source Observableo5
- a fifth source Observableo6
- a sixth source Observableo7
- a seventh source ObservablezipFunction
- 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 <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 w0
, the first item emitted by w1
, the first item emitted by w2
, and the first item
emitted by w3
; 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.
o1
- one source Observableo2
- a second source Observableo3
- a third source Observableo4
- a fourth source Observableo5
- a fifth source Observableo6
- a sixth source Observableo7
- a seventh source Observableo8
- an eighth source ObservablezipFunction
- 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 <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 w0
, the first item emitted by w1
, the first item emitted by w2
, and the first item
emitted by w3
; 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.
o1
- one source Observableo2
- a second source Observableo3
- a third source Observableo4
- a fourth source Observableo5
- a fifth source Observableo6
- a sixth source Observableo7
- a seventh source Observableo8
- an eighth source Observableo9
- a ninth source ObservablezipFunction
- 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 <T1,T2,R> Observable<R> combineLatest(Observable<? extends T1> o1, Observable<? extends T2> o2, Func2<? super T1,? super T2,? extends R> combineFunction)
o1
- The first source observable.o2
- The second source observable.combineFunction
- The aggregation function used to combine the source observable values.
public static <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)
Observable.combineLatest(Observable, Observable, Func2)
public static <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)
Observable.combineLatest(Observable, Observable, Func2)
public static <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)
Observable.combineLatest(Observable, Observable, Func2)
public static <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)
Observable.combineLatest(Observable, Observable, Func2)
public static <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)
Observable.combineLatest(Observable, Observable, Func2)
public static <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)
Observable.combineLatest(Observable, Observable, Func2)
public static <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)
Observable.combineLatest(Observable, Observable, Func2)
public Observable<java.util.List<T>> buffer(Func0<? extends Observable<? extends Closing>> bufferClosingSelector)
This Observable produces connected non-overlapping buffers. The current buffer is
emitted and replaced with a new buffer when the Observable produced by the specified Func0
produces a Closing
object. The * Func0
will then
be used to create a new Observable to listen for the end of the next buffer.
bufferClosingSelector
- The Func0
which is used to produce an Observable
for every buffer created.
When this Observable
produces a Closing
object, the associated buffer
is emitted and replaced with a new one.
Observable
which produces connected non-overlapping buffers, which are emitted
when the current Observable
created with the Func0
argument produces a Closing
object.public Observable<java.util.List<T>> buffer(Observable<? extends Opening> bufferOpenings, Func1<Opening,? extends Observable<? extends Closing>> bufferClosingSelector)
This Observable produces buffers. Buffers are created when the specified "bufferOpenings"
Observable produces a Opening
object. Additionally the Func0
argument
is used to create an Observable which produces Closing
objects. When this
Observable produces such an object, the associated buffer is emitted.
bufferOpenings
- The Observable
which, when it produces a Opening
object, will cause
another buffer to be created.bufferClosingSelector
- The Func0
which is used to produce an Observable
for every buffer created.
When this Observable
produces a Closing
object, the associated buffer
is emitted.
Observable
which produces buffers which are created and emitted when the specified Observable
s publish certain objects.public Observable<java.util.List<T>> buffer(int count)
This Observable produces connected non-overlapping buffers, each containing "count" elements. When the source Observable completes or encounters an error, the current buffer is emitted, and the event is propagated.
count
- The maximum size of each buffer before it should be emitted.
Observable
which produces connected non-overlapping buffers containing at most
"count" produced values.public Observable<java.util.List<T>> buffer(int count, int skip)
This Observable produces buffers every "skip" values, each containing "count" elements. When the source Observable completes or encounters an error, the current buffer is emitted, and the event is propagated.
count
- The maximum size of each buffer before it should be emitted.skip
- How many produced values need to be skipped before starting a new buffer. Note that when "skip" and
"count" are equals that this is the same operation as Observable.buffer(int)
.
Observable
which produces buffers every "skipped" values containing at most
"count" produced values.public Observable<java.util.List<T>> buffer(long timespan, java.util.concurrent.TimeUnit unit)
This Observable produces connected non-overlapping buffers, each of a fixed duration specified by the "timespan" argument. When the source Observable completes or encounters an error, the current buffer is emitted and the event is propagated.
timespan
- The period of time each buffer is collecting values before it should be emitted, and
replaced with a new buffer.unit
- The unit of time which applies to the "timespan" argument.
Observable
which produces connected non-overlapping buffers with a fixed duration.public Observable<java.util.List<T>> buffer(long timespan, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
This Observable produces connected non-overlapping buffers, each of a fixed duration specified by the "timespan" argument. When the source Observable completes or encounters an error, the current buffer is emitted and the event is propagated.
timespan
- The period of time each buffer is collecting values before it should be 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.
Observable
which produces connected non-overlapping buffers with a fixed duration.public Observable<java.util.List<T>> buffer(long timespan, java.util.concurrent.TimeUnit unit, int count)
timespan
- The period of time each buffer is collecting values before it should be 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 should be emitted.
Observable
which produces connected non-overlapping buffers which are emitted after
a fixed duration or when the buffer has reached maximum capacity (which ever occurs first).public Observable<java.util.List<T>> buffer(long timespan, java.util.concurrent.TimeUnit unit, int count, Scheduler scheduler)
timespan
- The period of time each buffer is collecting values before it should be 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 should be emitted.scheduler
- The Scheduler
to use when determining the end and start of a buffer.
Observable
which produces connected non-overlapping buffers which are emitted after
a fixed duration or when the buffer has reached maximum capacity (which ever occurs first).public Observable<java.util.List<T>> buffer(long timespan, long timeshift, java.util.concurrent.TimeUnit unit)
timespan
- The period of time each buffer is collecting values before it should be emitted.timeshift
- The period of time after which a new buffer will be created.unit
- The unit of time which applies to the "timespan" and "timeshift" argument.
Observable
which produces new buffers periodically, and these are emitted after
a fixed timespan has elapsed.public Observable<java.util.List<T>> buffer(long timespan, long timeshift, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
timespan
- The period of time each buffer is collecting values before it should be emitted.timeshift
- The period of time after which a new buffer will be created.unit
- The unit of time which applies to the "timespan" and "timeshift" argument.scheduler
- The Scheduler
to use when determining the end and start of a buffer.
Observable
which produces new buffers periodically, and these are emitted after
a fixed timespan has elapsed.public Observable<Observable<T>> window(Func0<? extends Observable<? extends Closing>> closingSelector)
Func0
produces a Closing
object. The Func0
will then be used to create a new Observable to listen for the end of the next
window.
closingSelector
- The Func0
which is used to produce an Observable
for every window created.
When this Observable
produces a Closing
object, the associated window
is emitted and replaced with a new one.
Observable
which produces connected non-overlapping windows, which are emitted
when the current Observable
created with the Func0
argument produces a Closing
object.public Observable<Observable<T>> window(Observable<? extends Opening> windowOpenings, Func1<Opening,? extends Observable<? extends Closing>> closingSelector)
Opening
object.
Additionally the Func0
argument is used to create an Observable which produces Closing
objects. When this Observable produces such an object, the associated window is
emitted.
windowOpenings
- The Observable
which when it produces a Opening
object, will cause
another window to be created.closingSelector
- The Func0
which is used to produce an Observable
for every window created.
When this Observable
produces a Closing
object, the associated window
is emitted.
Observable
which produces windows which are created and emitted when the specified Observable
s publish certain objects.public Observable<Observable<T>> window(int count)
count
- The maximum size of each window before it should be emitted.
Observable
which produces connected non-overlapping windows containing at most
"count" produced values.public Observable<Observable<T>> window(int count, int skip)
count
- The maximum size of each window before it should be emitted.skip
- How many produced values need to be skipped before starting a new window. Note that when "skip" and
"count" are equals that this is the same operation as Observable.window(int)
.
Observable
which produces windows every "skipped" values containing at most
"count" produced values.public Observable<Observable<T>> window(long timespan, java.util.concurrent.TimeUnit unit)
timespan
- The period of time each window is collecting values before it should be emitted, and
replaced with a new window.unit
- The unit of time which applies to the "timespan" argument.
Observable
which produces connected non-overlapping windows with a fixed duration.public Observable<Observable<T>> window(long timespan, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
timespan
- The period of time each window is collecting values 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.
Observable
which produces connected non-overlapping windows with a fixed duration.public Observable<Observable<T>> window(long timespan, java.util.concurrent.TimeUnit unit, int count)
timespan
- The period of time each window is collecting values 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.
Observable
which produces connected non-overlapping windows which are emitted after
a fixed duration or when the window has reached maximum capacity (which ever occurs first).public Observable<Observable<T>> window(long timespan, java.util.concurrent.TimeUnit unit, int count, Scheduler scheduler)
timespan
- The period of time each window is collecting values 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.
Observable
which produces connected non-overlapping windows which are emitted after
a fixed duration or when the window has reached maximum capacity (which ever occurs first).public Observable<Observable<T>> window(long timespan, long timeshift, java.util.concurrent.TimeUnit unit)
timespan
- The period of time each window is collecting values before it should be emitted.timeshift
- The period of time after which a new window will be created.unit
- The unit of time which applies to the "timespan" and "timeshift" argument.
Observable
which produces new windows periodically, and these are emitted after
a fixed timespan has elapsed.public Observable<Observable<T>> window(long timespan, long timeshift, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
timespan
- The period of time each window is collecting values before it should be emitted.timeshift
- The period of time after which a new window will be created.unit
- The unit of time which applies to the "timespan" and "timeshift" argument.scheduler
- The Scheduler
to use when determining the end and start of a window.
Observable
which produces new windows periodically, and these are emitted after
a fixed timespan has elapsed.public static <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
all of the Observalbes; 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.
ws
- An Observable of source ObservableszipFunction
- 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 <R> Observable<R> zip(java.lang.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
all of the Observalbes; 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.
ws
- A collection of source ObservableszipFunction
- 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 Observable<T> filter(Func1<? super T,java.lang.Boolean> predicate)
predicate
- a function that evaluates the items emitted by the source Observable, returning true
if they pass the filter
true
public Observable<T> distinctUntilChanged()
public <U> Observable<T> distinctUntilChanged(Func1<? super T,? extends U> keySelector)
keySelector
- a function that projects an emitted item to a key value which is used for deciding whether an item is sequentially
distinct from another one or not
public Observable<T> distinct()
public <U> Observable<T> distinct(Func1<? super T,? extends U> keySelector)
keySelector
- a function that projects an emitted item to a key value which is used for deciding whether an item is
distinct from another one or not
public Observable<T> elementAt(int index)
index
- The zero-based index of the element to retrieve.
java.lang.IndexOutOfBoundsException
- Index is greater than or equal to the number of elements in the source sequence.
java.lang.IndexOutOfBoundsException
- Index is less than 0.public Observable<T> elementAtOrDefault(int index, T defaultValue)
index
- The zero-based index of the element to retrieve.defaultValue
- The default value.
java.lang.IndexOutOfBoundsException
- Index is less than 0.public Observable<java.lang.Boolean> exists(Func1<? super T,java.lang.Boolean> predicate)
Observable
that emits true
if any element of the source Observable
satisfies
the given condition, otherwise false
. Note: always emit false
if the source Observable
is empty.
In Rx.Net this is the any
operator but renamed in RxJava to better match Java naming idioms.
predicate
- The condition to test every element.
public Observable<java.lang.Boolean> contains(T element)
element
- The element to search in the sequence.
public Observable<T> finallyDo(Action0 action)
Action0
to be called when this Observable invokes onCompleted
or onError
.
action
- an Action0
to be invoked when the source Observable finishes
Action0
public <R> Observable<R> flatMap(Func1<? super T,? extends Observable<? extends R>> func)
Note: mapMany
and flatMap
are equivalent.
func
- a function that, when applied to an item emitted by the source Observable, returns
an Observable
Observable.mapMany(Func1)
public Observable<T> where(Func1<? super T,java.lang.Boolean> predicate)
predicate
- a function that evaluates an item emitted by the source Observable, returning true
if it
passes the filter
true
Observable.filter(Func1)
public <R> Observable<R> map(Func1<? super T,? extends R> func)
func
- a function to apply to each item emitted by the Observable
public <R> Observable<R> mapWithIndex(Func2<? super T,java.lang.Integer,? extends R> func)
func
- a function to apply to each item emitted by the Observable. The function takes the
index of the emitted item as additional parameter.
public <R> Observable<R> mapMany(Func1<? super T,? extends Observable<? extends R>> func)
Note: mapMany
and flatMap
are equivalent.
func
- a function that, when applied to an item emitted by the source Observable, returns
an Observable
Observable.flatMap(Func1)
public Observable<Notification<T>> materialize()
onNext
emissions, and marks them with their original notification types within Notification
objects.
public Observable<T> subscribeOn(Scheduler scheduler)
Scheduler
.
scheduler
- the Scheduler
to perform subscription and unsubscription actions on
Scheduler
public Observable<T> observeOn(Scheduler scheduler)
Observer
s on the specified Scheduler
.
scheduler
- the Scheduler
to notify Observer
s on
Observer
s are notified on the
specified Scheduler
public <T2> Observable<T2> dematerialize()
materialize
by
transforming the Notification
objects emitted by the source Observable into the items
or notifications they represent.
Notification
objects emitted by the source Observable
java.lang.Throwable
- if the source Observable is not of type Observable<Notification<T>>
.public Observable<T> onErrorResumeNext(Func1<java.lang.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.
resumeFunction
- a function that returns an Observable that will take over if the source Observable
encounters an error
public 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.
resumeSequence
- a function that returns an Observable that will take over if the source Observable
encounters an error
public Observable<T> onExceptionResumeNext(Observable<? extends T> resumeSequence)
onError
if it encounters an error of type Exception
.
This differs from Observable.onErrorResumeNext(rx.util.functions.Func1
in that this one does not handle Throwable
or Error
but lets those continue through.
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.
resumeSequence
- a function that returns an Observable that will take over if the source Observable
encounters an error
public Observable<T> onErrorReturn(Func1<java.lang.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 pass the return value of
resumeFunction
to the Observer's onNext
method.
You can use this to prevent errors from propagating or to supply fallback data should errors be encountered.
resumeFunction
- a function that returns an item that the new Observable will emit if the source
Observable encounters an error
public Observable<T> reduce(Func2<T,T,T> accumulator)
This technique, which is called "reduce" or "aggregate" here, is sometimes called "fold,"
"accumulate," "compress," or "inject" in other programming contexts. Groovy, for instance,
has an inject
method that does a similar operation on lists.
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
java.lang.IllegalArgumentException
- if Observable sequence is empty.public Observable<java.lang.Integer> count()
public static Observable<java.lang.Integer> sum(Observable<java.lang.Integer> source)
source
- Source observable to compute the sum of.
public static Observable<java.lang.Long> sumLongs(Observable<java.lang.Long> source)
Observable.sum(Observable)
,
MSDN: Observable.Sumpublic static Observable<java.lang.Float> sumFloats(Observable<java.lang.Float> source)
Observable.sum(Observable)
,
MSDN: Observable.Sumpublic static Observable<java.lang.Double> sumDoubles(Observable<java.lang.Double> source)
Observable.sum(Observable)
,
MSDN: Observable.Sumpublic static Observable<java.lang.Integer> average(Observable<java.lang.Integer> source)
source
- Source observable to compute the average of.
java.lang.IllegalArgumentException
- if Observable sequence is empty.public static Observable<java.lang.Long> averageLongs(Observable<java.lang.Long> source)
Observable.average(Observable)
,
MSDN: Observable.Averagepublic static Observable<java.lang.Float> averageFloats(Observable<java.lang.Float> source)
Observable.average(Observable)
,
MSDN: Observable.Averagepublic static Observable<java.lang.Double> averageDoubles(Observable<java.lang.Double> source)
Observable.average(Observable)
,
MSDN: Observable.Averagepublic static <T extends java.lang.Comparable<T>> Observable<T> min(Observable<T> source)
IllegalArgumentException
.
source
- an observable sequence to determine the minimum element of.
java.lang.IllegalArgumentException
- if the source is emptypublic Observable<T> min(java.util.Comparator<T> comparator)
IllegalArgumentException
.
comparator
- the comparer used to compare elements.
java.lang.IllegalArgumentException
- if the source is emptypublic <R extends java.lang.Comparable<R>> Observable<java.util.List<T>> minBy(Func1<T,R> selector)
selector
- the key selector function.
public <R> Observable<java.util.List<T>> minBy(Func1<T,R> selector, java.util.Comparator<R> comparator)
selector
- the key selector function.comparator
- the comparator used to compare key values.
public static <T extends java.lang.Comparable<T>> Observable<T> max(Observable<T> source)
IllegalArgumentException
.
source
- an observable sequence to determine the maximum element of.
java.lang.IllegalArgumentException
- if the source is empty.public Observable<T> max(java.util.Comparator<T> comparator)
IllegalArgumentException
.
comparator
- the comparer used to compare elements.
java.lang.IllegalArgumentException
- if the source is empty.public <R extends java.lang.Comparable<R>> Observable<java.util.List<T>> maxBy(Func1<T,R> selector)
selector
- the key selector function.
public <R> Observable<java.util.List<T>> maxBy(Func1<T,R> selector, java.util.Comparator<R> comparator)
selector
- the key selector function.comparator
- the comparator used to compare key values.
public 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
.
ConnectableObservable
that upon connection causes the source Observable to
emit items to its Observer
spublic Observable<T> retry(int retryCount)
If Observer.onError(java.lang.Throwable)
is invoked the source Observable will be re-subscribed to as many times as defined by retryCount.
Any Observer.onNext(T)
calls received on each attempt will be emitted and concatenated together.
For example, if an Observable fails on first time but emits [1, 2] then succeeds the second time and emits [1, 2, 3, 4, 5] then the complete output would be [1, 2, 1, 2, 3, 4, 5, onCompleted].
retryCount
- Number of retry attempts before failing.
public Observable<T> retry()
If Observer.onError(java.lang.Throwable)
is invoked the source Observable will be re-subscribed to.
Any Observer.onNext(T)
calls received on each attempt will be emitted and concatenated together.
For example, if an Observable fails on first time but emits [1, 2] then succeeds the second time and emits [1, 2, 3, 4, 5] then the complete output would be [1, 2, 1, 2, 3, 4, 5, onCompleted].
public Observable<T> cache()
Observable.replay()
except that this auto-subscribes to
the source Observable rather than returning a ConnectableObservable
.
This is useful when you want an Observable to cache responses and you can't control the
subscribe/unsubscribe behavior of all the Observer
s.
NOTE: You sacrifice the ability to unsubscribe from the origin when you use the
cache()
operator so be careful not to use this operator on Observables that
emit an infinite or very large number of items that will use up memory.
public <R> Observable<R> parallel(Func1<Observable<T>,Observable<R>> f)
Observable<T>
on a Schedulers.threadPoolForComputation()
Scheduler
and return an Observable<R>
with the output.
f
- a Func1
that applies Observable operators to Observable<T>
in parallel and returns an Observable<R>
Func1
executed on a Scheduler
public <R> Observable<R> parallel(Func1<Observable<T>,Observable<R>> f, Scheduler s)
Observable<T>
on a Scheduler
and return an Observable<R>
with the output.
f
- a Func1
that applies Observable operators to Observable<T>
in parallel and returns an Observable<R>
s
- a Scheduler
to perform the work on.
Func1
executed on a Scheduler
public ConnectableObservable<T> publish()
ConnectableObservable
, which waits until its connect
method is called before it begins emitting
items to those Observer
s that have subscribed to it.
ConnectableObservable
that upon connection causes the source Observable to
emit items to its Observer
spublic ConnectableObservable<T> publishLast()
ConnectableObservable
that shares a single subscription that contains the last notification only.
ConnectableObservable
public Observable<T> aggregate(Func2<T,T,T> accumulator)
reduce()
.
Observable.reduce(Func2)
public <R> Observable<R> reduce(R initialValue, Func2<R,? super T,R> accumulator)
This technique, which is called "reduce" or "aggregate" here, is sometimes called "fold,"
"accumulate," "compress," or "inject" in other programming contexts. Groovy, for instance,
has an inject
method that does a similar operation on lists.
initialValue
- the initial (seed) accumulator valueaccumulator
- 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 <R> Observable<R> aggregate(R initialValue, Func2<R,? super T,R> accumulator)
reduce()
.
Observable.reduce(Object, Func2)
public Observable<T> scan(Func2<T,T,T> accumulator)
This sort of function is sometimes called an accumulator.
Note that when you pass a seed to scan()
the resulting Observable will emit
that seed as its first emitted item.
accumulator
- an accumulator function to be invoked on each item emitted by the source
Observable, whose result will be emitted to Observer
s via onNext
and used in the next accumulator call.
public Observable<T> sample(long period, java.util.concurrent.TimeUnit unit)
period
- the sampling rateunit
- the TimeUnit
in which period
is defined
public Observable<T> sample(long period, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
period
- the sampling rateunit
- the TimeUnit
in which period
is definedscheduler
- the Scheduler
to use when sampling
public <R> Observable<R> scan(R initialValue, Func2<R,? super T,R> accumulator)
This sort of function is sometimes called an accumulator.
Note that when you pass a seed to scan()
the resulting Observable will emit
that seed as its first emitted item.
initialValue
- the initial (seed) accumulator valueaccumulator
- an accumulator function to be invoked on each item emitted by the source
Observable, whose result will be emitted to Observer
s via onNext
and used in the next accumulator call.
public Observable<java.lang.Boolean> all(Func1<? super T,java.lang.Boolean> predicate)
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 Observable<T> skip(int num)
num
items emitted by the source
Observable and emits the remainder.
You can ignore the first num
items emitted by an Observable and attend only to
those items that come after, by modifying the Observable with the skip
method.
num
- the number of items to skip
num
items that the source emitspublic Observable<T> first()
public Observable<T> first(Func1<? super T,java.lang.Boolean> predicate)
predicate
- The condition any source emitted item has to satisfy.
public Observable<T> firstOrDefault(T defaultValue)
defaultValue
- The default value to emit if the source Observable doesn't emit anything.
public Observable<T> firstOrDefault(Func1<? super T,java.lang.Boolean> predicate, T defaultValue)
predicate
- The condition any source emitted item has to satisfy.defaultValue
- The default value to emit if the source Observable doesn't emit anything that
satisfies the given condition.
public Observable<T> defaultIfEmpty(T defaultValue)
defaultValue
- The value to return if the sequence is empty.
public 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
.
num
- the number of items to take
num
items from the source
Observable, or all of the items from the source Observable if that Observable emits
fewer than num
itemspublic Observable<T> takeWhile(Func1<? super T,java.lang.Boolean> predicate)
predicate
- a function that evaluates an item emitted by the source Observable and returns a
Boolean
predicate
public Observable<T> takeWhileWithIndex(Func2<? super T,? super java.lang.Integer,java.lang.Boolean> predicate)
predicate
- a function to test each item emitted by the source Observable for a condition;
the second parameter of the function represents the index of the source item
true
for each item, then completespublic Observable<T> takeFirst()
Observable.first()
public Observable<T> takeFirst(Func1<? super T,java.lang.Boolean> predicate)
predicate
- The condition any source emitted item has to satisfy.
Observable.first(Func1)
public Observable<T> takeLast(int count)
count
items emitted by the source
Observable.
count
- the number of items to emit from the end of the sequence emitted by the source
Observable
count
items emitted by the source
Observablepublic <E> Observable<T> takeUntil(Observable<? extends E> other)
other
Observable emits an item.
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 itempublic Observable<T> skipWhileWithIndex(Func2<? super T,java.lang.Integer,java.lang.Boolean> predicate)
predicate
- A function to test each item emitted from the source Observable for a condition.
It receives the emitted item as first parameter and the index of the emitted item as
second parameter.
public Observable<T> skipWhile(Func1<? super T,java.lang.Boolean> predicate)
predicate
- A function to test each item emitted from the source Observable for a condition.
public Observable<T> skipLast(int count)
This operator accumulates a queue with a length enough to store the first count elements. As more elements are received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
count
- number of elements to bypass at the end of the source
sequence.
java.lang.IndexOutOfBoundsException
- count is less than zero.public Observable<java.util.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 Observable.subscribe(rx.Observer super T>)
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.
public Observable<java.util.List<T>> toSortedList()
Comparable
with respect to
all other items in the sequence).
java.lang.ClassCastException
- if any item emitted by the Observable does not implement Comparable
with
respect to all other items emitted by the Observablepublic Observable<java.util.List<T>> toSortedList(Func2<? super T,? super T,java.lang.Integer> sortFunction)
sortFunction
- a function that compares two items emitted by the source Observable and returns
an Integer that indicates their sort order
public Observable<T> startWith(java.lang.Iterable<T> values)
values
- Iterable of the items you want the modified Observable to emit first
public Observable<T> startWith(T t1)
t1
- item to include
public Observable<T> startWith(T t1, T t2)
t1
- item to includet2
- item to include
public Observable<T> startWith(T t1, T t2, T t3)
t1
- item to includet2
- item to includet3
- item to include
public Observable<T> startWith(T t1, T t2, T t3, T t4)
t1
- item to includet2
- item to includet3
- item to includet4
- item to include
public Observable<T> startWith(T t1, T t2, T t3, T t4, T t5)
t1
- item to includet2
- item to includet3
- item to includet4
- item to includet5
- item to include
public Observable<T> startWith(T t1, T t2, T t3, T t4, T t5, T t6)
t1
- item to includet2
- item to includet3
- item to includet4
- item to includet5
- item to includet6
- item to include
public Observable<T> startWith(T t1, T t2, T t3, T t4, T t5, T t6, T t7)
t1
- item to includet2
- item to includet3
- item to includet4
- item to includet5
- item to includet6
- item to includet7
- item to include
public Observable<T> startWith(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8)
t1
- item to includet2
- item to includet3
- item to includet4
- item to includet5
- item to includet6
- item to includet7
- item to includet8
- item to include
public Observable<T> startWith(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T t8, T t9)
t1
- item to includet2
- item to includet3
- item to includet4
- item to includet5
- item to includet6
- item to includet7
- item to includet8
- item to includet9
- item to include
public <K,R> Observable<GroupedObservable<K,R>> groupBy(Func1<? super T,? extends K> keySelector, Func1<? super T,? extends R> elementSelector)
GroupedObservable
s, one GroupedObservable per group.
K
- the key typeR
- the type of items emitted by the resulting GroupedObservable
skeySelector
- a function that extracts the key from an itemelementSelector
- a function to map a source item to an item in a GroupedObservable
GroupedObservable
s, each of which corresponds to a
unique key value and emits items representing items from the source Observable that
share that key valuepublic <K> Observable<GroupedObservable<K,T>> groupBy(Func1<? super T,? extends K> keySelector)
GroupedObservable
s, one GroupedObservable per group.
K
- the key typekeySelector
- a function that extracts the key for each item
GroupedObservable
s, each of which corresponds to a
unique key value and emits items representing items from the source Observable that
share that key valuepublic Observable<java.lang.Boolean> isEmpty()
Observable
that emits true
if the source Observable
is empty, otherwise false
.
In Rx.Net this is negated as the any
operator but renamed in RxJava to better match Java naming idioms.
public Observable<T> last()
Observable
that emits the last element of the source or an IllegalArgumentException
if the source Observable
is empty.
public BlockingObservable<T> toBlockingObservable()
BlockingObservable
(an Observable with blocking
operators).
public <R> Observable<R> cast(java.lang.Class<R> klass)
klass
- The target class type which the elements will be converted to.
public <R> Observable<R> ofType(java.lang.Class<R> klass)
klass
- The class type to filter the elements in the source sequence
on.
public Observable<T> ignoreElements()
public Observable<T> timeout(long timeout, java.util.concurrent.TimeUnit timeUnit)
timeout
- Maximum duration between values before a timeout occurs.timeUnit
- The unit of time which applies to the "timeout" argument.
public Observable<T> timeout(long timeout, java.util.concurrent.TimeUnit timeUnit, Observable<? extends T> other)
timeout
- Maximum duration between values before a timeout occurs.timeUnit
- The unit of time which applies to the "timeout" argument.other
- Sequence to return in case of a timeout.
public Observable<T> timeout(long timeout, java.util.concurrent.TimeUnit timeUnit, Scheduler scheduler)
timeout
- Maximum duration between values before a timeout occurs.timeUnit
- The unit of time which applies to the "timeout" argument.scheduler
- Scheduler to run the timeout timers on.
public Observable<T> timeout(long timeout, java.util.concurrent.TimeUnit timeUnit, Observable<? extends T> other, Scheduler scheduler)
timeout
- Maximum duration between values before a timeout occurs.timeUnit
- The unit of time which applies to the "timeout" argument.other
- Sequence to return in case of a timeout.scheduler
- Scheduler to run the timeout timers on.
public Observable<TimeInterval<T>> timeInterval()
public Observable<TimeInterval<T>> timeInterval(Scheduler scheduler)
scheduler
- Scheduler used to compute time intervals.
public static <T,RESOURCE extends Subscription> Observable<T> using(Func0<RESOURCE> resourceFactory, Func1<RESOURCE,Observable<T>> observableFactory)
resourceFactory
- The factory function to obtain a resource object.observableFactory
- The factory function to obtain an observable sequence that depends on the obtained resource.
public static <T> Observable<T> amb(Observable<? extends T> o1, Observable<? extends T> o2)
o1
- an observable competing to react first.o2
- an observable competing to react first.
public static <T> Observable<T> amb(Observable<? extends T> o1, Observable<? extends T> o2, Observable<? extends T> o3)
o1
- an observable competing to react first.o2
- an observable competing to react first.o3
- an observable competing to react first.
public static <T> Observable<T> amb(Observable<? extends T> o1, Observable<? extends T> o2, Observable<? extends T> o3, Observable<? extends T> o4)
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 <T> Observable<T> amb(Observable<? extends T> o1, Observable<? extends T> o2, Observable<? extends T> o3, Observable<? extends T> o4, Observable<? extends T> o5)
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 <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)
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 <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)
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 <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)
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 <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)
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 <T> Observable<T> amb(java.lang.Iterable<? extends Observable<? extends T>> sources)
sources
- observable sources competing to react first.
public Observable<T> doOnEach(Observer<? super T> observer)
observer
- The action to invoke for each element in the source sequence.
public Observable<T> doOnEach(Action1<T> onNext)
onNext
- The action to invoke for each element in the source sequence.
public Observable<T> doOnEach(Action1<T> onNext, Action0 onCompleted)
onNext
- The action to invoke for each element in the source sequence.onCompleted
- The action to invoke when the source sequence is completed.
public Observable<T> doOnEach(Action1<T> onNext, Action1<java.lang.Throwable> onError)
onNext
- The action to invoke for each element in the source sequence.onError
- The action to invoke when the source sequence calls onError.
public Observable<T> doOnEach(Action1<T> onNext, Action1<java.lang.Throwable> onError, Action0 onCompleted)
onNext
- The action to invoke for each element in the source sequence.onError
- The action to invoke when the source sequence calls onError.onCompleted
- The action to invoke when the source sequence is completed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |