RxJava



rx
Class Observable<T>

java.lang.Object
  extended by rx.Observable<T>
Type Parameters:
T -
Direct Known Subclasses:
ConnectableObservable, GroupedObservable, Subject

public class Observable<T>
extends java.lang.Object

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().
<R> Observable<R>
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
<T> Observable<T>
amb(java.lang.Iterable<? extends Observable<? extends T>> sources)
          Propagates the observable sequence that reacts first.
static
<T> Observable<T>
amb(Observable<? extends T> o1, Observable<? extends T> o2)
          Propagates the observable sequence that reacts first.
static
<T> Observable<T>
amb(Observable<? extends T> o1, Observable<? extends T> o2, Observable<? extends T> o3)
          Propagates the observable sequence that reacts first.
static
<T> Observable<T>
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
<T> Observable<T>
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
<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)
          Propagates the observable sequence that reacts first.
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)
          Propagates the observable sequence that reacts first.
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)
          Propagates the observable sequence that reacts first.
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)
          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.
<R> Observable<R>
cast(java.lang.Class<R> klass)
          Converts the elements of an observable sequence to the specified type.
static
<T1,T2,R> Observable<R>
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
<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)
           
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)
           
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)
           
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)
           
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)
           
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)
           
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)
           
static
<T> Observable<T>
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
<T> Observable<T>
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
<T> Observable<T>
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
<T> Observable<T>
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
<T> Observable<T>
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
<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)
          Returns an Observable that emits the items emitted by two or more Observables, one after the other.
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)
          Returns an Observable that emits the items emitted by two or more Observables, one after the other.
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)
          Returns an Observable that emits the items emitted by two or more Observables, one after the other.
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)
          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
<T> Observable<T>
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
<T> Observable<T>
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.
<T2> Observable<T2>
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.
<U> Observable<T>
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.
<U> Observable<T>
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
<T> Observable<T>
empty()
          Returns an Observable that emits no data to the Observer and immediately invokes its onCompleted method.
static
<T> Observable<T>
empty(Scheduler scheduler)
          Returns an Observable that emits no data to the Observer and immediately invokes its onCompleted method with the specified scheduler.
static
<T> Observable<T>
error(java.lang.Throwable exception)
          Returns an Observable that invokes an Observer's onError method when the Observer subscribes to it
static
<T> Observable<T>
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.
<R> Observable<R>
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
<T> Observable<T>
from(java.util.concurrent.Future<? extends T> future)
          Converts a Future into an Observable.
static
<T> Observable<T>
from(java.util.concurrent.Future<? extends T> future, long timeout, java.util.concurrent.TimeUnit unit)
          Converts a Future into an Observable with timeout.
static
<T> Observable<T>
from(java.util.concurrent.Future<? extends T> future, Scheduler scheduler)
          Converts a Future into an Observable.
static
<T> Observable<T>
from(java.lang.Iterable<? extends T> iterable)
          Converts an Iterable sequence into an Observable.
static
<T> Observable<T>
from(T t1)
          Converts a series of items into an Observable.
static
<T> Observable<T>
from(T[] items)
          Converts an Array into an Observable.
static
<T> Observable<T>
from(T t1, T t2)
          Converts a series of items into an Observable.
static
<T> Observable<T>
from(T t1, T t2, T t3)
          Converts a series of items into an Observable.
static
<T> Observable<T>
from(T t1, T t2, T t3, T t4)
          Converts a series of items into an Observable.
static
<T> Observable<T>
from(T t1, T t2, T t3, T t4, T t5)
          Converts a series of items into an Observable.
static
<T> Observable<T>
from(T t1, T t2, T t3, T t4, T t5, T t6)
          Converts a series of items into an Observable.
static
<T> Observable<T>
from(T t1, T t2, T t3, T t4, T t5, T t6, T t7)
          Converts a series of items into an Observable.
static
<T> Observable<T>
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
<T> Observable<T>
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
<T> Observable<T>
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.
<K> Observable<GroupedObservable<K,T>>
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 GroupedObservables, one GroupedObservable per group.
<K,R> Observable<GroupedObservable<K,R>>
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 GroupedObservables, 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
<T> Observable<T>
just(T value)
          Returns an Observable that emits a single item and then completes.
static
<T> Observable<T>
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.
<R> Observable<R>
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.
<R> Observable<R>
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.
<R> Observable<R>
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
<T extends java.lang.Comparable<T>>
Observable<T>
max(Observable<T> source)
          Returns the maximum element in an observable sequence.
<R extends java.lang.Comparable<R>>
Observable<java.util.List<T>>
maxBy(Func1<T,R> selector)
          Returns the elements in an observable sequence with the maximum key value.
<R> Observable<java.util.List<T>>
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
<T> Observable<T>
merge(Observable<? extends Observable<? extends T>> source)
          Flattens a sequence of Observables emitted by an Observable into one Observable, without any transformation.
static
<T> Observable<T>
merge(Observable<? extends T> t1, Observable<? extends T> t2)
          Flattens a series of Observables into one Observable, without any transformation.
static
<T> Observable<T>
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
<T> Observable<T>
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
<T> Observable<T>
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
<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)
          Flattens a series of Observables into one Observable, without any transformation.
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)
          Flattens a series of Observables into one Observable, without any transformation.
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)
          Flattens a series of Observables into one Observable, without any transformation.
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)
          Flattens a series of Observables into one Observable, without any transformation.
static
<T> Observable<T>
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
<T> Observable<T>
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
<T> Observable<T>
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
<T> Observable<T>
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
<T> Observable<T>
mergeDelayError(Observable<? extends T> t1, Observable<? extends T> t2, Observable<? extends T> t3, Observable<? extends T> t4, Observable<? extends T> t5)
          This behaves like 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
<T> Observable<T>
mergeDelayError(Observable<? extends T> t1, Observable<? extends T> t2, Observable<? extends T> t3, Observable<? extends T> t4, Observable<? extends T> t5, Observable<? extends T> t6)
          This behaves like 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
<T> Observable<T>
mergeDelayError(Observable<? extends T> t1, Observable<? extends T> t2, Observable<? extends T> t3, Observable<? extends T> t4, Observable<? extends T> t5, Observable<? extends T> t6, Observable<? extends T> t7)
          This behaves like 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
<T> Observable<T>
mergeDelayError(Observable<? extends T> t1, Observable<? extends T> t2, Observable<? extends T> t3, Observable<? extends T> t4, Observable<? extends T> t5, Observable<? extends T> t6, Observable<? extends T> t7, Observable<? extends T> t8)
          This behaves like 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
<T> Observable<T>
mergeDelayError(Observable<? extends T> t1, Observable<? extends T> t2, Observable<? extends T> t3, Observable<? extends T> t4, Observable<? extends T> t5, Observable<? extends T> t6, Observable<? extends T> t7, Observable<? extends T> t8, Observable<? extends T> t9)
          This behaves like 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
<T extends java.lang.Comparable<T>>
Observable<T>
min(Observable<T> source)
          Returns the minimum element in an observable sequence.
<R extends java.lang.Comparable<R>>
Observable<java.util.List<T>>
minBy(Func1<T,R> selector)
          Returns the elements in an observable sequence with the minimum key value.
<R> Observable<java.util.List<T>>
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.
<R> ConnectableObservable<R>
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
<T> Observable<T>
never()
          Returns an Observable that never sends any items or notifications to an Observer.
 Observable<T> observeOn(Scheduler scheduler)
          Asynchronously notify Observers on the specified Scheduler.
<R> Observable<R>
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.
<R> Observable<R>
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.
<R> Observable<R>
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 Observers 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.
<R> Observable<R>
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.
<R> Observable<R>
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
<T> Observable<java.lang.Boolean>
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
<T> Observable<java.lang.Boolean>
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
<T> Observable<T>
switchDo(Observable<? extends Observable<? extends T>> sequenceOfSequences)
          Deprecated. Being renamed to Observable.switchOnNext(rx.Observable>)
static
<T> Observable<T>
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
<T> Observable<T>
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.
<E> Observable<T>
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
<T,RESOURCE extends Subscription>
Observable<T>
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
<R> Observable<R>
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
<R> Observable<R>
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
<T1,T2,R> Observable<R>
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
<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)
          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
<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)
          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
<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)
          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
<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)
          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
<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)
          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
<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)
          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
<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)
          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

Observable

protected Observable(Observable.OnSubscribeFunc<T> onSubscribe)
Observable with Function to execute when subscribed to.

NOTE: Use Observable.create(OnSubscribeFunc) to create an Observable instead of this constructor unless you specifically have a need for inheritance.

Parameters:
onSubscribe - Observable.OnSubscribeFunc to be executed when Observable.subscribe(Observer) is called.
Method Detail

subscribe

public 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.

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

Parameters:
observer - the observer
Returns:
a Subscription reference with which the Observer can stop receiving items before the Observable has finished sending them
Throws:
java.lang.IllegalArgumentException - if the Observer provided as the argument to subscribe() is null

subscribe

public 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.

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

Parameters:
observer - the observer
scheduler - the Scheduler on which Observers subscribe to the Observable
Returns:
a Subscription reference with which Observers can stop receiving items and notifications before the Observable has finished sending them
Throws:
java.lang.IllegalArgumentException - if an argument to subscribe() is null

subscribe

public 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.

Parameters:
onNext -

subscribe

public 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.

Parameters:
onNext -
scheduler -

subscribe

public Subscription subscribe(Action1<? super T> onNext,
                              Action1<java.lang.Throwable> onError)

subscribe

public 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.

Parameters:
onNext -
onError -
scheduler -

subscribe

public 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.

Parameters:
onNext -
onError -
onComplete -

subscribe

public 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.

Parameters:
onNext -
onError -
onComplete -
scheduler -

multicast

public <R> ConnectableObservable<R> multicast(Subject<? super T,? extends R> subject)
Returns a ConnectableObservable that upon connection causes the source Observable to push results into the specified subject.

Type Parameters:
R - result type
Parameters:
subject - the Subject for the ConnectableObservable to push source items into
Returns:
a ConnectableObservable that upon connection causes the source Observable to push results into the specified Subject

create

public static <T> Observable<T> create(Observable.OnSubscribeFunc<T> func)
Creates an Observable that will execute the given function when an 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.

Type Parameters:
T - the type of the items that this Observable emits
Parameters:
func - 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
Returns:
an Observable that, when an Observer subscribes to it, will execute the given function

empty

public static <T> Observable<T> empty()
Returns an Observable that emits no data to the Observer and immediately invokes its onCompleted method.

Type Parameters:
T - the type of the items (ostensibly) emitted by the Observable
Returns:
an Observable that returns no data to the Observer and immediately invokes the Observer's onCompleted method
See Also:
MSDN: Observable.Empty Method

empty

public static <T> Observable<T> empty(Scheduler scheduler)
Returns an Observable that emits no data to the Observer and immediately invokes its onCompleted method with the specified scheduler.

Type Parameters:
T - the type of the items (ostensibly) emitted by the Observable
Parameters:
scheduler - the scheduler to call the onCompleted method.
Returns:
an Observable that returns no data to the Observer and immediately invokes the Observer's onCompleted method with the specified scheduler.
See Also:
MSDN: Observable.Empty Method (IScheduler)

error

public static <T> Observable<T> error(java.lang.Throwable exception)
Returns an Observable that invokes an Observer's onError method when the Observer subscribes to it

Type Parameters:
T - the type of the items (ostensibly) emitted by the Observable
Parameters:
exception - the particular error to report
Returns:
an Observable that invokes the Observer's onError method when the Observer subscribes to it
See Also:
MSDN: Observable.Throw Method

error

public static <T> Observable<T> error(java.lang.Throwable exception,
                                      Scheduler scheduler)
Returns an Observable that invokes an Observer's onError method with the specified scheduler.

Type Parameters:
T - the type of the items (ostensibly) emitted by the Observable
Parameters:
exception - the particular error to report
scheduler - the scheduler to call the onError method.
Returns:
an Observable that invokes the Observer's onError method with the specified scheduler.
See Also:
MSDN: Observable.Throw Method

from

public static <T> Observable<T> from(java.lang.Iterable<? extends T> iterable)
Converts an 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.

Type Parameters:
T - the type of items in the Iterable sequence and the type of items to be emitted by the resulting Observable
Parameters:
iterable - the source Iterable sequence
Returns:
an Observable that emits each item in the source Iterable sequence

from

public static <T> Observable<T> from(T[] items)
Converts an Array 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.

Type Parameters:
T - the type of items in the Iterable sequence and the type of items to be emitted by the resulting Observable
Parameters:
items - the source sequence
Returns:
an Observable that emits each item in the source Iterable sequence

from

public static <T> Observable<T> from(T t1)
Converts a series of items into an Observable.

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.

Type Parameters:
T - the type of items in the Array, and the type of items to be emitted by the resulting Observable
Parameters:
t1 - item
Returns:
an Observable that emits each item in the source Array

from

public static <T> Observable<T> from(T t1,
                                     T t2)
Converts a series of items into an Observable.

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.

Type Parameters:
T - the type of items in the Array, and the type of items to be emitted by the resulting Observable
Parameters:
t1 - item
t2 - item
Returns:
an Observable that emits each item in the source Array

from

public static <T> Observable<T> from(T t1,
                                     T t2,
                                     T t3)
Converts a series of items into an Observable.

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.

Type Parameters:
T - the type of items in the Array, and the type of items to be emitted by the resulting Observable
Parameters:
t1 - item
t2 - item
t3 - item
Returns:
an Observable that emits each item in the source Array

from

public static <T> Observable<T> from(T t1,
                                     T t2,
                                     T t3,
                                     T t4)
Converts a series of items into an Observable.

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.

Type Parameters:
T - the type of items in the Array, and the type of items to be emitted by the resulting Observable
Parameters:
t1 - item
t2 - item
t3 - item
t4 - item
Returns:
an Observable that emits each item in the source Array

from

public static <T> Observable<T> from(T t1,
                                     T t2,
                                     T t3,
                                     T t4,
                                     T t5)
Converts a series of items into an Observable.

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.

Type Parameters:
T - the type of items in the Array, and the type of items to be emitted by the resulting Observable
Parameters:
t1 - item
t2 - item
t3 - item
t4 - item
t5 - item
Returns:
an Observable that emits each item in the source Array

from

public static <T> Observable<T> from(T t1,
                                     T t2,
                                     T t3,
                                     T t4,
                                     T t5,
                                     T t6)
Converts a series of items into an Observable.

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.

Type Parameters:
T - the type of items in the Array, and the type of items to be emitted by the resulting Observable
Parameters:
t1 - item
t2 - item
t3 - item
t4 - item
t5 - item
t6 - item
Returns:
an Observable that emits each item in the source Array

from

public static <T> Observable<T> from(T t1,
                                     T t2,
                                     T t3,
                                     T t4,
                                     T t5,
                                     T t6,
                                     T t7)
Converts a series of items into an Observable.

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.

Type Parameters:
T - the type of items in the Array, and the type of items to be emitted by the resulting Observable
Parameters:
t1 - item
t2 - item
t3 - item
t4 - item
t5 - item
t6 - item
t7 - item
Returns:
an Observable that emits each item in the source Array

from

public static <T> Observable<T> 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.

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.

Type Parameters:
T - the type of items in the Array, and the type of items to be emitted by the resulting Observable
Parameters:
t1 - item
t2 - item
t3 - item
t4 - item
t5 - item
t6 - item
t7 - item
t8 - item
Returns:
an Observable that emits each item in the source Array

from

public static <T> Observable<T> 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.

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.

Type Parameters:
T - the type of items in the Array, and the type of items to be emitted by the resulting Observable
Parameters:
t1 - item
t2 - item
t3 - item
t4 - item
t5 - item
t6 - item
t7 - item
t8 - item
t9 - item
Returns:
an Observable that emits each item in the source Array

from

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)
Converts a series of items into an Observable.

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.

Type Parameters:
T - the type of items in the Array, and the type of items to be emitted by the resulting Observable
Parameters:
t1 - item
t2 - item
t3 - item
t4 - item
t5 - item
t6 - item
t7 - item
t8 - item
t10 - item
Returns:
an Observable that emits each item in the source Array

range

public static Observable<java.lang.Integer> range(int start,
                                                  int count)
Generates an Observable that emits a sequence of integers within a specified range.

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.

Parameters:
start - the value of the first integer in the sequence
count - the number of sequential integers to generate
Returns:
an Observable that emits a range of sequential integers
See Also:
Observable.Range Method (Int32, Int32)

defer

public static <T> Observable<T> 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. That is, for each subscriber, the actuall Observable is determined by the factory function.

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.

Type Parameters:
T - the type of the items emitted by the Observable
Parameters:
observableFactory - the Observable factory function to invoke for each Observer that subscribes to the resulting Observable
Returns:
an Observable whose Observers trigger an invocation of the given Observable factory function

just

public static <T> Observable<T> just(T value)
Returns an Observable that emits a single item and then completes.

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.

Type Parameters:
T - the type of that item
Parameters:
value - the item to pass to the Observer's onNext method
Returns:
an Observable that emits a single item and then completes

just

public static <T> Observable<T> just(T value,
                                     Scheduler scheduler)
Returns an Observable that emits a single item and then completes on a specified scheduler.

This is a scheduler version of Observable.just(Object).

Type Parameters:
T - the type of that item
Parameters:
value - the item to pass to the Observer's onNext method
scheduler - the scheduler to send the single element on
Returns:
an Observable that emits a single item and then completes on a specified scheduler.

merge

public static <T> Observable<T> merge(Observable<? extends Observable<? extends T>> source)
Flattens a sequence of Observables emitted by an Observable into one Observable, without any transformation.

You can combine the items emitted by multiple Observables so that they act like a single Observable, by using the merge method.

Parameters:
source - an Observable that emits Observables
Returns:
an Observable that emits items that are the result of flattening the items emitted by the Observables emitted by the source Observable
See Also:
MSDN: Observable.Merge Method

merge

public static <T> Observable<T> merge(Observable<? extends T> t1,
                                      Observable<? extends T> t2)
Flattens a series of Observables into one Observable, without any transformation.

You can combine items emitted by multiple Observables so that they act like a single Observable, by using the merge method.

Parameters:
t1 - an Observable to be merged
t2 - an Observable to be merged
Returns:
an Observable that emits items that are the result of flattening the items emitted by the source Observables
See Also:
MSDN: Observable.Merge Method

merge

public static <T> Observable<T> merge(Observable<? extends T> t1,
                                      Observable<? extends T> t2,
                                      Observable<? extends T> t3)
Flattens a series of Observables into one Observable, without any transformation.

You can combine items emitted by multiple Observables so that they act like a single Observable, by using the merge method.

Parameters:
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
Returns:
an Observable that emits items that are the result of flattening the items emitted by the source Observables
See Also:
MSDN: Observable.Merge Method

merge

public static <T> Observable<T> 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.

You can combine items emitted by multiple Observables so that they act like a single Observable, by using the merge method.

Parameters:
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
Returns:
an Observable that emits items that are the result of flattening the items emitted by the source Observables
See Also:
MSDN: Observable.Merge Method

merge

public 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)
Flattens a series of Observables into one Observable, without any transformation.

You can combine items emitted by multiple Observables so that they act like a single Observable, by using the merge method.

Parameters:
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
Returns:
an Observable that emits items that are the result of flattening the items emitted by the source Observables
See Also:
MSDN: Observable.Merge Method

merge

public 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)
Flattens a series of Observables into one Observable, without any transformation.

You can combine items emitted by multiple Observables so that they act like a single Observable, by using the merge method.

Parameters:
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
t6 - an Observable to be merged
Returns:
an Observable that emits items that are the result of flattening the items emitted by the source Observables
See Also:
MSDN: Observable.Merge Method

merge

public 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)
Flattens a series of Observables into one Observable, without any transformation.

You can combine items emitted by multiple Observables so that they act like a single Observable, by using the merge method.

Parameters:
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
t6 - an Observable to be merged
t7 - an Observable to be merged
Returns:
an Observable that emits items that are the result of flattening the items emitted by the source Observables
See Also:
MSDN: Observable.Merge Method

merge

public 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)
Flattens a series of Observables into one Observable, without any transformation.

You can combine items emitted by multiple Observables so that they act like a single Observable, by using the merge method.

Parameters:
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
t6 - an Observable to be merged
t7 - an Observable to be merged
t8 - an Observable to be merged
Returns:
an Observable that emits items that are the result of flattening the items emitted by the source Observables
See Also:
MSDN: Observable.Merge Method

merge

public 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)
Flattens a series of Observables into one Observable, without any transformation.

You can combine items emitted by multiple Observables so that they act like a single Observable, by using the merge method.

Parameters:
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
t6 - an Observable to be merged
t7 - an Observable to be merged
t8 - an Observable to be merged
t9 - an Observable to be merged
Returns:
an Observable that emits items that are the result of flattening the items emitted by the source Observables
See Also:
MSDN: Observable.Merge Method

concat

public static <T> Observable<T> concat(Observable<? extends Observable<? extends T>> observables)
Returns an Observable that emits the items emitted by two or more Observables, one after the other.

Parameters:
observables - an Observable of Observables
Returns:
an Observable that emits items that are the result of combining the items emitted by the source Observables, one after the other
See Also:
MSDN: Observable.Concat Method

concat

public static <T> Observable<T> 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.

Parameters:
t1 - an Observable to be concatenated
t2 - an Observable to be concatenated an Observable to be concatenated
Returns:
an Observable that emits items that are the result of combining the items emitted by the source Observables, one after the other
See Also:
MSDN: Observable.Concat Method

concat

public static <T> Observable<T> 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.

Parameters:
t1 - an Observable to be concatenated
t2 - an Observable to be concatenated
t3 - an Observable to be concatenated an Observable to be concatenated
Returns:
an Observable that emits items that are the result of combining the items emitted by the source Observables, one after the other
See Also:
MSDN: Observable.Concat Method

concat

public static <T> Observable<T> 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.

Parameters:
t1 - an Observable to be concatenated
t2 - an Observable to be concatenated
t3 - an Observable to be concatenated
t4 - an Observable to be concatenated
Returns:
an Observable that emits items that are the result of combining the items emitted by the source Observables, one after the other
See Also:
MSDN: Observable.Concat Method

concat

public 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)
Returns an Observable that emits the items emitted by two or more Observables, one after the other.

Parameters:
t1 - an Observable to be concatenated
t2 - an Observable to be concatenated
t3 - an Observable to be concatenated
t4 - an Observable to be concatenated
t5 - an Observable to be concatenated
Returns:
an Observable that emits items that are the result of combining the items emitted by the source Observables, one after the other
See Also:
MSDN: Observable.Concat Method

concat

public 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)
Returns an Observable that emits the items emitted by two or more Observables, one after the other.

Parameters:
t1 - an Observable to be concatenated
t2 - an Observable to be concatenated
t3 - an Observable to be concatenated
t4 - an Observable to be concatenated
t5 - an Observable to be concatenated
t6 - an Observable to be concatenated
Returns:
an Observable that emits items that are the result of combining the items emitted by the source Observables, one after the other
See Also:
MSDN: Observable.Concat Method

concat

public 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)
Returns an Observable that emits the items emitted by two or more Observables, one after the other.

Parameters:
t1 - an Observable to be concatenated
t2 - an Observable to be concatenated
t3 - an Observable to be concatenated
t4 - an Observable to be concatenated
t5 - an Observable to be concatenated
t6 - an Observable to be concatenated
t7 - an Observable to be concatenated
Returns:
an Observable that emits items that are the result of combining the items emitted by the source Observables, one after the other
See Also:
MSDN: Observable.Concat Method

concat

public 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)
Returns an Observable that emits the items emitted by two or more Observables, one after the other.

Parameters:
t1 - an Observable to be concatenated
t2 - an Observable to be concatenated
t3 - an Observable to be concatenated
t4 - an Observable to be concatenated
t5 - an Observable to be concatenated
t6 - an Observable to be concatenated
t7 - an Observable to be concatenated
t8 - an Observable to be concatenated
Returns:
an Observable that emits items that are the result of combining the items emitted by the source Observables, one after the other
See Also:
MSDN: Observable.Concat Method

concat

public 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)
Returns an Observable that emits the items emitted by two or more Observables, one after the other.

Parameters:
t1 - an Observable to be concatenated
t2 - an Observable to be concatenated
t3 - an Observable to be concatenated
t4 - an Observable to be concatenated
t5 - an Observable to be concatenated
t6 - an Observable to be concatenated
t7 - an Observable to be concatenated
t8 - an Observable to be concatenated
t9 - an Observable to be concatenated
Returns:
an Observable that emits items that are the result of combining the items emitted by the source Observables, one after the other
See Also:
MSDN: Observable.Concat Method

mergeDelayError

public static <T> Observable<T> 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.

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.

Parameters:
source - an Observable that emits Observables
Returns:
an Observable that emits items that are the result of flattening the items emitted by the Observables emitted by the source Observable
See Also:
MSDN: Observable.Merge Method

mergeDelayError

public static <T> Observable<T> 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.

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.

Parameters:
t1 - an Observable to be merged
t2 - an Observable to be merged
Returns:
an Observable that emits items that are the result of flattening the items emitted by the source Observables
See Also:
MSDN: Observable.Merge Method

mergeDelayError

public static <T> Observable<T> 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.

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.

Parameters:
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
Returns:
an Observable that emits items that are the result of flattening the items emitted by the source Observables
See Also:
MSDN: Observable.Merge Method

mergeDelayError

public static <T> Observable<T> 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.

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.

Parameters:
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
Returns:
an Observable that emits items that are the result of flattening the items emitted by the source Observables
See Also:
MSDN: Observable.Merge Method

mergeDelayError

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

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.

Parameters:
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
Returns:
an Observable that emits items that are the result of flattening the items emitted by the source Observables
See Also:
MSDN: Observable.Merge Method

mergeDelayError

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

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.

Parameters:
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
t6 - an Observable to be merged
Returns:
an Observable that emits items that are the result of flattening the items emitted by the source Observables
See Also:
MSDN: Observable.Merge Method

mergeDelayError

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

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.

Parameters:
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
t6 - an Observable to be merged
t7 - an Observable to be merged
Returns:
an Observable that emits items that are the result of flattening the items emitted by the source Observables
See Also:
MSDN: Observable.Merge Method

mergeDelayError

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

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.

Parameters:
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
t6 - an Observable to be merged
t7 - an Observable to be merged
t8 - an Observable to be merged
Returns:
an Observable that emits items that are the result of flattening the items emitted by the source Observables
See Also:
MSDN: Observable.Merge Method

mergeDelayError

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

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.

Parameters:
t1 - an Observable to be merged
t2 - an Observable to be merged
t3 - an Observable to be merged
t4 - an Observable to be merged
t5 - an Observable to be merged
t6 - an Observable to be merged
t7 - an Observable to be merged
t8 - an Observable to be merged
t9 - an Observable to be merged
Returns:
an Observable that emits items that are the result of flattening the items emitted by the source Observables
See Also:
MSDN: Observable.Merge Method

never

public static <T> Observable<T> never()
Returns an Observable that never sends any items or notifications to an Observer.

This Observable is useful primarily for testing purposes.

Type Parameters:
T - the type of items (not) emitted by the Observable
Returns:
an Observable that never sends any items or notifications to an Observer

switchDo

@Deprecated
public static <T> Observable<T> switchDo(Observable<? extends Observable<? extends T>> sequenceOfSequences)
Deprecated. Being renamed to Observable.switchOnNext(rx.Observable>)

Given an Observable that emits Observables, creates a single Observable that emits the items emitted by the most recently published of those Observables.

Parameters:
sequenceOfSequences - the source Observable that emits Observables
Returns:
an Observable that emits only the items emitted by the most recently published Observable

switchOnNext

public static <T> Observable<T> 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.

Parameters:
sequenceOfSequences - the source Observable that emits Observables
Returns:
an Observable that emits only the items emitted by the most recently published Observable

synchronize

public Observable<T> synchronize()
Accepts an Observable and wraps it in another Observable that ensures that the resulting Observable is chronologically well-behaved.

A well-behaved Observable does not interleave its invocations of the onNext, onCompleted, and onError methods of its Observers; 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.

Returns:
an Observable that is a chronologically well-behaved version of the source Observable, and that synchronously notifies its Observers

synchronize

public 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. This is accomplished by acquiring a mutual-exclusion lock for the object provided as the lock parameter.

A well-behaved Observable does not interleave its invocations of the onNext, onCompleted, and onError methods of its Observers; 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.

Parameters:
lock - The lock object to synchronize each observer call on
Returns:
an Observable that is a chronologically well-behaved version of the source Observable, and that synchronously notifies its Observers

synchronize

@Deprecated
public static <T> Observable<T> synchronize(Observable<T> source)
Deprecated. Replaced with instance method.


interval

public static Observable<java.lang.Long> interval(long interval,
                                                  java.util.concurrent.TimeUnit unit)
Emits an item each time interval (containing a sequential number).

Parameters:
interval - Interval size in time units (see below).
unit - Time units to use for the interval size.
Returns:
An Observable that emits an item each time interval.
See Also:
MSDN: Observable.Interval

interval

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

Parameters:
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.
Returns:
An Observable that emits an item each time interval.
See Also:
MSDN: Observable.Interval

debounce

public 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. The timer resets on each `onNext` call.

NOTE: If events keep firing faster than the timeout then no data will be emitted.

Information on debounce vs throttle:

Parameters:
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.
Returns:
An Observable which filters out values which are too quickly followed up with newer values.
See Also:
Observable.throttleWithTimeout(long, TimeUnit)

debounce

public 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. The timer resets on each `onNext` call.

NOTE: If events keep firing faster than the timeout then no data will be emitted.

Information on debounce vs throttle:

Parameters:
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.
Returns:
Observable which performs the throttle operation.
See Also:
Observable.throttleWithTimeout(long, TimeUnit, Scheduler)

throttleWithTimeout

public 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. The timer resets on each `onNext` call.

NOTE: If events keep firing faster than the timeout then no data will be emitted.

Information on debounce vs throttle:

Parameters:
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.
Returns:
An Observable which filters out values which are too quickly followed up with newer values.
See Also:
Observable.debounce(long, TimeUnit)

throttleWithTimeout

public 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. The timer resets on each `onNext` call.

NOTE: If events keep firing faster than the timeout then no data will be emitted.

Parameters:
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.
Returns:
Observable which performs the throttle operation.
See Also:
Observable.debounce(long, TimeUnit, Scheduler)

throttleFirst

public Observable<T> throttleFirst(long windowDuration,
                                   java.util.concurrent.TimeUnit unit)
Throttles by skipping value until `skipDuration` passes and then emits the next received value.

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.

Parameters:
windowDuration - Time to wait before sending another value after emitting last value.
unit - The unit of time for the specified timeout.
Returns:
Observable which performs the throttle operation.

throttleFirst

public 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.

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.

Parameters:
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.
Returns:
Observable which performs the throttle operation.

throttleLast

public Observable<T> throttleLast(long intervalDuration,
                                  java.util.concurrent.TimeUnit unit)
Throttles by returning the last value of each interval defined by 'intervalDuration'.

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.

Parameters:
intervalDuration - Duration of windows within with the last value will be chosen.
unit - The unit of time for the specified interval.
Returns:
Observable which performs the throttle operation.
See Also:
Observable.sample(long, TimeUnit)

throttleLast

public Observable<T> throttleLast(long intervalDuration,
                                  java.util.concurrent.TimeUnit unit,
                                  Scheduler scheduler)
Throttles by returning the last value of each interval defined by 'intervalDuration'.

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.

Parameters:
intervalDuration - Duration of windows within with the last value will be chosen.
unit - The unit of time for the specified interval.
Returns:
Observable which performs the throttle operation.
See Also:
Observable.sample(long, TimeUnit, Scheduler)

timestamp

public Observable<Timestamped<T>> timestamp()
Wraps each item emitted by a source Observable in a Timestamped object.

Returns:
an Observable that emits timestamped items from the source Observable

from

public static <T> Observable<T> from(java.util.concurrent.Future<? extends T> future)
Converts a 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.

Type Parameters:
T - the type of object that the Future returns, and also the type of item to be emitted by the resulting Observable
Parameters:
future - the source Future
Returns:
an Observable that emits the item from the source Future

from

public static <T> Observable<T> from(java.util.concurrent.Future<? extends T> future,
                                     Scheduler scheduler)
Converts a 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.

Type Parameters:
T - the type of object that the Future returns, and also the type of item to be emitted by the resulting Observable
Parameters:
future - 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.
Returns:
an Observable that emits the item from the source Future

from

public static <T> Observable<T> from(java.util.concurrent.Future<? extends T> future,
                                     long timeout,
                                     java.util.concurrent.TimeUnit unit)
Converts a 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.

Type Parameters:
T - the type of object that the Future returns, and also the type of item to be emitted by the resulting Observable
Parameters:
future - the source Future
timeout - the maximum time to wait before calling get()
unit - the TimeUnit of the time argument
Returns:
an Observable that emits the item from the source Future

sequenceEqual

public static <T> Observable<java.lang.Boolean> 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.

Type Parameters:
T - the type of items emitted by each Observable
Parameters:
first - one Observable to compare
second - the second Observable to compare
Returns:
an Observable that emits Booleans that indicate whether the corresponding items emitted by the source Observables are equal

sequenceEqual

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

Type Parameters:
T - the type of items emitted by each Observable
Parameters:
first - one Observable to compare
second - the second Observable to compare
equality - a function used to compare items emitted by both Observables
Returns:
an Observable that emits Booleans that indicate whether the corresponding items emitted by the source Observables are equal

zip

public static <T1,T2,R> Observable<R> 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.

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.

Parameters:
o1 - one source Observable
o2 - another source Observable
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
Returns:
an Observable that emits the zipped results

zip

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

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.

Parameters:
o1 - one source Observable
o2 - a second source Observable
o3 - a third source Observable
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
Returns:
an Observable that emits the zipped results

zip

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

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.

Parameters:
o1 - one source Observable
o2 - a second source Observable
o3 - a third source Observable
o4 - a fourth source Observable
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
Returns:
an Observable that emits the zipped results

zip

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

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.

Parameters:
o1 - one source Observable
o2 - a second source Observable
o3 - a third source Observable
o4 - a fourth source Observable
o5 - a fifth source Observable
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
Returns:
an Observable that emits the zipped results

zip

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

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.

Parameters:
o1 - one source Observable
o2 - a second source Observable
o3 - a third source Observable
o4 - a fourth source Observable
o5 - a fifth source Observable
o6 - a sixth source Observable
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
Returns:
an Observable that emits the zipped results

zip

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

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.

Parameters:
o1 - one source Observable
o2 - a second source Observable
o3 - a third source Observable
o4 - a fourth source Observable
o5 - a fifth source Observable
o6 - a sixth source Observable
o7 - a seventh source Observable
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
Returns:
an Observable that emits the zipped results

zip

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

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.

Parameters:
o1 - one source Observable
o2 - a second source Observable
o3 - a third source Observable
o4 - a fourth source Observable
o5 - a fifth source Observable
o6 - a sixth source Observable
o7 - a seventh source Observable
o8 - an eighth source Observable
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
Returns:
an Observable that emits the zipped results

zip

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

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.

Parameters:
o1 - one source Observable
o2 - a second source Observable
o3 - a third source Observable
o4 - a fourth source Observable
o5 - a fifth source Observable
o6 - a sixth source Observable
o7 - a seventh source Observable
o8 - an eighth source Observable
o9 - a ninth source Observable
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
Returns:
an Observable that emits the zipped results

combineLatest

public static <T1,T2,R> Observable<R> 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.

Parameters:
o1 - The first source observable.
o2 - The second source observable.
combineFunction - The aggregation function used to combine the source observable values.
Returns:
An Observable that combines the source Observables with the given combine function

combineLatest

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)
See Also:
Observable.combineLatest(Observable, Observable, Func2)

combineLatest

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)
See Also:
Observable.combineLatest(Observable, Observable, Func2)

combineLatest

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)
See Also:
Observable.combineLatest(Observable, Observable, Func2)

combineLatest

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)
See Also:
Observable.combineLatest(Observable, Observable, Func2)

combineLatest

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)
See Also:
Observable.combineLatest(Observable, Observable, Func2)

combineLatest

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)
See Also:
Observable.combineLatest(Observable, Observable, Func2)

combineLatest

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)
See Also:
Observable.combineLatest(Observable, Observable, Func2)

buffer

public Observable<java.util.List<T>> buffer(Func0<? extends Observable<? extends Closing>> bufferClosingSelector)
Creates an Observable which produces buffers of collected values.

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.

Parameters:
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.
Returns:
An Observable which produces connected non-overlapping buffers, which are emitted when the current Observable created with the Func0 argument produces a Closing object.

buffer

public 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.

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.

Parameters:
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.
Returns:
An Observable which produces buffers which are created and emitted when the specified Observables publish certain objects.

buffer

public Observable<java.util.List<T>> buffer(int count)
Creates an Observable which produces buffers of collected values.

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.

Parameters:
count - The maximum size of each buffer before it should be emitted.
Returns:
An Observable which produces connected non-overlapping buffers containing at most "count" produced values.

buffer

public Observable<java.util.List<T>> buffer(int count,
                                            int skip)
Creates an Observable which produces buffers of collected values.

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.

Parameters:
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).
Returns:
An Observable which produces buffers every "skipped" values containing at most "count" produced values.

buffer

public Observable<java.util.List<T>> buffer(long timespan,
                                            java.util.concurrent.TimeUnit unit)
Creates an Observable which produces buffers of collected values.

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.

Parameters:
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.
Returns:
An Observable which produces connected non-overlapping buffers with a fixed duration.

buffer

public Observable<java.util.List<T>> buffer(long timespan,
                                            java.util.concurrent.TimeUnit unit,
                                            Scheduler scheduler)
Creates an Observable which produces buffers of collected values.

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.

Parameters:
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.
Returns:
An Observable which produces connected non-overlapping buffers with a fixed duration.

buffer

public Observable<java.util.List<T>> buffer(long timespan,
                                            java.util.concurrent.TimeUnit unit,
                                            int count)
Creates an Observable which produces buffers of collected values. This Observable produces connected non-overlapping buffers, each of a fixed duration specified by the "timespan" argument or a maximum size specified by the "count" argument (which ever is reached first). When the source Observable completes or encounters an error, the current buffer is emitted and the event is propagated.

Parameters:
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.
Returns:
An 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).

buffer

public 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. This Observable produces connected non-overlapping buffers, each of a fixed duration specified by the "timespan" argument or a maximum size specified by the "count" argument (which ever is reached first). When the source Observable completes or encounters an error, the current buffer is emitted and the event is propagated.

Parameters:
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.
Returns:
An 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).

buffer

public Observable<java.util.List<T>> buffer(long timespan,
                                            long timeshift,
                                            java.util.concurrent.TimeUnit unit)
Creates an Observable which produces buffers of collected values. This Observable starts a new buffer periodically, which is determined by the "timeshift" argument. Each buffer is emitted after a fixed timespan specified by the "timespan" argument. When the source Observable completes or encounters an error, the current buffer is emitted and the event is propagated.

Parameters:
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.
Returns:
An Observable which produces new buffers periodically, and these are emitted after a fixed timespan has elapsed.

buffer

public 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. This Observable starts a new buffer periodically, which is determined by the "timeshift" argument. Each buffer is emitted after a fixed timespan specified by the "timespan" argument. When the source Observable completes or encounters an error, the current buffer is emitted and the event is propagated.

Parameters:
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.
Returns:
An Observable which produces new buffers periodically, and these are emitted after a fixed timespan has elapsed.

window

public Observable<Observable<T>> window(Func0<? extends Observable<? extends Closing>> closingSelector)
Creates an Observable which produces windows of collected values. This Observable produces connected non-overlapping windows. The current window is emitted and replaced with a new window 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 window.

Parameters:
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.
Returns:
An Observable which produces connected non-overlapping windows, which are emitted when the current Observable created with the Func0 argument produces a Closing object.

window

public Observable<Observable<T>> window(Observable<? extends Opening> windowOpenings,
                                        Func1<Opening,? extends Observable<? extends Closing>> closingSelector)
Creates an Observable which produces windows of collected values. This Observable produces windows. Chunks are created when the specified "windowOpenings" 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 window is emitted.

Parameters:
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.
Returns:
An Observable which produces windows which are created and emitted when the specified Observables publish certain objects.

window

public Observable<Observable<T>> window(int count)
Creates an Observable which produces windows of collected values. This Observable produces connected non-overlapping windows, each containing "count" elements. When the source Observable completes or encounters an error, the current window is emitted, and the event is propagated.

Parameters:
count - The maximum size of each window before it should be emitted.
Returns:
An Observable which produces connected non-overlapping windows containing at most "count" produced values.

window

public Observable<Observable<T>> window(int count,
                                        int skip)
Creates an Observable which produces windows of collected values. This Observable produces windows every "skip" values, each containing "count" elements. When the source Observable completes or encounters an error, the current window is emitted and the event is propagated.

Parameters:
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).
Returns:
An Observable which produces windows every "skipped" values containing at most "count" produced values.

window

public Observable<Observable<T>> window(long timespan,
                                        java.util.concurrent.TimeUnit unit)
Creates an Observable which produces windows of collected values. This Observable produces connected non-overlapping windows, each of a fixed duration specified by the "timespan" argument. When the source Observable completes or encounters an error, the current window is emitted and the event is propagated.

Parameters:
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.
Returns:
An Observable which produces connected non-overlapping windows with a fixed duration.

window

public Observable<Observable<T>> window(long timespan,
                                        java.util.concurrent.TimeUnit unit,
                                        Scheduler scheduler)
Creates an Observable which produces windows of collected values. This Observable produces connected non-overlapping windows, each of a fixed duration specified by the "timespan" argument. When the source Observable completes or encounters an error, the current window is emitted and the event is propagated.

Parameters:
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.
Returns:
An Observable which produces connected non-overlapping windows with a fixed duration.

window

public Observable<Observable<T>> window(long timespan,
                                        java.util.concurrent.TimeUnit unit,
                                        int count)
Creates an Observable which produces windows of collected values. This Observable produces connected non-overlapping windows, each of a fixed duration specified by the "timespan" argument or a maximum size specified by the "count" argument (which ever is reached first). When the source Observable completes or encounters an error, the current window is emitted and the event is propagated.

Parameters:
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.
Returns:
An 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).

window

public Observable<Observable<T>> window(long timespan,
                                        java.util.concurrent.TimeUnit unit,
                                        int count,
                                        Scheduler scheduler)
Creates an Observable which produces windows of collected values. This Observable produces connected non-overlapping windows, each of a fixed duration specified by the "timespan" argument or a maximum size specified by the "count" argument (which ever is reached first). When the source Observable completes or encounters an error, the current window is emitted and the event is propagated.

Parameters:
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.
Returns:
An 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).

window

public Observable<Observable<T>> window(long timespan,
                                        long timeshift,
                                        java.util.concurrent.TimeUnit unit)
Creates an Observable which produces windows of collected values. This Observable starts a new window periodically, which is determined by the "timeshift" argument. Each window is emitted after a fixed timespan specified by the "timespan" argument. When the source Observable completes or encounters an error, the current window is emitted and the event is propagated.

Parameters:
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.
Returns:
An Observable which produces new windows periodically, and these are emitted after a fixed timespan has elapsed.

window

public Observable<Observable<T>> window(long timespan,
                                        long timeshift,
                                        java.util.concurrent.TimeUnit unit,
                                        Scheduler scheduler)
Creates an Observable which produces windows of collected values. This Observable starts a new window periodically, which is determined by the "timeshift" argument. Each window is emitted after a fixed timespan specified by the "timespan" argument. When the source Observable completes or encounters an error, the current window is emitted and the event is propagated.

Parameters:
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.
Returns:
An Observable which produces new windows periodically, and these are emitted after a fixed timespan has elapsed.

zip

public static <R> Observable<R> 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.

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.

Parameters:
ws - An Observable of source Observables
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
Returns:
an Observable that emits the zipped results

zip

public static <R> Observable<R> 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.

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.

Parameters:
ws - A collection of source Observables
zipFunction - a function that, when applied to an item emitted by each of the source Observables, results in an item that will be emitted by the resulting Observable
Returns:
an Observable that emits the zipped results

filter

public Observable<T> filter(Func1<? super T,java.lang.Boolean> predicate)
Filter items emitted by an Observable.

Parameters:
predicate - a function that evaluates the items emitted by the source Observable, returning true if they pass the filter
Returns:
an Observable that emits only those items in the original Observable that the filter evaluates as true

distinctUntilChanged

public Observable<T> distinctUntilChanged()
Returns an Observable that forwards all sequentially distinct items emitted from the source Observable.

Returns:
an Observable of sequentially distinct items
See Also:
MSDN: Observable.distinctUntilChanged

distinctUntilChanged

public <U> Observable<T> 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.

Parameters:
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
Returns:
an Observable of sequentially distinct items
See Also:
MSDN: Observable.distinctUntilChanged

distinct

public Observable<T> distinct()
Returns an Observable that forwards all distinct items emitted from the source Observable.

Returns:
an Observable of distinct items
See Also:
MSDN: Observable.distinct

distinct

public <U> Observable<T> 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.

Parameters:
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
Returns:
an Observable of distinct items
See Also:
MSDN: Observable.distinct

elementAt

public Observable<T> elementAt(int index)
Returns the element at a specified index in a sequence.

Parameters:
index - The zero-based index of the element to retrieve.
Returns:
An observable sequence that produces the element at the specified position in the source sequence.
Throws:
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.

elementAtOrDefault

public 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.

Parameters:
index - The zero-based index of the element to retrieve.
defaultValue - The default value.
Returns:
An observable sequence that produces the element at the specified position in the source sequence, or the default value if the index is outside the bounds of the source sequence.
Throws:
java.lang.IndexOutOfBoundsException - Index is less than 0.

exists

public 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. 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.

Parameters:
predicate - The condition to test every element.
Returns:
A subscription function for creating the target Observable.
See Also:
MSDN: Observable.Any Note: the description in this page is wrong.

contains

public Observable<java.lang.Boolean> contains(T element)
Determines whether an observable sequence contains a specified element.

Parameters:
element - The element to search in the sequence.
Returns:
an Observable that emits if the element is in the source sequence.
See Also:
MSDN: Observable.Contains

finallyDo

public Observable<T> finallyDo(Action0 action)
Registers an Action0 to be called when this Observable invokes onCompleted or onError.

Parameters:
action - an Action0 to be invoked when the source Observable finishes
Returns:
an Observable that emits the same items as the source Observable, then invokes the Action0
See Also:
MSDN: Observable.Finally Method

flatMap

public <R> Observable<R> 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.

Note: mapMany and flatMap are equivalent.

Parameters:
func - a function that, when applied to an item emitted by the source Observable, returns an Observable
Returns:
an Observable that emits the result of applying the transformation function to each item emitted by the source Observable and merging the results of the Observables obtained from this transformation.
See Also:
Observable.mapMany(Func1)

where

public Observable<T> where(Func1<? super T,java.lang.Boolean> predicate)
Filter items emitted by an Observable.

Parameters:
predicate - a function that evaluates an item emitted by the source Observable, returning true if it passes the filter
Returns:
an Observable that emits only those items in the original Observable that the filter evaluates as true
See Also:
Observable.filter(Func1)

map

public <R> Observable<R> 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.

Parameters:
func - a function to apply to each item emitted by the Observable
Returns:
an Observable that emits the items from the source Observable, transformed by the given function
See Also:
MSDN: Observable.Select

mapWithIndex

public <R> Observable<R> 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.

Parameters:
func - a function to apply to each item emitted by the Observable. The function takes the index of the emitted item as additional parameter.
Returns:
an Observable that emits the items from the source Observable, transformed by the given function
See Also:
MSDN: Observable.Select

mapMany

public <R> Observable<R> 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.

Note: mapMany and flatMap are equivalent.

Parameters:
func - a function that, when applied to an item emitted by the source Observable, returns an Observable
Returns:
an Observable that emits the result of applying the transformation function to each item emitted by the source Observable and merging the results of the Observables obtained from this transformation.
See Also:
Observable.flatMap(Func1)

materialize

public 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.

Returns:
an Observable whose items are the result of materializing the items and notifications of the source Observable
See Also:
MSDN: Observable.materialize

subscribeOn

public Observable<T> subscribeOn(Scheduler scheduler)
Asynchronously subscribes and unsubscribes Observers on the specified Scheduler.

Parameters:
scheduler - the Scheduler to perform subscription and unsubscription actions on
Returns:
the source Observable modified so that its subscriptions and unsubscriptions happen on the specified Scheduler

observeOn

public Observable<T> observeOn(Scheduler scheduler)
Asynchronously notify Observers on the specified Scheduler.

Parameters:
scheduler - the Scheduler to notify Observers on
Returns:
the source Observable modified so that its Observers are notified on the specified Scheduler

dematerialize

public <T2> Observable<T2> 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.

Returns:
an Observable that emits the items and notifications embedded in the Notification objects emitted by the source Observable
Throws:
java.lang.Throwable - if the source Observable is not of type Observable<Notification<T>>.
See Also:
MSDN: Observable.dematerialize

onErrorResumeNext

public 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.

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.

Parameters:
resumeFunction - a function that returns an Observable that will take over if the source Observable encounters an error
Returns:
the original Observable, with appropriately modified behavior

onErrorResumeNext

public 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.

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.

Parameters:
resumeSequence - a function that returns an Observable that will take over if the source Observable encounters an error
Returns:
the original Observable, with appropriately modified behavior

onExceptionResumeNext

public 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.

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.

Parameters:
resumeSequence - a function that returns an Observable that will take over if the source Observable encounters an error
Returns:
the original Observable, with appropriately modified behavior

onErrorReturn

public 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.

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.

Parameters:
resumeFunction - a function that returns an item that the new Observable will emit if the source Observable encounters an error
Returns:
the original Observable with appropriately modified behavior

reduce

public 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.

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.

Parameters:
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
Returns:
an Observable that emits a single item that is the result of accumulating the output from the source Observable
Throws:
java.lang.IllegalArgumentException - if Observable sequence is empty.
See Also:
MSDN: Observable.Aggregate, Wikipedia: Fold (higher-order function)

count

public Observable<java.lang.Integer> count()
Returns an Observable that counts the total number of elements in the source Observable.

Returns:
an Observable emitting the number of counted elements of the source Observable as its single item.
See Also:
MSDN: Observable.Count

sum

public static Observable<java.lang.Integer> sum(Observable<java.lang.Integer> source)
Returns an Observable that sums up the elements in the source Observable.

Parameters:
source - Source observable to compute the sum of.
Returns:
an Observable emitting the sum of all the elements of the source Observable as its single item.
See Also:
MSDN: Observable.Sum

sumLongs

public static Observable<java.lang.Long> sumLongs(Observable<java.lang.Long> source)
See Also:
Observable.sum(Observable), MSDN: Observable.Sum

sumFloats

public static Observable<java.lang.Float> sumFloats(Observable<java.lang.Float> source)
See Also:
Observable.sum(Observable), MSDN: Observable.Sum

sumDoubles

public static Observable<java.lang.Double> sumDoubles(Observable<java.lang.Double> source)
See Also:
Observable.sum(Observable), MSDN: Observable.Sum

average

public 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. For an empty source, it causes an IllegalArgumentException.

Parameters:
source - Source observable to compute the average of.
Returns:
an Observable emitting the averageof all the elements of the source Observable as its single item.
Throws:
java.lang.IllegalArgumentException - if Observable sequence is empty.
See Also:
MSDN: Observable.Average

averageLongs

public static Observable<java.lang.Long> averageLongs(Observable<java.lang.Long> source)
See Also:
Observable.average(Observable), MSDN: Observable.Average

averageFloats

public static Observable<java.lang.Float> averageFloats(Observable<java.lang.Float> source)
See Also:
Observable.average(Observable), MSDN: Observable.Average

averageDoubles

public static Observable<java.lang.Double> averageDoubles(Observable<java.lang.Double> source)
See Also:
Observable.average(Observable), MSDN: Observable.Average

min

public static <T extends java.lang.Comparable<T>> Observable<T> min(Observable<T> source)
Returns the minimum element in an observable sequence. If there are more than one minimum elements, returns the last one. For an empty source, it causes an IllegalArgumentException.

Parameters:
source - an observable sequence to determine the minimum element of.
Returns:
an observable emitting the minimum element.
Throws:
java.lang.IllegalArgumentException - if the source is empty
See Also:
MSDN: Observable.Min

min

public Observable<T> min(java.util.Comparator<T> comparator)
Returns the minimum element in an observable sequence according to the specified comparator. If there are more than one minimum elements, returns the last one. For an empty source, it causes an IllegalArgumentException.

Parameters:
comparator - the comparer used to compare elements.
Returns:
an observable emitting the minimum value according to the specified comparator.
Throws:
java.lang.IllegalArgumentException - if the source is empty
See Also:
MSDN: Observable.Min

minBy

public <R extends java.lang.Comparable<R>> Observable<java.util.List<T>> minBy(Func1<T,R> selector)
Returns the elements in an observable sequence with the minimum key value. For an empty source, it returns an observable emitting an empty List.

Parameters:
selector - the key selector function.
Returns:
an observable emitting a List of the elements with the minimum key value.
See Also:
MSDN: Observable.MinBy

minBy

public <R> Observable<java.util.List<T>> 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. For an empty source, it returns an observable emitting an empty List.

Parameters:
selector - the key selector function.
comparator - the comparator used to compare key values.
Returns:
an observable emitting a List of the elements with the minimum key value according to the specified comparator.
See Also:
MSDN: Observable.MinBy

max

public static <T extends java.lang.Comparable<T>> Observable<T> max(Observable<T> source)
Returns the maximum element in an observable sequence. If there are more than one maximum elements, returns the last one. For an empty source, it causes an IllegalArgumentException.

Parameters:
source - an observable sequence to determine the maximum element of.
Returns:
an observable emitting the maximum element.
Throws:
java.lang.IllegalArgumentException - if the source is empty.
See Also:
MSDN: Observable.Max

max

public Observable<T> max(java.util.Comparator<T> comparator)
Returns the maximum element in an observable sequence according to the specified comparator. If there are more than one maximum elements, returns the last one. For an empty source, it causes an IllegalArgumentException.

Parameters:
comparator - the comparer used to compare elements.
Returns:
an observable emitting the maximum value according to the specified comparator.
Throws:
java.lang.IllegalArgumentException - if the source is empty.
See Also:
MSDN: Observable.Max

maxBy

public <R extends java.lang.Comparable<R>> Observable<java.util.List<T>> maxBy(Func1<T,R> selector)
Returns the elements in an observable sequence with the maximum key value. For an empty source, it returns an observable emitting an empty List.

Parameters:
selector - the key selector function.
Returns:
an observable emitting a List of the elements with the maximum key value.
See Also:
MSDN: Observable.MaxBy

maxBy

public <R> Observable<java.util.List<T>> 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. For an empty source, it returns an observable emitting an empty List.

Parameters:
selector - the key selector function.
comparator - the comparator used to compare key values.
Returns:
an observable emitting a List of the elements with the maximum key value according to the specified comparator.
See Also:
MSDN: Observable.MaxBy

replay

public 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.

Returns:
a ConnectableObservable that upon connection causes the source Observable to emit items to its Observers

retry

public Observable<T> retry(int retryCount)
Retry subscription to origin Observable upto given retry count.

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].

Parameters:
retryCount - Number of retry attempts before failing.
Returns:
Observable with retry logic.

retry

public Observable<T> retry()
Retry subscription to origin Observable whenever onError is called (infinite retry count).

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].

Returns:
Observable with retry logic.

cache

public 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.

This is useful when you want an Observable to cache responses and you can't control the subscribe/unsubscribe behavior of all the Observers.

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.

Returns:
an Observable that when first subscribed to, caches all of its notifications for the benefit of subsequent subscribers.

parallel

public <R> Observable<R> 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.

Parameters:
f - a Func1 that applies Observable operators to Observable<T> in parallel and returns an Observable<R>
Returns:
an Observable with the output of the Func1 executed on a Scheduler

parallel

public <R> Observable<R> 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.

Parameters:
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.
Returns:
an Observable with the output of the Func1 executed on a Scheduler

publish

public ConnectableObservable<T> publish()
Returns a ConnectableObservable, which waits until its connect method is called before it begins emitting items to those Observers that have subscribed to it.

Returns:
a ConnectableObservable that upon connection causes the source Observable to emit items to its Observers

publishLast

public ConnectableObservable<T> publishLast()
Returns a ConnectableObservable that shares a single subscription that contains the last notification only.

Returns:
a ConnectableObservable

aggregate

public Observable<T> aggregate(Func2<T,T,T> accumulator)
Synonymous with reduce().

See Also:
Observable.reduce(Func2)

reduce

public <R> Observable<R> 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.

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.

Parameters:
initialValue - the initial (seed) accumulator value
accumulator - an accumulator function to be invoked on each item emitted by the source Observable, the result of which will be used in the next accumulator call
Returns:
an Observable that emits a single item that is the result of accumulating the output from the items emitted by the source Observable
See Also:
MSDN: Observable.Aggregate, Wikipedia: Fold (higher-order function)

aggregate

public <R> Observable<R> aggregate(R initialValue,
                                   Func2<R,? super T,R> accumulator)
Synonymous with reduce().

See Also:
Observable.reduce(Object, Func2)

scan

public 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.

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.

Parameters:
accumulator - an accumulator function to be invoked on each item emitted by the source Observable, whose result will be emitted to Observers via onNext and used in the next accumulator call.
Returns:
an Observable that emits the results of each call to the accumulator function
See Also:
MSDN: Observable.Scan

sample

public 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.

Parameters:
period - the sampling rate
unit - the TimeUnit in which period is defined
Returns:
an Observable that emits the results of sampling the items emitted by the source Observable at the specified time interval

sample

public 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.

Parameters:
period - the sampling rate
unit - the TimeUnit in which period is defined
scheduler - the Scheduler to use when sampling
Returns:
an Observable that emits the results of sampling the items emitted by the source Observable at the specified time interval

scan

public <R> Observable<R> 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.

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.

Parameters:
initialValue - the initial (seed) accumulator value
accumulator - an accumulator function to be invoked on each item emitted by the source Observable, whose result will be emitted to Observers via onNext and used in the next accumulator call.
Returns:
an Observable that emits the results of each call to the accumulator function
See Also:
MSDN: Observable.Scan

all

public 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.

Parameters:
predicate - a function that evaluates an item and returns a Boolean
Returns:
an Observable that emits true if all items emitted by the source Observable satisfy the predicate; otherwise, false

skip

public Observable<T> skip(int num)
Returns an Observable that skips the first 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.

Parameters:
num - the number of items to skip
Returns:
an Observable that is identical to the source Observable except that it does not emit the first num items that the source emits

first

public Observable<T> first()
Returns an Observable that emits only the very first item emitted by the source Observable.

Returns:
an Observable that emits only the very first item from the source, or none if the source Observable completes without emitting a single item.
See Also:
MSDN: Observable.First

first

public 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.

Parameters:
predicate - The condition any source emitted item has to satisfy.
Returns:
an Observable that emits only the very first item satisfying the given condition from the source, or none if the source Observable completes without emitting a single matching item.
See Also:
MSDN: Observable.First

firstOrDefault

public Observable<T> firstOrDefault(T defaultValue)
Returns an Observable that emits only the very first item emitted by the source Observable, or a default value.

Parameters:
defaultValue - The default value to emit if the source Observable doesn't emit anything.
Returns:
an Observable that emits only the very first item from the source, or a default value if the source Observable completes without emitting a single item.
See Also:
MSDN: Observable.FirstOrDefault

firstOrDefault

public 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.

Parameters:
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.
Returns:
an Observable that emits only the very first item from the source that satisfies the given condition, or a default value otherwise.
See Also:
MSDN: Observable.FirstOrDefault

defaultIfEmpty

public 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.

Parameters:
defaultValue - The value to return if the sequence is empty.
Returns:
An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
See Also:
MSDN: Observable.DefaultIfEmpty

take

public Observable<T> take(int num)
Returns an Observable that emits only the first 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.

Parameters:
num - the number of items to take
Returns:
an Observable that emits only the first num items from the source Observable, or all of the items from the source Observable if that Observable emits fewer than num items

takeWhile

public 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.

Parameters:
predicate - a function that evaluates an item emitted by the source Observable and returns a Boolean
Returns:
an Observable that emits the items from the source Observable so long as each item satisfies the condition defined by predicate

takeWhileWithIndex

public 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.

Parameters:
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
Returns:
an Observable that emits items from the source Observable so long as the predicate continues to return true for each item, then completes

takeFirst

public Observable<T> takeFirst()
Returns an Observable that emits only the very first item emitted by the source Observable.

Returns:
an Observable that emits only the very first item from the source, or none if the source Observable completes without emitting a single item.
See Also:
MSDN: Observable.First, Observable.first()

takeFirst

public 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.

Parameters:
predicate - The condition any source emitted item has to satisfy.
Returns:
an Observable that emits only the very first item satisfying the given condition from the source, or none if the source Observable completes without emitting a single matching item.
See Also:
MSDN: Observable.First, Observable.first(Func1)

takeLast

public Observable<T> takeLast(int count)
Returns an Observable that emits only the last count items emitted by the source Observable.

Parameters:
count - the number of items to emit from the end of the sequence emitted by the source Observable
Returns:
an Observable that emits only the last count items emitted by the source Observable

takeUntil

public <E> Observable<T> takeUntil(Observable<? extends E> other)
Returns an Observable that emits the items from the source Observable only until the other Observable emits an item.

Type Parameters:
E - the type of items emitted by other
Parameters:
other - the Observable whose first emitted item will cause takeUntil to stop emitting items from the source Observable
Returns:
an Observable that emits the items of the source Observable until such time as other emits its first item

skipWhileWithIndex

public 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. Emits all further source items as soon as the condition becomes false.

Parameters:
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.
Returns:
an Observable that emits all items from the source Observable as soon as the condition becomes false.
See Also:
MSDN: Observable.SkipWhile

skipWhile

public 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. Emits all further source items as soon as the condition becomes false.

Parameters:
predicate - A function to test each item emitted from the source Observable for a condition.
Returns:
an Observable that emits all items from the source Observable as soon as the condition becomes false.
See Also:
MSDN: Observable.SkipWhile

skipLast

public Observable<T> skipLast(int count)
Bypasses a specified number of elements at the end of an observable sequence.

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.

Parameters:
count - number of elements to bypass at the end of the source sequence.
Returns:
An observable sequence containing the source sequence elements except for the bypassed ones at the end.
Throws:
java.lang.IndexOutOfBoundsException - count is less than zero.
See Also:
MSDN: Observable.SkipLast

toList

public 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.

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

Returns:
an Observable that emits a single item: a List containing all of the items emitted by the source Observable.

toSortedList

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

Returns:
an Observable that emits the items from the source Observable in sorted order
Throws:
java.lang.ClassCastException - if any item emitted by the Observable does not implement Comparable with respect to all other items emitted by the Observable

toSortedList

public 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

Parameters:
sortFunction - a function that compares two items emitted by the source Observable and returns an Integer that indicates their sort order
Returns:
an Observable that emits the items from the source Observable in sorted order

startWith

public Observable<T> startWith(java.lang.Iterable<T> values)
Emit a specified set of items before beginning to emit items from the source Observable.

Parameters:
values - Iterable of the items you want the modified Observable to emit first
Returns:
an Observable that exhibits the modified behavior

startWith

public Observable<T> startWith(T t1)
Emit a specified set of items before beginning to emit items from the source Observable.

Parameters:
t1 - item to include
Returns:
an Observable that exhibits the modified behavior

startWith

public Observable<T> startWith(T t1,
                               T t2)
Emit a specified set of items before beginning to emit items from the source Observable.

Parameters:
t1 - item to include
t2 - item to include
Returns:
an Observable that exhibits the modified behavior

startWith

public Observable<T> startWith(T t1,
                               T t2,
                               T t3)
Emit a specified set of items before beginning to emit items from the source Observable.

Parameters:
t1 - item to include
t2 - item to include
t3 - item to include
Returns:
an Observable that exhibits the modified behavior

startWith

public 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.

Parameters:
t1 - item to include
t2 - item to include
t3 - item to include
t4 - item to include
Returns:
an Observable that exhibits the modified behavior

startWith

public 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.

Parameters:
t1 - item to include
t2 - item to include
t3 - item to include
t4 - item to include
t5 - item to include
Returns:
an Observable that exhibits the modified behavior

startWith

public 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.

Parameters:
t1 - item to include
t2 - item to include
t3 - item to include
t4 - item to include
t5 - item to include
t6 - item to include
Returns:
an Observable that exhibits the modified behavior

startWith

public 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.

Parameters:
t1 - item to include
t2 - item to include
t3 - item to include
t4 - item to include
t5 - item to include
t6 - item to include
t7 - item to include
Returns:
an Observable that exhibits the modified behavior

startWith

public 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.

Parameters:
t1 - item to include
t2 - item to include
t3 - item to include
t4 - item to include
t5 - item to include
t6 - item to include
t7 - item to include
t8 - item to include
Returns:
an Observable that exhibits the modified behavior

startWith

public 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.

Parameters:
t1 - item to include
t2 - item to include
t3 - item to include
t4 - item to include
t5 - item to include
t6 - item to include
t7 - item to include
t8 - item to include
t9 - item to include
Returns:
an Observable that exhibits the modified behavior

groupBy

public <K,R> Observable<GroupedObservable<K,R>> 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 GroupedObservables, one GroupedObservable per group.

Type Parameters:
K - the key type
R - the type of items emitted by the resulting GroupedObservables
Parameters:
keySelector - a function that extracts the key from an item
elementSelector - a function to map a source item to an item in a GroupedObservable
Returns:
an Observable that emits GroupedObservables, each of which corresponds to a unique key value and emits items representing items from the source Observable that share that key value

groupBy

public <K> Observable<GroupedObservable<K,T>> 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 GroupedObservables, one GroupedObservable per group.

Type Parameters:
K - the key type
Parameters:
keySelector - a function that extracts the key for each item
Returns:
an Observable that emits GroupedObservables, each of which corresponds to a unique key value and emits items representing items from the source Observable that share that key value

isEmpty

public Observable<java.lang.Boolean> isEmpty()
Returns an 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.

Returns:
An Observable that emits Boolean.
See Also:
MSDN: Observable.Any

last

public Observable<T> last()
Returns an Observable that emits the last element of the source or an IllegalArgumentException if the source Observable is empty.

Returns:
Observable

toBlockingObservable

public BlockingObservable<T> toBlockingObservable()
Converts an Observable into a BlockingObservable (an Observable with blocking operators).

See Also:
Blocking Observable Operators

cast

public <R> Observable<R> cast(java.lang.Class<R> klass)
Converts the elements of an observable sequence to the specified type.

Parameters:
klass - The target class type which the elements will be converted to.
Returns:
An observable sequence that contains each element of the source sequence converted to the specified type.
See Also:
MSDN: Observable.Cast

ofType

public <R> Observable<R> ofType(java.lang.Class<R> klass)
Filters the elements of an observable sequence based on the specified type.

Parameters:
klass - The class type to filter the elements in the source sequence on.
Returns:
An observable sequence that contains elements from the input sequence of type klass.
See Also:
MSDN: Observable.OfType

ignoreElements

public Observable<T> ignoreElements()
Ignores all values in an observable sequence and only calls onCompleted or onError method.

Returns:
An empty observable sequence that only call onCompleted, or onError method.
See Also:
MSDN: Observable.IgnoreElements

timeout

public 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. If the next element isn't received within the specified timeout duration starting from its predecessor, a TimeoutException is propagated to the observer.

Parameters:
timeout - Maximum duration between values before a timeout occurs.
timeUnit - The unit of time which applies to the "timeout" argument.
Returns:
The source sequence with a TimeoutException in case of a timeout.
See Also:
MSDN: Observable.Timeout

timeout

public 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. If the next element isn't received within the specified timeout duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.

Parameters:
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.
Returns:
The source sequence switching to the other sequence in case of a timeout.
See Also:
MSDN: Observable.Timeout

timeout

public 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. If the next element isn't received within the specified timeout duration starting from its predecessor, a TimeoutException is propagated to the observer.

Parameters:
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.
Returns:
The source sequence with a TimeoutException in case of a timeout.
See Also:
MSDN: Observable.Timeout

timeout

public 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. If the next element isn't received within the specified timeout duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.

Parameters:
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.
Returns:
The source sequence switching to the other sequence in case of a timeout.
See Also:
MSDN: Observable.Timeout

timeInterval

public Observable<TimeInterval<T>> timeInterval()
Records the time interval between consecutive elements in an observable sequence.

Returns:
An observable sequence with time interval information on elements.
See Also:
MSDN: Observable.TimeInterval

timeInterval

public 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.

Parameters:
scheduler - Scheduler used to compute time intervals.
Returns:
An observable sequence with time interval information on elements.
See Also:
MSDN: Observable.TimeInterval

using

public static <T,RESOURCE extends Subscription> Observable<T> using(Func0<RESOURCE> resourceFactory,
                                                                    Func1<RESOURCE,Observable<T>> observableFactory)
Constructs an observable sequence that depends on a resource object.

Parameters:
resourceFactory - The factory function to obtain a resource object.
observableFactory - The factory function to obtain an observable sequence that depends on the obtained resource.
Returns:
The observable sequence whose lifetime controls the lifetime of the dependent resource object.
See Also:
MSDN: Observable.Using

amb

public static <T> Observable<T> amb(Observable<? extends T> o1,
                                    Observable<? extends T> o2)
Propagates the observable sequence that reacts first.

Parameters:
o1 - an observable competing to react first.
o2 - an observable competing to react first.
Returns:
an observable sequence that surfaces any of the given sequences, whichever reacted first.
See Also:
MSDN: Observable.Amb

amb

public static <T> Observable<T> amb(Observable<? extends T> o1,
                                    Observable<? extends T> o2,
                                    Observable<? extends T> o3)
Propagates the observable sequence that reacts first.

Parameters:
o1 - an observable competing to react first.
o2 - an observable competing to react first.
o3 - an observable competing to react first.
Returns:
an observable sequence that surfaces any of the given sequences, whichever reacted first.
See Also:
MSDN: Observable.Amb

amb

public static <T> Observable<T> amb(Observable<? extends T> o1,
                                    Observable<? extends T> o2,
                                    Observable<? extends T> o3,
                                    Observable<? extends T> o4)
Propagates the observable sequence that reacts first.

Parameters:
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.
Returns:
an observable sequence that surfaces any of the given sequences, whichever reacted first.
See Also:
MSDN: Observable.Amb

amb

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)
Propagates the observable sequence that reacts first.

Parameters:
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.
Returns:
an observable sequence that surfaces any of the given sequences, whichever reacted first.
See Also:
MSDN: Observable.Amb

amb

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)
Propagates the observable sequence that reacts first.

Parameters:
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.
Returns:
an observable sequence that surfaces any of the given sequences, whichever reacted first.
See Also:
MSDN: Observable.Amb

amb

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)
Propagates the observable sequence that reacts first.

Parameters:
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.
Returns:
an observable sequence that surfaces any of the given sequences, whichever reacted first.
See Also:
MSDN: Observable.Amb

amb

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)
Propagates the observable sequence that reacts first.

Parameters:
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.
Returns:
an observable sequence that surfaces any of the given sequences, whichever reacted first.
See Also:
MSDN: Observable.Amb

amb

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)
Propagates the observable sequence that reacts first.

Parameters:
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.
Returns:
an observable sequence that surfaces any of the given sequences, whichever reacted first.
See Also:
MSDN: Observable.Amb

amb

public static <T> Observable<T> amb(java.lang.Iterable<? extends Observable<? extends T>> sources)
Propagates the observable sequence that reacts first.

Parameters:
sources - observable sources competing to react first.
Returns:
an observable sequence that surfaces any of the given sequences, whichever reacted first.
See Also:
MSDN: Observable.Amb

doOnEach

public Observable<T> doOnEach(Observer<? super T> observer)
Invokes an action for each element in the observable sequence.

Parameters:
observer - The action to invoke for each element in the source sequence.
Returns:
The source sequence with the side-effecting behavior applied.
See Also:
MSDN: Observable.Do

doOnEach

public Observable<T> doOnEach(Action1<T> onNext)
Invokes an action for each element in the observable sequence.

Parameters:
onNext - The action to invoke for each element in the source sequence.
Returns:
The source sequence with the side-effecting behavior applied.
See Also:
MSDN: Observable.Do

doOnEach

public Observable<T> doOnEach(Action1<T> onNext,
                              Action0 onCompleted)
Invokes an action for each element in the observable sequence.

Parameters:
onNext - The action to invoke for each element in the source sequence.
onCompleted - The action to invoke when the source sequence is completed.
Returns:
The source sequence with the side-effecting behavior applied.
See Also:
MSDN: Observable.Do

doOnEach

public Observable<T> doOnEach(Action1<T> onNext,
                              Action1<java.lang.Throwable> onError)
Invokes an action for each element in the observable sequence.

Parameters:
onNext - The action to invoke for each element in the source sequence.
onError - The action to invoke when the source sequence calls onError.
Returns:
The source sequence with the side-effecting behavior applied.
See Also:
MSDN: Observable.Do

doOnEach

public Observable<T> doOnEach(Action1<T> onNext,
                              Action1<java.lang.Throwable> onError,
                              Action0 onCompleted)
Invokes an action for each element in the observable sequence.

Parameters:
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.
Returns:
The source sequence with the side-effecting behavior applied.
See Also:
MSDN: Observable.Do