public final class Reactive
extends java.lang.Object
Observables and Observers.
Guidances were taken from
Interactive| Modifier and Type | Class and Description |
|---|---|
static class |
Reactive.ObserverState
The diagnostic states of the current runnable.
|
| Modifier and Type | Method and Description |
|---|---|
static CloseableObservable<java.lang.Long> |
activeTick(long start,
long end,
long time,
java.util.concurrent.TimeUnit unit)
Schedules an active tick timer on the specified scheduler to which
observers can register or deregister getting the current tick values.
|
static CloseableObservable<java.lang.Long> |
activeTick(long start,
long end,
long time,
java.util.concurrent.TimeUnit unit,
Scheduler scheduler)
Schedules an active tick timer on the specified scheduler to which
observers can register or deregister getting the current tick values.
|
static <T> Observable<TimeInterval<T>> |
addTimeInterval(Observable<? extends T> source)
Returns an observable which provides a TimeInterval of Ts which
records the elapsed time between successive elements.
|
static <T> Observable<Timestamped<T>> |
addTimestamped(Observable<? extends T> source)
Wrap the values within a observable to a timestamped value having always
the System.currentTimeMillis() value.
|
static <T> Observable<T> |
aggregate(Observable<? extends T> source,
Func2<? super T,? super T,? extends T> accumulator)
Apply an accumulator function over the observable source
and submit the accumulated value to the returned observable at each incoming value.
|
static <T,U,V> Observable<V> |
aggregate(Observable<? extends T> source,
Func2<? super U,? super T,? extends U> accumulator,
Func2<? super U,? super java.lang.Integer,? extends V> divide)
Computes an aggregated value of the source Ts by applying a sum function and applying the divide function when the source
finishes, sending the result to the output.
|
static <T,U> Observable<U> |
aggregate(Observable<? extends T> source,
U seed,
Func2<? super U,? super T,? extends U> accumulator)
Apply an accumulator function over the observable source and submit the accumulated value to the returned observable.
|
static <T,U,V> Observable<V> |
aggregate(Observable<? extends T> source,
U seed,
Func2<? super U,? super T,? extends U> accumulator,
Func1<? super U,? extends V> resultSelector)
Aggregates the incoming sequence via the accumulator function
and transforms the result value with the selector.
|
static <T,U,V> Observable<V> |
aggregate(Observable<? extends T> source,
U seed,
Func2<? super U,? super T,? extends U> accumulator,
Func2<? super U,? super java.lang.Integer,? extends V> divide)
Computes an aggregated value of the source Ts by applying a
sum function and applying the divide function when the source
finishes, sending the result to the output.
|
static <T> Observable<java.lang.Boolean> |
all(Observable<? extends T> source,
Func1<? super T,java.lang.Boolean> predicate)
Signals a single true or false if all elements of the observable match the predicate.
|
static <T> Observable<T> |
amb(java.lang.Iterable<? extends Observable<? extends T>> sources)
Channels the values of the first observable who
fires first from the given set of observables.
|
static <T> Observable<T> |
amb(Observable<? extends T>... sources)
Channels the values of the first observable who
fires first from the given set of observables.
|
static <T> Observable<T> |
amb(Observable<? extends T> left,
Observable<? extends T> right)
Channels the values of either left or right depending on who fired its first value.
|
static <T> Observable<java.lang.Boolean> |
any(Observable<T> source)
Signals a single true if the source observable contains any element.
|
static <T> Observable<java.lang.Boolean> |
any(Observable<T> source,
Func1<? super T,java.lang.Boolean> predicate)
Signals a single TRUE if the source ever signals next() and any of
the values matches the predicate before it signals a finish(), and deregisters
from the source.
|
static Observable<java.math.BigDecimal> |
averageBigDecimal(Observable<java.math.BigDecimal> source)
Computes and signals the average value of the BigDecimal source.
|
static Observable<java.math.BigDecimal> |
averageBigInteger(Observable<java.math.BigInteger> source)
Computes and signals the average value of the BigInteger source.
|
static Observable<java.lang.Double> |
averageDouble(Observable<java.lang.Double> source)
Computes and signals the average value of the Double source.
|
static Observable<java.lang.Float> |
averageFloat(Observable<java.lang.Float> source)
Computes and signals the average value of the Float source.
|
static Observable<java.lang.Double> |
averageInt(Observable<java.lang.Integer> source)
Computes and signals the average value of the integer source.
|
static Observable<java.lang.Double> |
averageLong(Observable<java.lang.Long> source)
Computes and signals the average value of the Long source.
|
static <T> T |
await(Observable<? extends T> source)
Waits indefinitely for the observable to complete and returns the last
value.
|
static <T> T |
await(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit)
Waits a limited amount of time for the observable to complete and returns the last
value.
|
static <T,U> Observable<java.util.List<T>> |
buffer(Observable<? extends T> source,
Func0<? extends Observable<U>> bufferCloseSelector)
Buffer parts of the source until the window observable finishes.
|
static <T> Observable<java.util.List<T>> |
buffer(Observable<? extends T> source,
int bufferSize)
Buffer the nodes as they become available and send them out in bufferSize chunks.
|
static <T> Observable<java.util.List<T>> |
buffer(Observable<? extends T> source,
int bufferSize,
int skip)
Project the source sequence to
potentially overlapping buffers whose
start is determined by skip and lengths
by size.
|
static <T> Observable<java.util.List<T>> |
buffer(Observable<? extends T> source,
int bufferSize,
long time,
java.util.concurrent.TimeUnit unit)
Buffer the Ts of the source until the buffer reaches its capacity or the current time unit runs out.
|
static <T> Observable<java.util.List<T>> |
buffer(Observable<? extends T> source,
int bufferSize,
long time,
java.util.concurrent.TimeUnit unit,
Scheduler pool)
Buffer the Ts of the source until the buffer reaches its capacity or the current time unit runs out.
|
static <T> Observable<java.util.List<T>> |
buffer(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit)
Buffers the source observable Ts into a list of Ts periodically and submits them to the returned observable.
|
static <T> Observable<java.util.List<T>> |
buffer(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit,
Scheduler pool)
Buffers the source observable Ts into a list of Ts periodically and submits them to the returned observable.
|
static <T,U,V> Observable<java.util.List<T>> |
buffer(Observable<? extends T> source,
Observable<? extends U> windowOpening,
Func1<? super U,? extends Observable<V>> windowClosing)
Projects the incoming values into multiple buffers based on
when a window-open fires an event and a window-close finishes.
|
static <T,U> Observable<java.util.List<T>> |
buffer(Observable<? extends T> source,
Observable<U> boundary)
Buffers the source elements into non-overlapping lists separated
by notification values from the boundary observable and its finish event.
|
static <T> Observable<T> |
cast(Observable<?> source)
Casts the values of the source sequence into the target type.
|
static <T> Observable<T> |
cast(Observable<?> source,
java.lang.Class<T> token)
Casts the values of the source sequence into the
given type via the type token.
|
static <T> CloseableIterable<java.util.List<T>> |
chunkify(Observable<? extends T> source)
Produces an iterable sequence of consequtive (possibly empty)
chunks of the source sequence.
|
static <T,U> CloseableIterable<U> |
collect(Observable<? extends T> source,
Func0<? extends U> newCollector,
Func2<? super U,? super T,? extends U> merge)
Produces an enumerable sequence that returns elements
collected/aggregated/whatever from the source
between consequtive iterations.
|
static <T,U> CloseableIterable<U> |
collect(Observable<? extends T> source,
Func0<? extends U> initialCollector,
Func2<? super U,? super T,? extends U> merge,
Func1<? super U,? extends U> newCollector)
Produces an iterable sequence that returns elements
collected/aggregated/whatever from the source
sequence between consequtive iteration.
|
static <T> Observable<java.util.List<T>> |
combine(Func0<? extends T> supplier,
Observable<? extends T> src)
Combine a value supplied by the function with a stream of Ts whenever the src fires.
|
static <T,U,V> Observable<V> |
combineLatest(Observable<? extends T> left,
Observable<? extends U> right,
Func2<? super T,? super U,? extends V> selector)
Returns an observable which combines the latest values of
both streams whenever one sends a new value, but only after both sent a value.
|
static <T,U,V> Observable<V> |
combineLatest0(Observable<? extends T> left,
Observable<? extends U> right,
Func2<? super T,? super U,? extends V> selector)
Returns an observable which combines the latest values of
both streams whenever one sends a new value.
|
static <T,U> Observable<U> |
concat(Func1<? super T,? extends Observable<? extends U>> resultSelector,
T... source)
Concatenates the observable sequences resulting from enumerating
the sorce iterable and calling the resultSelector function.
|
static <T,U> Observable<U> |
concat(Func2<? super T,? super java.lang.Integer,? extends Observable<? extends U>> resultSelector,
T... source)
Concatenates the observable sequences resulting from enumerating
the sorce iterable and calling the indexed resultSelector function.
|
static <T> Observable<T> |
concat(java.lang.Iterable<? extends Observable<? extends T>> sources)
Concatenates the source observables in a way that when the first finish(), the
second gets registered and continued, and so on.
|
static <T,U> Observable<U> |
concat(java.lang.Iterable<? extends T> source,
Func1<? super T,? extends Observable<? extends U>> resultSelector)
Concatenates the observable sequences resulting from enumerating
the sorce iterable and calling the resultSelector function.
|
static <T,U> Observable<U> |
concat(java.lang.Iterable<? extends T> source,
Func2<? super T,? super java.lang.Integer,? extends Observable<? extends U>> resultSelector)
Concatenates the observable sequences resulting from enumerating
the sorce iterable and calling the indexed resultSelector function.
|
static <T> Observable<T> |
concat(Observable<? extends Observable<? extends T>> sources)
Concatenate the the multiple sources of T one after another.
|
static <T,U> Observable<U> |
concat(Observable<? extends Observable<? extends T>> sources,
Func1<? super Observable<? extends T>,? extends Observable<? extends U>> resultSelector)
Concatenate the the multiple sources of T one after another.
|
static <T,U> Observable<U> |
concat(Observable<? extends Observable<? extends T>> sources,
Func2<? super Observable<? extends T>,? super java.lang.Integer,? extends Observable<? extends U>> resultSelector)
Concatenate the the multiple sources of T one after another.
|
static <T> Observable<T> |
concat(Observable<? extends T>... sources)
Concatenates the source observables in a way that
when the first finish(), the
second gets registered and continued, and so on.
|
static <T> Observable<T> |
concat(Observable<? extends T> first,
Observable<? extends T> second)
Concatenate two observables in a way when the first finish() the second is registered
and continued with.
|
static <T> Observable<java.lang.Boolean> |
contains(Observable<? extends T> source,
Func0<? extends T> supplier)
Signals a single TRUE if the source observable signals a value equals() with
the supplied value.
|
static <T> Observable<java.lang.Boolean> |
contains(Observable<? extends T> source,
T value)
Signals a single TRUE if the source observable signals a value equals() with the source value.
|
static <T> Observable<java.lang.Integer> |
count(Observable<? extends T> source,
Func1<? super T,java.lang.Boolean> predicate)
Counts the number of elements where the predicate returns true.
|
static <T> Observable<java.lang.Integer> |
count(Observable<T> source)
Counts the number of elements in the observable source.
|
static <T> Observable<java.lang.Long> |
countLong(Observable<? extends T> source,
Func1<? super T,java.lang.Boolean> predicate)
Counts the number of elements where the predicate returns true as long.
|
static <T> Observable<java.lang.Long> |
countLong(Observable<T> source)
Counts the number of elements in the observable source as a long.
|
static <T> Observable<T> |
debugState(Observable<? extends T> source)
Constructs an observer which logs errors in case next(), finish() or error() is called
and the observer is not in running state anymore due an earlier finish() or error() call.
|
static <T> Observable<T> |
defaultIfEmpty(Observable<? extends T> source,
Func0<? extends T> defaultValueFunc)
Returns the default value provided by
the function if the source sequence is empty.
|
static <T> Observable<T> |
defaultIfEmpty(Observable<? extends T> source,
T defaultValue)
Returns the default value if the source
sequence is empty.
|
static <T> Observable<T> |
defer(Func0<? extends Observable<? extends T>> observableFactory)
The returned observable invokes the
observableFactory whenever an observer
tries to register with it. |
static <T,U> Observable<T> |
delay(Observable<? extends T> source,
Func1<? super T,? extends Observable<U>> delaySelector)
Delays (ties) the event delivery of the source,
for each source value T, to the firing of the observable returned
by the delay selector.
|
static <T> Observable<T> |
delay(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit)
Delays the propagation of events of the source by the given amount.
|
static <T> Observable<T> |
delay(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit,
Scheduler pool)
Delays the propagation of events of the source by the given amount.
|
static <T,U,V> Observable<T> |
delay(Observable<? extends T> source,
Observable<U> registerDelay,
Func1<? super T,? extends Observable<V>> delaySelector)
Delays (ties) the event delivery of the source
to the firing of registerDelay (optionally) and
for each source value T, to the firing of the observable returned
by the delay selector.
|
static <T> Observable<T> |
delayRegister(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit)
Delays the registration to the underlying observable by
a given amount.
|
static <T> Observable<T> |
delayRegister(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit,
Scheduler pool)
Delays the registration to the underlying observable by
a given amount.
|
static <T> Observable<T> |
dematerialize(Observable<? extends Option<T>> source)
Returns an observable which converts all option messages
back to regular next(), error() and finish() messages.
|
static <T> void |
dispatch(Observer<? super T> observer,
Option<T> value)
Dispatches the option to the various Observer methods.
|
static <T> Observable<T> |
distinct(Observable<? extends T> source)
Returns the distinct elements from the source.
|
static <T,U> Observable<T> |
distinct(Observable<? extends T> source,
Func1<? super T,? extends U> keyExtractor)
Returns a sequence of elements distinct in
terms of the key extracted from them.
|
static <T,U> Observable<T> |
distinct(Observable<? extends T> source,
Func1<? super T,? extends U> keyExtractor,
Func2<? super U,? super U,java.lang.Boolean> keyComparer)
Returns a sequence of elements who are distinct
in terms of the given key extracted by a function
and compared against each other via the comparer function.
|
static <T> Observable<T> |
distinct(Observable<? extends T> source,
Func2<? super T,? super T,java.lang.Boolean> comparer)
Returns the distinct elements from the source according
to the given comparator function.
|
static <T> Observable<T> |
doWhile(Observable<? extends T> source,
Func0<java.lang.Boolean> condition)
Repeats the given source so long as the condition returns true.
|
static <T> Observable<java.lang.Void> |
drain(Observable<? extends T> source,
Func1<? super T,? extends Observable<java.lang.Void>> pump)
Maintains a queue of Ts which is then drained by the pump.
|
static <T> Observable<java.lang.Void> |
drain(Observable<? extends T> source,
Func1<? super T,? extends Observable<java.lang.Void>> pump,
Scheduler pool)
Maintains a queue of Ts which is then drained by the pump.
|
static <T> Observable<T> |
elementAt(Observable<? extends T> source,
int index)
Returns a single element from the sequence at the index or throws
a NoSuchElementException if the sequence terminates before this index.
|
static <T> Observable<T> |
elementAt(Observable<? extends T> source,
int index,
Func0<? extends T> defaultSupplier)
Returns a single element from the sequence at the index or the
default value supplied if the sequence terminates before this index.
|
static <T> Observable<T> |
elementAt(Observable<? extends T> source,
int index,
T defaultValue)
Returns a single element from the sequence at the index or the
default value if the sequence terminates before this index.
|
static <T> Observable<T> |
empty() |
static <T> Observable<T> |
empty(Scheduler pool)
Returns an empty observable which signals only finish() on the given pool.
|
static <T> Observable<T> |
finish(Observable<? extends T> source,
Action0 action)
Invokes the given action when the source signals a finish() or error().
|
static <T> T |
first(Observable<? extends T> source)
Blocks until the first element of the observable becomes available and returns that element.
|
static <T> T |
first(Observable<? extends T> source,
Func0<? extends T> defaultSupplier)
Returns the first element of the source observable or
the supplier's value if the source is empty, blocking if necessary.
|
static <T> T |
first(Observable<? extends T> source,
T defaultValue)
Returns the first element of the source observable or
the defaultValue if the source is empty, blocking if necessary.
|
static <T> Observable<T> |
firstAsync(Observable<? extends T> source)
Returns an observable which takes the first value from the source observable
as a single element or throws NoSuchElementException if the source is empty.
|
static <T> Observable<T> |
firstAsync(Observable<? extends T> source,
Func0<? extends T> defaultSupplier)
Returns an observable which takes the first value from the source observable
as a single element or the supplier's value if the source is empty.
|
static <T> Observable<T> |
firstAsync(Observable<? extends T> source,
T defaultValue)
Returns an observable which takes the first value from the source observable
as a single element or the default value if the source is empty.
|
static <T> void |
forEach(Observable<T> source,
Action1<? super T> action)
Invokes the action on each element in the source,
and blocks until the source terminates either way.
|
static <T> boolean |
forEach(Observable<T> source,
Action1<? super T> action,
long time,
java.util.concurrent.TimeUnit unit)
Invokes the action on each element in the source,
and blocks until the source terminates or the time runs out.
|
static <T> void |
forEach(Observable<T> source,
Action2<? super T,? super java.lang.Integer> action)
Invokes the indexed action on each element in the source,
and blocks until the source terminates either way.
|
static <T> boolean |
forEach(Observable<T> source,
Action2<? super T,? super java.lang.Integer> action,
long time,
java.util.concurrent.TimeUnit unit)
Invokes the indexed action on each element in the source,
and blocks until the source terminates either way.
|
static <T> Observable<java.util.List<T>> |
forkJoin(java.lang.Iterable<? extends Observable<? extends T>> sources)
Runs the observables in parallel and joins their last values whenever one fires.
|
static <T> Observable<java.util.List<T>> |
forkJoin(Observable<? extends T>... sources)
Runs the observables in parallel and joins their
last values whenever one fires.
|
static <T,U> Observable<U> |
generate(T initial,
Func1<? super T,java.lang.Boolean> condition,
Func1<? super T,? extends T> next,
Func1<? super T,? extends U> selector)
Generates a stream of Us by using a value T stream using the default pool for the generator loop.
|
static <T,U> Observable<U> |
generate(T initial,
Func1<? super T,java.lang.Boolean> condition,
Func1<? super T,? extends T> next,
Func1<? super T,? extends U> selector,
Scheduler pool)
Generates a stream of Us by using a value T stream.
|
static <T,U> Observable<Timestamped<U>> |
generateTimed(T initial,
Func1<? super T,java.lang.Boolean> condition,
Func1<? super T,? extends T> next,
Func1<? super T,? extends U> selector,
Func1<? super T,java.lang.Long> delay)
Generates a stream of Us by using a value T stream.
|
static <T,U> Observable<Timestamped<U>> |
generateTimed(T initial,
Func1<? super T,java.lang.Boolean> condition,
Func1<? super T,? extends T> next,
Func1<? super T,? extends U> selector,
Func1<? super T,java.lang.Long> delay,
Scheduler pool)
Generates a dynamically timed stream of Us by using a value T stream.
|
static <T,U> Observable<Timestamped<U>> |
generateTimedWithUnit(T initial,
Func1<? super T,java.lang.Boolean> condition,
Func1<? super T,? extends T> next,
Func1<? super T,? extends U> selector,
Func1<? super T,Pair<java.lang.Long,java.util.concurrent.TimeUnit>> delay,
Scheduler pool)
Generates a dynamically timed stream of Us by using a value T stream.
|
static <T,Key> Observable<GroupedObservable<Key,T>> |
groupBy(Observable<? extends T> source,
Func1<? super T,? extends Key> keyExtractor)
Group the specified source according to the keys provided by the extractor function.
|
static <T,U,Key> Observable<GroupedObservable<Key,U>> |
groupBy(Observable<? extends T> source,
Func1<? super T,? extends Key> keyExtractor,
Func1<? super T,? extends U> valueExtractor)
Group the specified source according to the keys provided by the extractor function.
|
static <T,Key> Observable<GroupedObservable<Key,T>> |
groupBy(Observable<? extends T> source,
Func1<? super T,? extends Key> keyExtractor,
Func2<? super Key,? super Key,java.lang.Boolean> keyComparer)
Group the specified source according to the keys provided by the extractor function.
|
static <T,U,Key> Observable<GroupedObservable<Key,U>> |
groupBy(Observable<? extends T> source,
Func1<? super T,? extends Key> keyExtractor,
Func2<? super Key,? super Key,java.lang.Boolean> keyComparer,
Func1<? super T,? extends U> valueExtractor)
Group the specified source according to the keys provided by the extractor function.
|
static <T,K,D> Observable<GroupedObservable<K,T>> |
groupByUntil(Observable<? extends T> source,
Func1<? super T,? extends K> keySelector,
Func1<? super GroupedObservable<K,T>,? extends Observable<D>> durationSelector)
Groups the source sequence of Ts until the specified duration for that group fires.
|
static <T,K,D> Observable<GroupedObservable<K,T>> |
groupByUntil(Observable<? extends T> source,
Func1<? super T,? extends K> keySelector,
Func1<? super GroupedObservable<K,T>,? extends Observable<D>> durationSelector,
Func2<? super K,? super K,java.lang.Boolean> keyComparer)
Groups the source sequence of Ts until the specified duration for that group fires.
|
static <T,K,V,D> Observable<GroupedObservable<K,V>> |
groupByUntil(Observable<? extends T> source,
Func1<? super T,? extends K> keySelector,
Func1<? super T,? extends V> valueSelector,
Func1<? super GroupedObservable<K,V>,? extends Observable<D>> durationSelector)
Groups the source sequence of Ts until the specified duration for that group fires.
|
static <T,K,V,D> Observable<GroupedObservable<K,V>> |
groupByUntil(Observable<? extends T> source,
Func1<? super T,? extends K> keySelector,
Func1<? super T,? extends V> valueSelector,
Func1<? super GroupedObservable<K,V>,? extends Observable<D>> durationSelector,
Func2<? super K,? super K,java.lang.Boolean> keyComparer)
Groups the source sequence of Ts until the specified duration for that group fires.
|
static <Left,Right,LeftDuration,RightDuration,Result> |
groupJoin(Observable<? extends Left> left,
Observable<? extends Right> right,
Func1<? super Left,? extends Observable<LeftDuration>> leftDurationSelector,
Func1<? super Right,? extends Observable<RightDuration>> rightDurationSelector,
Func2<? super Left,? super Observable<? extends Right>,? extends Result> resultSelector)
Returns an observable which correlates two streams of values based on
their time when they overlapped and groups the results.
|
static <T> Observable<T> |
ifThen(Func0<java.lang.Boolean> condition,
Observable<? extends T> then)
Returns an observable where the submitted condition decides whether
the
then source is allowed to submit values or else
an empty sequence is used. |
static <T> Observable<T> |
ifThen(Func0<java.lang.Boolean> condition,
Observable<? extends T> then,
Observable<? extends T> orElse)
Returns an observable where the submitted condition
decides whether the
then or orElse
source is allowed to submit values. |
static <T> Observable<T> |
ifThen(Func0<java.lang.Boolean> condition,
Observable<? extends T> then,
Scheduler scheduler)
Returns an observable where the submitted condition decides whether
the
then source is allowed to submit values
or else an empty sequence is returned. |
static <T> Observable<T> |
ignoreValues(Observable<? extends T> source)
Ignores the next() messages of the source and forwards only the error() and
finish() messages.
|
static Observable<java.lang.Long> |
intToLong(Observable<java.lang.Integer> source)
Converts a stream of ints into a stream of longs.
|
static <T> Observable<T> |
invoke(Observable<? extends T> source,
Action1<? super T> action)
Invoke a specific action before relaying the Ts to the observable.
|
static <T> Observable<T> |
invoke(Observable<? extends T> source,
Action1<? super T> onNext,
Action0 onFinish)
Invokes the given actions while relaying events.
|
static <T> Observable<T> |
invoke(Observable<? extends T> source,
Action1<? super T> onNext,
Action1<? super java.lang.Throwable> onError)
Invokes the given actions while relaying events.
|
static <T> Observable<T> |
invoke(Observable<? extends T> source,
Action1<? super T> onNext,
Action1<? super java.lang.Throwable> onError,
Action0 onFinish)
Invokes the given actions while relaying events.
|
static <T> Observable<T> |
invoke(Observable<? extends T> source,
Observer<? super T> observer)
Invoke a specific observer before relaying the Ts, finish() and error() to the observable.
|
static <T> java.util.List<java.util.List<T>> |
invokeAll(java.lang.Iterable<? extends Observable<? extends T>> sources)
Observes the source observables in parallel on the default
scheduler and collects their individual
value streams, blocking in the process.
|
static <T> java.util.List<java.util.List<T>> |
invokeAll(java.lang.Iterable<? extends Observable<? extends T>> sources,
Scheduler scheduler)
Observes the source observables in parallel on the given scheduler and collects their individual
values value streams, blocking in the process.
|
static <T> java.util.List<java.util.List<T>> |
invokeAll(Observable<? extends T>... sources)
Observes the source observables in parallel on the default
scheduler and collects their individual
value streams, blocking in the process.
|
static <T> java.util.List<java.util.List<T>> |
invokeAll(Observable<? extends T> source1,
Observable<? extends T> source2)
Observes the source observables in parallel on the default scheduler and collects their individual
values value streams, blocking in the process.
|
static <T> java.util.List<java.util.List<T>> |
invokeAll(Observable<? extends T> source1,
Observable<? extends T> source2,
Scheduler scheduler)
Observes the source observables in parallel on the given scheduler and collects their individual
values value streams, blocking in the process.
|
static <T> Observable<T> |
invokeAsync(java.util.concurrent.Callable<? extends T> call)
Invoke the given callable on the default pool and observe its result via the returned observable.
|
static <T> Observable<T> |
invokeAsync(java.util.concurrent.Callable<? extends T> call,
Scheduler pool)
Invoke the given callable on the given pool and observe its result via the returned observable.
|
static <T> Observable<T> |
invokeAsync(java.lang.Runnable run)
Invoke the given callable on the given pool and observe its result via the returned observable.
|
static <T> Observable<T> |
invokeAsync(java.lang.Runnable run,
Scheduler pool)
Invoke the given callable on the given pool and observe its result via the returned observable.
|
static <T> Observable<T> |
invokeAsync(java.lang.Runnable run,
T defaultValue)
Invoke the given callable on the given pool and observe its result via the returned observable.
|
static <T> Observable<T> |
invokeAsync(java.lang.Runnable run,
T defaultValue,
Scheduler pool)
Invoke the given callable on the given pool and observe its result via the returned observable.
|
static Observable<java.lang.Boolean> |
isEmpty(Observable<?> source)
Signals true if the source observable fires finish() without ever firing next().
|
static <Left,Right,LeftDuration,RightDuration,Result> |
join(Observable<? extends Left> left,
Observable<? extends Right> right,
Func1<? super Left,? extends Observable<LeftDuration>> leftDurationSelector,
Func1<? super Right,? extends Observable<RightDuration>> rightDurationSelector,
Func2<? super Left,? super Right,? extends Result> resultSelector)
Returns an observable which correlates two streams of values based on
their time when they overlapped.
|
static <T> Observable<T> |
just(T value)
Returns the value immediately to the registering observer.
|
static <T> T |
last(Observable<? extends T> source)
Returns the last element of the source observable or throws
NoSuchElementException if the source is empty or the wait is interrupted.
|
static <T> T |
last(Observable<? extends T> source,
Func0<? extends T> defaultSupplier)
Returns the last element of the source observable or the
supplier's value if the source is empty.
|
static <T> T |
last(Observable<? extends T> source,
T defaultValue)
Returns the last element of the source observable or the
default value if the source is empty.
|
static <T> Observable<T> |
lastAsync(Observable<? extends T> source)
Returns an observable which relays the last element of the source observable
or throws a NoSuchElementException() if the source is empty.
|
static <T> Observable<T> |
lastAsync(Observable<? extends T> source,
Func0<? extends T> defaultSupplier)
Returns an observable which relays the last element of the source observable
or the supplier's value if the source is empty.
|
static <T> Observable<T> |
lastAsync(Observable<? extends T> source,
T defaultValue)
Returns an observable which relays the last element of the source observable
or the default value if the source is empty.
|
static <T> CloseableIterable<T> |
latest(Observable<? extends T> source)
Returns an iterable sequence which returns the latest element
from the observable sequence, consuming it only once.
|
static <T,U> Observable<U> |
let(T value,
Func1<? super T,? extends Observable<U>> selector)
Returns an observable which calls the given selector with the given value
when a client wants to register with it.
|
static Observable<java.lang.Integer> |
longToInt(Observable<java.lang.Long> source)
Converts a stream of longs into a stream of ints.
|
static Observable<java.lang.Integer> |
longToInt(Observable<java.lang.Long> source,
boolean overflow)
Converts a stream of longs into a stream of ints.
|
static <T,U> Observable<U> |
manySelect(Observable<? extends T> source,
Func1<? super Observable<T>,? extends Observable<U>> selector)
For each of the source elements, creates a view of the source starting with the given
element and calls the selector function.
|
static <T,U> Observable<U> |
manySelect(Observable<? extends T> source,
Func1<? super Observable<T>,? extends U> selector,
Scheduler scheduler)
For each value of the source observable, it creates a view starting from that value into the source
and calls the given selector function asynchronously on the given scheduler.
|
static <T,U> Observable<U> |
manySelect0(Observable<? extends T> source,
Func1<? super Observable<T>,? extends U> selector)
Uses the selector function on the given source observable to extract a single
value and send this value to the registered observer.
|
static <T> Observable<Option<T>> |
materialize(Observable<? extends T> source)
Returns an observable which converts all messages to an
Option value. |
static <T> Observable<Option<T>> |
materializeForever(Observable<? extends T> source)
Returns an observable which converts all messages to an
Option value. |
static <T extends java.lang.Comparable<? super T>> |
max(Observable<? extends T> source)
Returns the maximum value encountered in the source observable once it sends finish().
|
static <T> Observable<T> |
max(Observable<? extends T> source,
java.util.Comparator<? super T> comparator)
Returns the maximum value encountered in the source observable once it sends finish().
|
static <T,Key extends java.lang.Comparable<? super Key>> |
maxBy(Observable<? extends T> source,
Func1<? super T,? extends Key> keyExtractor)
Returns an observable which provides with the list of
Ts which had their keys as maximums. |
static <T,Key> Observable<java.util.List<T>> |
maxBy(Observable<? extends T> source,
Func1<? super T,? extends Key> keyExtractor,
java.util.Comparator<? super Key> keyComparator)
Returns an observable which provides with the list of
Ts which had their keys as maximums. |
static <T> Observable<T> |
merge(java.lang.Iterable<? extends Observable<? extends T>> sources)
Combines the notifications of all sources.
|
static <T> Observable<T> |
merge(Observable<? extends Observable<? extends T>> sources)
Merge the dynamic sequence of observables of T.
|
static <T> Observable<T> |
merge(Observable<? extends T>... sources)
Combines the notifications of all sources.
|
static <T> Observable<T> |
merge(Observable<? extends T> first,
Observable<? extends T> second)
Merge the events of two observable sequences.
|
static <T extends java.lang.Comparable<? super T>> |
min(Observable<? extends T> source)
Returns the minimum value encountered in the source observable once it sends finish().
|
static <T> Observable<T> |
min(Observable<? extends T> source,
java.util.Comparator<? super T> comparator)
Returns the minimum value encountered in the source observable once it sends finish().
|
static <T,Key extends java.lang.Comparable<? super Key>> |
minBy(Observable<? extends T> source,
Func1<? super T,? extends Key> keyExtractor)
Returns an observable which provides with the list of
Ts which had their keys as minimums. |
static <T,Key> Observable<java.util.List<T>> |
minBy(Observable<? extends T> source,
Func1<? super T,? extends Key> keyExtractor,
java.util.Comparator<? super Key> keyComparator)
Returns an observable which provides with the list of
Ts which had their keys as minimums. |
static <T,Key> Observable<java.util.List<T>> |
minMax(Observable<? extends T> source,
Func1<? super T,? extends Key> keyExtractor,
java.util.Comparator<? super Key> keyComparator,
boolean max)
Returns an observable which provides with the list of
Ts which had their keys as maximums. |
static <T> CloseableIterable<T> |
mostRecent(Observable<? extends T> source,
T initialValue)
Samples the latest T value coming from the source observable or the initial
value when no messages arrived so far.
|
static <T,U,V> Observable<V> |
multicast(Observable<? extends T> source,
Func0<? extends Subject<? super T,? extends U>> subjectSelector,
Func1<? super Observable<? extends U>,? extends Observable<? extends V>> selector)
Multicasts the source events through the subject instantiated via
the subjectSelector.
|
static <T,U> ConnectableObservable<U> |
multicast(Observable<? extends T> source,
Subject<? super T,? extends U> subject)
Multicasts the source sequence through the supplied subject by allowing
connection and disconnection from the source without the need to reconnect
any observers to the returned observable.
|
static <T> Observable<T> |
never()
Returns an observable which never fires.
|
protected static <T> Func2<? super Option<T>,? super Option<T>,java.lang.Boolean> |
newOptionComparer(Func2<? super T,? super T,java.lang.Boolean> objectComparer)
Creates a new nullsafe equality comparison function where if two Option.Some<T>
meet, their values are compared by using the supplied objectComparer.
|
static <T> CloseableIterable<T> |
next(Observable<? extends T> source)
Returns an iterable sequence which blocks until an element
becomes available from the source.
|
static <T> Observable<T> |
observeOn(Observable<? extends T> source,
Scheduler pool)
Wrap the given observable object in a way that any of its observers receive callbacks on
the given thread pool.
|
static <T> Observable<T> |
ofType(Observable<?> source,
java.lang.Class<T> clazz)
Filters the elements of the source sequence which
is assignable to the provided type.
|
static <T extends java.lang.Comparable<? super T>> |
orderBy(Observable<? extends T> source)
Returns an Observable which traverses the entire
source Observable and creates an ordered list
of elements.
|
static <T> Observable<T> |
orderBy(Observable<? extends T> source,
java.util.Comparator<? super T> comparator)
Returns an Observable which traverses the entire
source Observable and creates an ordered list
of elements.
|
static <T,U extends java.lang.Comparable<? super U>> |
orderBy(Observable<? extends T> source,
Func1<? super T,? extends U> keySelector)
Returns an Observable which traverses the entire
source Observable and creates an ordered list
of elements.
|
static <T,U> Observable<T> |
orderBy(Observable<? extends T> source,
Func1<? super T,? extends U> keySelector,
java.util.Comparator<? super U> keyComparator)
Returns an Observable which traverses the entire
source Observable and creates an ordered list
of elements.
|
static <T> Observable<T> |
prune(Observable<? extends T> source)
Returns an observable which shares all registration to the source observable and
each observer will only see the last notification.
|
static <T,U> Observable<U> |
prune(Observable<? extends T> source,
Func1<? super Observable<? extends T>,? extends Observable<U>> selector)
Returns an observable which shares all registration to the source observable and
each observer will only see the last notification.
|
static <T,U> Observable<U> |
prune(Observable<? extends T> source,
Func1<? super Observable<? extends T>,? extends Observable<U>> selector,
Scheduler scheduler)
Returns an observable which shares all registration to the source observable and
each observer will only see the last notification.
|
static <T> Observable<T> |
prune(Observable<? extends T> source,
Scheduler scheduler)
Returns an observable which shares all registration to the source observable and
each observer will only see the last notification.
|
static <T> ConnectableObservable<T> |
publish(Observable<? extends T> source)
Returns an observable which shares a single registration to the underlying source.
|
static <T,U> Observable<U> |
publish(Observable<? extends T> source,
Func1<? super Observable<? extends T>,? extends Observable<? extends U>> selector)
Returns an observable sequence which is the result of
invoking the selector on a connectable observable sequence
that shares a single registration with the underlying
source observable. |
static <T,U> Observable<U> |
publish(Observable<? extends T> source,
Func1<? super Observable<? extends T>,? extends Observable<? extends U>> selector,
T initialValue)
Returns an observable sequence which is the result of
invoking the selector on a connectable observable sequence
that shares a single registration with the underlying
source observable and registering parties
receive the initial value immediately. |
static <T> ConnectableObservable<T> |
publish(Observable<? extends T> source,
T initialValue)
Returns an observable which shares a single registration to the underlying source
and starts with with the initial value.
|
static <T,U> Observable<U> |
publishLast(Observable<? extends T> source,
Func1<? super Observable<? extends T>,? extends Observable<? extends U>> selector)
Retunrs an observable that is the result of the selector invocation
on a connectable observable that shares a single registration to
source and returns the last event of the source. |
static <T> ConnectableObservable<T> |
publishLast(Observable<T> source)
Returns a connectable observable which uses a single registration
to the underlying source sequence containing only the last value.
|
static Observable<java.math.BigDecimal> |
range(java.math.BigDecimal start,
int count,
java.math.BigDecimal step)
Creates an observable which generates numbers from start.
|
static Observable<java.math.BigDecimal> |
range(java.math.BigDecimal start,
int count,
java.math.BigDecimal step,
Scheduler pool)
Creates an observable which generates BigDecimal numbers from start.
|
static Observable<java.math.BigInteger> |
range(java.math.BigInteger start,
java.math.BigInteger count)
Creates an observable which generates numbers from start.
|
static Observable<java.math.BigInteger> |
range(java.math.BigInteger start,
java.math.BigInteger count,
Scheduler pool)
Creates an observable which generates BigInteger numbers from start.
|
static Observable<java.lang.Double> |
range(double start,
int count,
double step)
Creates an observable which generates numbers from start.
|
static Observable<java.lang.Double> |
range(double start,
int count,
double step,
Scheduler pool)
Creates an observable which produces Double values from
start in count
amount and each subsequent element has a difference of step. |
static Observable<java.lang.Float> |
range(float start,
int count,
float step)
Creates an observable which generates numbers from start.
|
static Observable<java.lang.Float> |
range(float start,
int count,
float step,
Scheduler pool)
Creates an observable which produces Float values from
start in count
amount and each subsequent element has a difference of step. |
static Observable<java.lang.Integer> |
range(int start,
int count)
Creates an observable which generates numbers from start.
|
static Observable<java.lang.Integer> |
range(int start,
int count,
Scheduler pool)
Creates an observable which generates numbers from start.
|
static Observable<java.lang.Long> |
range(long start,
long count)
Creates an observable which generates numbers from start.
|
static Observable<java.lang.Long> |
range(long start,
long count,
Scheduler pool)
Creates an observable which generates numbers from start.
|
static <T> Observable<T> |
refCount(ConnectableObservable<? extends T> source)
Returns an observable sequence which
connects to the source for the first registered
party and stays connected to the source
as long as there is at least one registered party to it.
|
static <T> Observable<T> |
registerOn(Observable<? extends T> observable,
Scheduler pool)
Wrap the given observable into an new Observable instance, which calls the original register() method
on the supplied pool.
|
static <T> Observable<T> |
relayUntil(Observable<? extends T> source,
Func0<java.lang.Boolean> condition)
Relay values of T while the given condition does not hold.
|
static <T> Observable<T> |
relayWhile(Observable<? extends T> source,
Func0<java.lang.Boolean> condition)
Relay the stream of Ts until condition turns into false.
|
static <T> Observable<T> |
removeTimeInterval(Observable<TimeInterval<T>> source)
Unwrap the values within a timeinterval observable to its normal value.
|
static <T> Observable<T> |
removeTimestamped(Observable<Timestamped<? extends T>> source)
Unwrap the values within a timestamped observable to its normal value.
|
static <T> Observable<T> |
repeat(Func0<? extends T> func)
Creates an observable which repeatedly calls the given function which generates the Ts indefinitely.
|
static <T> Observable<T> |
repeat(Func0<? extends T> func,
int count)
Creates an observable which repeatedly calls the given function
count times to generate Ts
and runs on the default pool. |
static <T> Observable<T> |
repeat(Func0<? extends T> func,
int count,
Scheduler pool)
Creates an observable which repeatedly calls the given function
count times to generate Ts
and runs on the given pool. |
static <T> Observable<T> |
repeat(Func0<? extends T> func,
Scheduler pool)
Creates an observable which repeatedly calls the given function which generates the Ts indefinitely.
|
static <T> Observable<T> |
repeat(Observable<? extends T> source)
Repeat the source observable indefinitely.
|
static <T> Observable<T> |
repeat(Observable<? extends T> source,
int count)
Repeat the source observable count times.
|
static <T> Observable<T> |
repeat(T value)
Creates an observable which repeates the given value indefinitely
and runs on the default pool.
|
static <T> Observable<T> |
repeat(T value,
int count)
Creates an observable which repeates the given value
count times
and runs on the default pool. |
static <T> Observable<T> |
repeat(T value,
int count,
Scheduler pool)
Creates an observable which repeates the given value
count times
and runs on the given pool. |
static <T> Observable<T> |
repeat(T value,
Scheduler pool)
Creates an observable which repeates the given value indefinitely
and runs on the given pool.
|
static <T> Observable<T> |
replay(Observable<? extends T> source)
Creates an observable which shares the source observable and replays all source Ts
to any of the registering observers.
|
static <T,U> Observable<U> |
replay(Observable<? extends T> source,
Func1<? super Observable<? extends T>,? extends Observable<U>> selector,
int bufferSize)
Creates an observable which shares the source observable and replays the buffered source Ts
to any of the registering observers.
|
static <T,U> Observable<U> |
replay(Observable<? extends T> source,
Func1<? super Observable<? extends T>,? extends Observable<U>> selector,
int bufferSize,
long timeSpan,
java.util.concurrent.TimeUnit unit)
Creates an observable which shares the source observable and replays the bufferSize source Ts
to any of the registering observers.
|
static <T,U> Observable<U> |
replay(Observable<? extends T> source,
Func1<? super Observable<? extends T>,? extends Observable<U>> selector,
int bufferSize,
long timeSpan,
java.util.concurrent.TimeUnit unit,
Scheduler scheduler)
Creates an observable which shares the source observable and replays the bufferSize source Ts
to any of the registering observers.
|
static <T,U> Observable<U> |
replay(Observable<? extends T> source,
Func1<? super Observable<? extends T>,? extends Observable<U>> selector,
long timeSpan,
java.util.concurrent.TimeUnit unit)
Creates an observable which shares the source observable and replays all source Ts
to any of the registering observers.
|
static <T,U> Observable<U> |
replay(Observable<? extends T> source,
Func1<? super Observable<? extends T>,? extends Observable<U>> selector,
long timeSpan,
java.util.concurrent.TimeUnit unit,
Scheduler scheduler)
Creates an observable which shares the source observable and replays all source Ts
to any of the registering observers.
|
static <T> Observable<T> |
replay(Observable<? extends T> source,
int bufferSize)
Creates an observable which shares the source observable and replays the buffered source Ts
to any of the registering observers.
|
static <T> Observable<T> |
replay(Observable<? extends T> source,
int bufferSize,
long timeSpan,
java.util.concurrent.TimeUnit unit)
Creates an observable which shares the source observable and replays the bufferSize source Ts
to any of the registering observers.
|
static <T> Observable<T> |
replay(Observable<? extends T> source,
int bufferSize,
long timeSpan,
java.util.concurrent.TimeUnit unit,
Scheduler scheduler)
Creates an observable which shares the source observable and replays the bufferSize source Ts
to any of the registering observers.
|
static <T> Observable<T> |
replay(Observable<? extends T> source,
int bufferSize,
Scheduler scheduler)
Creates an observable which shares the source observable and replays all source Ts
to any of the registering observers.
|
static <T> Observable<T> |
replay(Observable<? extends T> source,
long timeSpan,
java.util.concurrent.TimeUnit unit)
Creates an observable which shares the source observable and replays all source Ts
to any of the registering observers.
|
static <T> Observable<T> |
replay(Observable<? extends T> source,
long timeSpan,
java.util.concurrent.TimeUnit unit,
Scheduler scheduler)
Creates an observable which shares the source observable and replays all source Ts
to any of the registering observers.
|
static <T> Observable<T> |
replay(Observable<? extends T> source,
Scheduler scheduler)
Creates an observable which shares the source observable and replays all source Ts
to any of the registering observers.
|
static <T,U> Observable<U> |
replay(Observable<T> source,
Func1<? super Observable<? extends T>,? extends Observable<U>> selector,
int bufferSize,
Scheduler scheduler)
Creates an observable which shares the source observable returned by the selector and replays all source Ts
to any of the registering observers.
|
static <T,U> Observable<U> |
replay(Observable<T> source,
Func1<? super Observable<T>,? extends Observable<U>> selector)
Returns the observable sequence for the supplied source observable by
invoking the selector function with it.
|
static <T> Observable<T> |
resumeAlways(java.lang.Iterable<? extends Observable<? extends T>> sources)
Returns an observable which listens to elements from a source until it signals an error()
or finish() and continues with the next observable.
|
static <T> Observable<T> |
resumeConditionally(Observable<? extends T> source,
Func1<? super java.lang.Throwable,? extends Observable<? extends T>> handler)
Continues the observable sequence in case of exception
whith the sequence provided by the function for that particular
exception.
|
static <T> Observable<T> |
resumeOnError(java.lang.Iterable<? extends Observable<? extends T>> sources)
It tries to submit the values of first observable, but when it throws an exeption,
the next observable within source is used further on.
|
static <T> Observable<T> |
retry(Observable<? extends T> source)
Restarts the observation until the source observable terminates normally.
|
static <T> Observable<T> |
retry(Observable<? extends T> source,
int count)
Restarts the observation until the source observable terminates normally
or the
count retry count was used up. |
static void |
run(Observable<?> source)
Blocks until the observable calls finish() or error().
|
static <T> void |
run(Observable<? extends T> source,
Action1<? super T> action)
Blocks until the observable calls finish() or error().
|
static <T> void |
run(Observable<? extends T> source,
Observer<? super T> observer)
Blocks until the observable calls finish() or error().
|
static <T> Observable<T> |
sample(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit)
Periodically sample the given source observable, which means tracking the last value of
the observable and periodically submitting it to the output observable.
|
static <T> Observable<T> |
sample(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit,
Scheduler pool)
Periodically sample the given source observable, which means tracking
the last value of
the observable and periodically submitting it to the output observable.
|
static <T,U> Observable<T> |
sample(Observable<? extends T> source,
Observable<? extends U> sampler)
Samples the observable sequence when the other sequence
fires an event.
|
static <T> Observable<T> |
scan(Observable<? extends T> source,
Func2<? super T,? super T,? extends T> accumulator)
Creates an observable which accumultates the given source and submits each intermediate results to its subscribers.
|
static <T,U> Observable<U> |
scan(Observable<? extends T> source,
U seed,
Func2<? super U,? super T,? extends U> accumulator)
Creates an observable which accumultates the given
source and submits each intermediate results to its subscribers.
|
static <T,U> Observable<U> |
select(Observable<? extends T> source,
Func1<? super T,? extends U> mapper)
Use the mapper to transform the T source into an U source.
|
static <T,U> Observable<U> |
select(Observable<? extends T> source,
Func2<? super T,? super java.lang.Integer,? extends U> selector)
Transforms the elements of the source observable into
Us by using a selector which receives an index indicating
how many elements have been transformed this far.
|
static <T,U> Observable<U> |
selectLong(Observable<? extends T> source,
Func2<? super T,? super java.lang.Long,? extends U> selector)
Transforms the elements of the source observable into
Us by using a selector which receives an long index indicating
how many elements have been transformed this far.
|
static <T,U> Observable<U> |
selectMany(Observable<? extends T> source,
Func1<? super T,? extends Observable<? extends U>> selector)
Transform the given source of Ts into Us in a way that the
selector might return an observable ofUs for a single T.
|
static <T,U,V> Observable<V> |
selectMany(Observable<? extends T> source,
Func1<? super T,? extends Observable<? extends U>> collectionSelector,
Func2<? super T,? super U,? extends V> resultSelector)
Creates an observable in which for each of Ts an observable of Vs are
requested which in turn will be transformed by the resultSelector for each
pair of T and V giving an U.
|
static <T,U> Observable<U> |
selectMany(Observable<? extends T> source,
Observable<? extends U> provider)
Creates an observable of Us in a way when a source T arrives, the observable of
Us is completely drained into the output.
|
static <T,U> Observable<U> |
selectManyIterable(Observable<? extends T> source,
Func1<? super T,? extends java.lang.Iterable<? extends U>> selector)
Transform the given source of Ts into Us in a way that the selector might return zero to multiple elements of Us for a single T.
|
static <T,U,V> Observable<V> |
selectManyIterable(Observable<? extends T> source,
Func1<? super T,? extends java.lang.Iterable<? extends U>> selector,
Func2<? super T,? super U,? extends V> resultSelector)
Transform the given source of Ts into Us in a way that the selector might return zero to multiple elements of Us for a single T.
|
static <T> Observable<java.lang.Boolean> |
sequenceEqual(java.lang.Iterable<? extends T> first,
Observable<? extends T> second)
Compares two sequences and returns whether they are produce the same
elements in terms of the null-safe object equality.
|
static <T> Observable<java.lang.Boolean> |
sequenceEqual(java.lang.Iterable<? extends T> first,
Observable<? extends T> second,
Func2<? super T,? super T,java.lang.Boolean> comparer)
Compares two sequences and returns whether they are produce the same
elements in terms of the comparer function.
|
static <T> Observable<java.lang.Boolean> |
sequenceEqual(Observable<? extends T> first,
Observable<? extends T> second)
Compares two sequences and returns whether they are produce the same
elements in terms of the null-safe object equality.
|
static <T> Observable<java.lang.Boolean> |
sequenceEqual(Observable<? extends T> first,
Observable<? extends T> second,
Func2<? super T,? super T,java.lang.Boolean> comparer)
Compares two sequences and returns whether they are produce the same
elements in terms of the comparer function.
|
static <T> T |
single(Observable<? extends T> source)
Returns the single element of the given observable source.
|
static <T> T |
single(Observable<? extends T> source,
Func0<? extends T> defaultSupplier)
Returns the single element of the given observable source,
returns the supplier's value if the source is empty or throws a
TooManyElementsException in case the source has more than one item.
|
static <T> T |
single(Observable<? extends T> source,
T defaultValue)
Returns the single element of the given observable source,
returns the default if the source is empty or throws a
TooManyElementsException in case the source has more than one item.
|
static <T> Observable<T> |
singleAsync(Observable<? extends T> source)
Returns the only element of the source or throws
NoSuchElementException if the source is empty or TooManyElementsException if
it contains more than one elements.
|
static <T> Observable<T> |
singleAsync(Observable<? extends T> source,
Func0<? extends T> defaultSupplier)
Returns the only element of the source,
returns the supplier's value if the source is empty or TooManyElementsException if
it contains more than one elements.
|
static <T> Observable<T> |
singleAsync(Observable<? extends T> source,
T defaultValue)
Returns the only element of the source,
returns the default value if the source is empty or TooManyElementsException if
it contains more than one elements.
|
static <T> Observable<T> |
singleton(Func0<? extends T> supplier)
Returns the single value produced by the supplier callback function
on the default scheduler.
|
static <T> Observable<T> |
singleton(Func0<? extends T> supplier,
Scheduler pool)
Returns the single value produced by the supplier callback function
on the supplied scheduler.
|
static <T> Observable<T> |
singleton(T value)
Returns the single value in the observables by using the default scheduler pool.
|
static <T> Observable<T> |
singleton(T value,
Scheduler pool)
Returns the single value in the observables.
|
static <T> Observable<T> |
skip(Observable<? extends T> source,
int count)
Skips the given amount of next() messages from source and relays
the rest.
|
static <T> Observable<T> |
skip(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit)
Skips elements of the source observable for the
specified amount of time.
|
static <T> Observable<T> |
skip(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit,
Scheduler pool)
Skips elements of the source observable for the
specified amount of time.
|
static <T> Observable<T> |
skipLast(Observable<? extends T> source,
int count)
Skips the last
count elements from the source observable. |
static <T> Observable<T> |
skipLast(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit)
Skips the elements from the end for the specified amount of time.
|
static <T,U> Observable<T> |
skipUntil(Observable<? extends T> source,
Observable<U> signaller)
Skip the source elements until the signaller sends its first element.
|
static <T> Observable<T> |
skipWhile(Observable<? extends T> source,
Func1<? super T,java.lang.Boolean> condition)
Skips the Ts from source while the specified condition returns true.
|
static <T> Observable<T> |
skipWhile(Observable<? extends T> source,
Func2<? super T,? super java.lang.Integer,java.lang.Boolean> condition)
Skips the Ts from source while the specified indexed condition returns true.
|
static <T> Observable<T> |
skipWhileLong(Observable<? extends T> source,
Func2<? super T,? super java.lang.Long,java.lang.Boolean> condition)
Skips the Ts from source while the specified long indexed condition returns true.
|
static Observable<java.lang.Void> |
start(Action0 action)
Invokes the action asynchronously on the given pool and
relays its finish() or error() messages.
|
static Observable<java.lang.Void> |
start(Action0 action,
Scheduler pool)
Invokes the action asynchronously on the given pool and
relays its finish() or error() messages.
|
static <T> Observable<T> |
start(Func0<? extends T> func)
Invokes the function asynchronously on the default pool and
relays its result followed by a finish.
|
static <T> Observable<T> |
start(Func0<? extends T> func,
Scheduler pool)
Invokes the function asynchronously on the given pool and
relays its result followed by a finish.
|
static <T> Observable<T> |
startWith(Observable<? extends T> source,
java.lang.Iterable<? extends T> values)
Start with the given iterable of values before relaying the Ts from the
source.
|
static <T> Observable<T> |
startWith(Observable<? extends T> source,
java.lang.Iterable<? extends T> values,
Scheduler pool)
Start with the given iterable of values before relaying the Ts from the
source.
|
static <T> Observable<T> |
startWith(Observable<? extends T> source,
Scheduler pool,
T... values)
Start with the given iterable of values before relaying the Ts from the
source.
|
static <T> Observable<T> |
startWith(Observable<? extends T> source,
T... values)
Start with the given iterable of values before relaying the Ts from the
source.
|
static Observable<java.math.BigDecimal> |
sumBigDecimal(Observable<java.math.BigDecimal> source)
Computes and signals the sum of the values of the BigDecimal source.
|
static Observable<java.math.BigInteger> |
sumBigInteger(Observable<java.math.BigInteger> source)
Computes and signals the sum of the values of the BigInteger source.
|
static Observable<java.lang.Double> |
sumDouble(Observable<java.lang.Double> source)
Computes and signals the sum of the values of the Double source.
|
static Observable<java.lang.Float> |
sumFloat(Observable<java.lang.Float> source)
Computes and signals the sum of the values of the Float source.
|
static Observable<java.lang.Integer> |
sumInt(Observable<java.lang.Integer> source)
Computes and signals the sum of the values of the Integer source.
|
static Observable<java.lang.Double> |
sumIntAsDouble(Observable<java.lang.Integer> source)
Computes and signals the sum of the values of the Integer source by using
a double intermediate representation.
|
static Observable<java.lang.Long> |
sumLong(Observable<java.lang.Long> source)
Computes and signals the sum of the values of the Long source.
|
static Observable<java.lang.Double> |
sumLongAsDouble(Observable<java.lang.Long> source)
Computes and signals the sum of the values of the Long sourceby using
a double intermediate representation.
|
static <T,U> Observable<U> |
switchCase(Func0<? extends T> selector,
java.util.Map<? super T,? extends Observable<U>> sources)
Returns an observable which uses a selector function
to return the observable sequence to work with or
the empty sequence run on the default scheduler.
|
static <T,U> Observable<U> |
switchCase(Func0<? extends T> selector,
java.util.Map<? super T,? extends Observable<U>> sources,
Observable<U> defaultSource)
Returns an observable which uses a selector function
to return the observable sequence to work with or
the default source.
|
static <T,U> Observable<U> |
switchCase(Func0<? extends T> selector,
java.util.Map<? super T,? extends Observable<U>> sources,
Scheduler pool)
Returns an observable which uses a selector function
to return the observable sequence to work with or
the empty sequence run on the specified scheduler.
|
static <T> Observable<T> |
switchToNext(Observable<? extends Observable<? extends T>> sources)
Returns an observer which relays Ts from the source observables in a way, when
a new inner observable comes in, the previous one is deregistered and the new one is
continued with.
|
static <T> Observable<T> |
synchronize(Observable<? extends T> source)
Returns an observable sequence which ensures that
the registering observers follow the general contract
on observables by serializing access to the event
methods.
|
static <T> Observable<T> |
take(Observable<? extends T> source,
int count)
Creates an observable which takes the specified number of
Ts from the source, unregisters and completes.
|
static <T> Observable<T> |
take(Observable<? extends T> source,
int count,
Scheduler scheduler)
Creates an observable which takes the specified number of
Ts from the source, unregisters and completes.
|
static <T> Observable<T> |
take(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit)
Takes the elements from the source sequence
until the time runs out.
|
static <T> Observable<T> |
take(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit,
Scheduler pool)
Takes the elements from the source sequence
until the time runs out.
|
static <T> Observable<T> |
takeLast(Observable<? extends T> source,
int count)
Returns an observable which returns the last
count
elements from the source observable. |
static <T> Observable<T> |
takeLast(Observable<? extends T> source,
int count,
Scheduler pool)
Returns an observable which returns the last
count
elements from the source observable and emits them from
the specified scheduler pool. |
static <T> Observable<T> |
takeLast(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit)
Skips the elements from the end for the specified amount of time.
|
static <T> Observable<T> |
takeLast(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit,
Scheduler drainPool)
Skips the elements from the end for the specified amount of time.
|
static <T> Observable<java.util.List<T>> |
takeLastBuffer(Observable<? extends T> source,
int count)
Returns an observable which returns the last
count
elements from the source observable and
returns it as a single list. |
static <T> Observable<java.util.List<T>> |
takeLastBuffer(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit)
Skips the elements from the end for the specified amount of time
as one list.
|
static <T> Observable<java.util.List<T>> |
takeLastBuffer(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit,
Scheduler drainPool)
Skips the elements from the end for the specified amount of time
as one list.
|
static <T,U> Observable<T> |
takeUntil(Observable<? extends T> source,
Observable<U> signaller)
Creates an observable which takes values from the source until
the signaller produces a value.
|
static <T> Observable<T> |
takeWhile(Observable<? extends T> source,
Func1<? super T,java.lang.Boolean> predicate)
Creates an observable which takes values from source until
the predicate returns false for the current element, then skips the remaining values.
|
static <T> Observable<T> |
takeWhile(Observable<? extends T> source,
Func2<? super T,? super java.lang.Integer,java.lang.Boolean> predicate)
Creates an observable which takes values from source until
the indexed predicate returns false for the current element, then skips the remaining values.
|
static <T> Observable<T> |
takeWhileLong(Observable<? extends T> source,
Func2<? super T,? super java.lang.Long,java.lang.Boolean> predicate)
Creates an observable which takes values from source until
the long indexed predicate returns false for the current element, then skips the remaining values.
|
static <T,U> Observable<T> |
throttle(Observable<? extends T> source,
Func1<? super T,? extends Observable<U>> durationSelector)
Fires the last event from the source observable if
no events are fired during a selector-returned observable window.
|
static <T> Observable<T> |
throttle(Observable<? extends T> source,
long delay,
java.util.concurrent.TimeUnit unit)
Creates and observable which fires the last value
from source when the given timespan elapsed without a new
value occurring from the source.
|
static <T> Observable<T> |
throttle(Observable<? extends T> source,
long delay,
java.util.concurrent.TimeUnit unit,
Scheduler pool)
Creates and observable which fires the last value
from source when the given timespan elapsed without a new
value occurring from the source.
|
static <T,E extends java.lang.Throwable> |
throwException(Func0<E> supplier)
Creates an observable which instantly sends the exception
returned by the supplier function to
its subscribers while running on the default pool.
|
static <T,E extends java.lang.Throwable> |
throwException(Func0<E> supplier,
Scheduler pool)
Creates an observable which instantly sends the exception
returned by the function to
its subscribers while running on the given pool.
|
static <T> Observable<T> |
throwException(java.lang.Throwable ex)
Creates an observable which instantly sends the exception to
its subscribers while running on the default pool.
|
static <T> Observable<T> |
throwException(java.lang.Throwable ex,
Scheduler pool)
Creates an observable which instantly sends the exception to
its subscribers while running on the given pool.
|
static Observable<java.lang.Long> |
tick(long start,
long end,
long delay,
java.util.concurrent.TimeUnit unit)
Returns an observable which produces an ordered sequence of
numbers with the specified delay.
|
static Observable<java.lang.Long> |
tick(long start,
long end,
long delay,
java.util.concurrent.TimeUnit unit,
Scheduler pool)
Returns an observable which produces an ordered sequence
of numbers with the specified delay.
|
static Observable<java.lang.Long> |
tick(long delay,
java.util.concurrent.TimeUnit unit)
Returns an observable which produces an ordered sequence of numbers with the specified delay.
|
static <T,V> Observable<T> |
timeout(Observable<? extends T> source,
Func1<? super T,? extends Observable<V>> timeoutSelector)
Applies a timeout to each element of the sequence or
throws a TimeoutException if an element is not followed
by another within the firing of the timeout selector's
observable sequence.
|
static <T,V> Observable<T> |
timeout(Observable<? extends T> source,
Func1<? super T,? extends Observable<V>> timeoutSelector,
Observable<? extends T> other)
Applies a timeout to each element in the source sequence,
for each element a separate window is opened in the
form of observable sequence.
|
static <T> Observable<T> |
timeout(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit)
Creates an observable which relays events if they arrive
from the source observable within the specified amount of time
or it singlals a java.util.concurrent.TimeoutException.
|
static <T> Observable<T> |
timeout(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit,
Observable<? extends T> other)
Creates an observable which relays events if they arrive
from the source observable within the specified amount of time
or it switches to the
other observable. |
static <T> Observable<T> |
timeout(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit,
Observable<? extends T> other,
Scheduler pool)
Creates an observable which relays events if they arrive
from the source observable within the specified amount of time
or it switches to the
other observable. |
static <T> Observable<T> |
timeout(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit,
Scheduler pool)
Creates an observable which relays events if they arrive
from the source observable within the specified amount of time
or it singlals a java.util.concurrent.TimeoutException.
|
static <T,U,V> Observable<T> |
timeout(Observable<? extends T> source,
Observable<U> firstTimeout,
Func1<? super T,? extends Observable<V>> timeoutSelector)
Applies a timeout to each element of the sequence or
throws a TimeoutException if an element is not followed
by another within the firing of the timeout selector's
observable sequence.
|
static <T,U,V> Observable<T> |
timeout(Observable<? extends T> source,
Observable<U> firstTimeout,
Func1<? super T,? extends Observable<V>> timeoutSelector,
Observable<? extends T> other)
Applies a timeout to each element in the source sequence,
starting with the timeout from the firsTimeout observabe,
then, for each element a separate window is opened in the
form of observable sequence.
|
static <T> Observable<T> |
timeoutFinish(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit)
Creates an observable which finishes its observers after the specified
amount of time if no error or finish events appeared till then.
|
static <T> Observable<T> |
timeoutFinish(Observable<? extends T> source,
long time,
java.util.concurrent.TimeUnit unit,
Scheduler scheduler)
Creates an observable which finishes its observers after the specified
amount of time if no error or finish events appeared till then.
|
static Observable<java.lang.Object[]> |
toArray(Observable<?> source)
Creates an array from the observable sequence elements.
|
static <T> Observable<T[]> |
toArray(Observable<? extends T> source,
T[] a)
Creates an array from the observable sequence elements by using the given
array for the template to create a dynamicly typed array of Ts.
|
static DoubleObservable |
toDoubleObservable(Observable<java.lang.Double> source)
Convert an object-double observable into a primitive-double observable.
|
static IntObservable |
toIntObservable(Observable<java.lang.Integer> source)
Convert an object-int observable into a primitive-int observable.
|
static <T> CloseableIterable<T> |
toIterable(Observable<? extends T> observable)
Convert the given observable instance into a classical iterable instance.
|
static <T> Observable<java.util.List<T>> |
toList(Observable<? extends T> source)
Collect the elements of the source observable into a single list.
|
static LongObservable |
toLongObservable(Observable<java.lang.Long> source)
Convert an object-long observable into a primitive-long observable.
|
static <T,K,V> Observable<java.util.Map<K,V>> |
toMap(Observable<? extends T> source,
Func1<? super T,? extends K> keySelector,
Func1<? super T,? extends V> valueSelector)
Maps the given source of Ts by using the key extractor and
returns a single Map of them.
|
static <T,K,V> Observable<java.util.Map<K,V>> |
toMap(Observable<? extends T> source,
Func1<? super T,? extends K> keySelector,
Func1<? super T,? extends V> valueSelector,
Func2<? super K,? super K,java.lang.Boolean> keyComparer)
Maps the given source of Ts by using the key and value extractor and
returns a single Map of them.
|
static <K,T> Observable<java.util.Map<K,T>> |
toMap(Observable<? extends T> source,
Func1<? super T,? extends K> keySelector,
Func2<? super K,? super K,java.lang.Boolean> keyComparer)
Maps the given source of Ts by using the key extractor and
returns a single Map of them.
|
static <K,T> Observable<java.util.Map<K,T>> |
toMap(Observable<T> source,
Func1<? super T,? extends K> keySelector)
Maps the given source of Ts by using the key extractor and
returns a single Map of them.
|
static <T,K> Observable<java.util.Map<K,java.util.Collection<T>>> |
toMultiMap(Observable<? extends T> source,
Func1<? super T,? extends K> keySelector,
Func0<? extends java.util.Collection<T>> collectionSupplier)
Maps the given source of Ts by using the key extractor and
returns a single multi-map of them.
|
static <T,K> Observable<java.util.Map<K,java.util.Collection<T>>> |
toMultiMap(Observable<? extends T> source,
Func1<? super T,? extends K> keySelector,
Func0<? extends java.util.Collection<T>> collectionSupplier,
Func2<? super K,? super K,java.lang.Boolean> keyComparer)
Maps the given source of Ts by using the key extractor and
returns a single multi-map of them.
|
static <T,K,V> Observable<java.util.Map<K,java.util.Collection<V>>> |
toMultiMap(Observable<? extends T> source,
Func1<? super T,? extends K> keySelector,
Func0<? extends java.util.Collection<V>> collectionSupplier,
Func1<? super T,? extends V> valueSelector)
Maps the given source of Ts by using the key and value extractor and
returns a single multi-map of them.
|
static <T,K,V> Observable<java.util.Map<K,java.util.Collection<V>>> |
toMultiMap(Observable<? extends T> source,
Func1<? super T,? extends K> keySelector,
Func0<? extends java.util.Collection<V>> collectionSupplier,
Func1<? super T,? extends V> valueSelector,
Func2<? super K,? super K,java.lang.Boolean> keyComparer)
Maps the given source of Ts by using the key and value extractor and
returns a single multi-map of them.
|
static <T> Observable<T> |
toObservable(java.util.concurrent.Future<? extends T> future)
Returns an observable which delivers the
result of the future object on the default scheduler.
|
static <T> Observable<T> |
toObservable(java.util.concurrent.Future<? extends T> future,
Scheduler pool)
Returns an observable which delivers the
result of the future object on the given scheduler.
|
static <T> Observable<T> |
toObservable(java.lang.Iterable<? extends T> iterable)
Wrap the iterable object into an observable and use the
default pool when generating the iterator sequence.
|
static <T> Observable<T> |
toObservable(java.lang.Iterable<? extends T> iterable,
Scheduler pool)
Wrap the iterable object into an observable and use the
given pool when generating the iterator sequence.
|
static <T> Func1<TimeInterval<T>,T> |
unwrapTimeInterval()
A convenience function which unwraps the T from a TimeInterval of T.
|
static <T> Func1<Timestamped<? extends T>,T> |
unwrapTimestamped()
A convenience function which unwraps the T from a Timestamped of T.
|
static <T,U extends java.io.Closeable> |
using(Func0<? extends U> resourceSelector,
Func1<? super U,? extends Observable<? extends T>> resourceUsage)
Receives a resource from the resource selector and
uses the resource until it terminates, then closes the resource.
|
static <T> Observable<T> |
where(Observable<? extends T> source,
Func0<? extends Func2<? super T,? super java.lang.Integer,java.lang.Boolean>> clauseFactory)
Creates a filtered observable where only Ts are relayed which satisfy the clause.
|
static <T> Observable<T> |
where(Observable<? extends T> source,
Func1<? super T,java.lang.Boolean> clause)
Creates a filtered observable where only Ts are relayed which satisfy the clause.
|
static <T> Observable<T> |
where(Observable<? extends T> source,
Func2<? super T,? super java.lang.Integer,java.lang.Boolean> clause)
Creates a filtered observable where only Ts are relayed which satisfy the clause.
|
static <T> Observable<T> |
whereLong(Observable<? extends T> source,
Func2<? super T,? super java.lang.Long,java.lang.Boolean> clause)
Creates a filtered observable where only Ts are relayed which satisfy the clause.
|
static <T> Observable<T> |
whileDo(Observable<? extends T> source,
Func0<java.lang.Boolean> condition)
Repeatedly registers with the source observable
if the condition holds on registration.
|
static <T,U> Observable<Observable<T>> |
window(Observable<? extends T> source,
Func0<? extends Observable<U>> windowClosingSelector)
Splits the source stream into separate observables once
the windowClosing fires an event.
|
static <T> Observable<Observable<T>> |
window(Observable<? extends T> source,
int size)
Project the source sequence to
non-overlapping windows with the given
size.
|
static <T> Observable<Observable<T>> |
window(Observable<? extends T> source,
int size,
int skip)
Project the source sequence to
potentially overlapping windows whose
start is determined by skip and lengths
by size.
|
static <T> Observable<Observable<T>> |
window(Observable<? extends T> source,
int size,
long timespan,
java.util.concurrent.TimeUnit unit)
Projects each element into a window that
is completed by either its full or the specified
amount of time elapsed.
|
static <T> Observable<Observable<T>> |
window(Observable<? extends T> source,
int size,
long timespan,
java.util.concurrent.TimeUnit unit,
Scheduler pool)
Projects each element into a window that
is completed by either its full or the specified
amount of time elapsed.
|
static <T> Observable<Observable<T>> |
window(Observable<? extends T> source,
long timespan,
long timeshift,
java.util.concurrent.TimeUnit unit)
Projects elements from the source observable
into zero or more windows which are produced
based on timing information.
|
static <T> Observable<Observable<T>> |
window(Observable<? extends T> source,
long timespan,
long timeshift,
java.util.concurrent.TimeUnit unit,
Scheduler pool)
Projects elements from the source observable
into zero or more windows which are produced
based on timing information and run
on the specified scheduler.
|
static <T> Observable<Observable<T>> |
window(Observable<? extends T> source,
long timespan,
java.util.concurrent.TimeUnit unit)
Projects elements from the source observable
into distinct windows which are produced
based on timing information.
|
static <T> Observable<Observable<T>> |
window(Observable<? extends T> source,
long timespan,
java.util.concurrent.TimeUnit unit,
Scheduler pool)
Projects elements from the source observable
into zero or more windows which are produced
based on timing information and run
on the specified scheduler.
|
static <T,U,V> Observable<Observable<T>> |
window(Observable<? extends T> source,
Observable<? extends U> windowOpening,
Func1<? super U,? extends Observable<V>> windowClosing)
Splits the source stream into separate observables
by starting at windowOpening events and closing at windowClosing events.
|
static <T,U> Observable<Observable<T>> |
window(Observable<? extends T> source,
Observable<U> boundary)
Projects the source elements into a non-overlapping consecutive windows.
|
static <T> Func1<T,Timestamped<T>> |
wrapTimestamped()
Wrap the given type into a timestamped container of T.
|
static <T> Observable<java.util.List<T>> |
zip(java.lang.Iterable<? extends Observable<? extends T>> srcs)
Combine the incoming Ts of the various observables into a single list of Ts like
using zip() on more than two sources.
|
static <T,U> Observable<U> |
zip(java.lang.Iterable<? extends Observable<? extends T>> srcs,
Func1<? super java.util.List<T>,? extends U> selector)
Combine the incoming Ts of the various observables into a
single value stream by the given selector.
|
static <T,U,V> Observable<V> |
zip(Observable<? extends T> left,
java.lang.Iterable<? extends U> right,
Func2<? super T,? super U,? extends V> selector)
Creates an observable which waits for events from left
and combines it with the next available value from the iterable,
applies the selector function and emits the resulting T.
|
static <T,U,V> Observable<V> |
zip(Observable<? extends T> left,
Observable<? extends U> right,
Func2<? super T,? super U,? extends V> selector)
Creates an observable which waits for events from left
and combines it with the next available value from the right observable,
applies the selector function and emits the resulting T.
|
static <T> Observable<java.util.List<T>> |
zip(Observable<? extends T> src,
T constant)
Combine a stream of Ts with a constant T whenever the src fires.
|
static <T> Observable<java.util.List<T>> |
zip(T constant,
Observable<? extends T> src)
Combine a constant T with a stream of Ts whenever the src fires.
|
@Nonnull public static CloseableObservable<java.lang.Long> activeTick(long start, long end, long time, @Nonnull java.util.concurrent.TimeUnit unit)
start - the start of the counterend - the end of the countertime - the initial and between delay of the ticksunit - the time unit of the ticks@Nonnull public static CloseableObservable<java.lang.Long> activeTick(long start, long end, long time, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler scheduler)
start - the start of the counterend - the end of the countertime - the initial and between delay of the ticksunit - the time unit of the ticksscheduler - the scheduler where the ticks are performed@Nonnull public static <T> Observable<TimeInterval<T>> addTimeInterval(@Nonnull Observable<? extends T> source)
T - the time sourcesource - the source of Ts@Nonnull public static <T> Observable<Timestamped<T>> addTimestamped(@Nonnull Observable<? extends T> source)
T - the element typesource - the source which has its elements in a timestamped way.@Nonnull public static <T> Observable<T> aggregate(@Nonnull Observable<? extends T> source, @Nonnull Func2<? super T,? super T,? extends T> accumulator)
If the source observable terminates before sending a single value, the output observable terminates as well. The first incoming value is relayed as-is.
T - the element typesource - the source observableaccumulator - the accumulator function where the first parameter is the current accumulated value and the second is the now received value.@Nonnull public static <T,U,V> Observable<V> aggregate(@Nonnull Observable<? extends T> source, @Nonnull Func2<? super U,? super T,? extends U> accumulator, @Nonnull Func2<? super U,? super java.lang.Integer,? extends V> divide)
T - the type of the valuesU - the type of the intermediate sum valueV - the type of the final average valuesource - the source of BigDecimals to aggregate.accumulator - the function which accumulates the input Ts. The first received T will be accompanied by a null U.divide - the function which perform the final division based on the number of elements@Nonnull public static <T,U> Observable<U> aggregate(@Nonnull Observable<? extends T> source, U seed, @Nonnull Func2<? super U,? super T,? extends U> accumulator)
T - the input element typeU - the output element typesource - the source observableseed - the initial value of the accumulatoraccumulator - the accumulator function where the first parameter is the current accumulated value and the second is the now received value.@Nonnull public static <T,U,V> Observable<V> aggregate(@Nonnull Observable<? extends T> source, U seed, @Nonnull Func2<? super U,? super T,? extends U> accumulator, @Nonnull Func1<? super U,? extends V> resultSelector)
T - the incoming value typeU - the aggregation intermediate typeV - the result typesource - the sourceseed - the initial value for the aggregationaccumulator - the accumulation functionresultSelector - the result selector@Nonnull public static <T,U,V> Observable<V> aggregate(@Nonnull Observable<? extends T> source, U seed, @Nonnull Func2<? super U,? super T,? extends U> accumulator, @Nonnull Func2<? super U,? super java.lang.Integer,? extends V> divide)
T - the type of the valuesU - the type of the intermediate sum valueV - the type of the final average valuesource - the source of BigDecimals to aggregate.seed - the initieal value for the aggregationaccumulator - the function which accumulates the input Ts. The first received T will be accompanied by a null U.divide - the function which perform the final division based on the number of elements@Nonnull public static <T> Observable<java.lang.Boolean> all(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,java.lang.Boolean> predicate)
T - the type of the source datasource - the source observablepredicate - the predicate to satisfy@Nonnull public static <T> Observable<T> amb(@Nonnull java.lang.Iterable<? extends Observable<? extends T>> sources)
O3 = Amb(O1, O2) if O1 starts
to submit events first, O3 will relay these events
and events of O2 will be completely ignoredT - the type of the observed elementsources - the iterable list of source observables.@Nonnull public static <T> Observable<T> amb(@Nonnull Observable<? extends T>... sources)
O3 = Amb(O1, O2) if O1 starts
to submit events first, O3 will relay these events
and events of O2 will be completely ignoredT - the type of the observed elementsources - the array of source observables.@Nonnull public static <T> Observable<T> amb(@Nonnull Observable<? extends T> left, @Nonnull Observable<? extends T> right)
T - the observed value typeleft - the left observableright - the right observable@Nonnull public static <T> Observable<java.lang.Boolean> any(@Nonnull Observable<T> source)
T - the element typesource - the source@Nonnull public static <T> Observable<java.lang.Boolean> any(@Nonnull Observable<T> source, @Nonnull Func1<? super T,java.lang.Boolean> predicate)
T - the source element type.source - the source observablepredicate - the predicate to test the values@Nonnull public static Observable<java.math.BigDecimal> averageBigDecimal(@Nonnull Observable<java.math.BigDecimal> source)
source - the source of BigDecimals to aggregate.@Nonnull public static Observable<java.math.BigDecimal> averageBigInteger(@Nonnull Observable<java.math.BigInteger> source)
source - the source of BigIntegers to aggregate.@Nonnull public static Observable<java.lang.Double> averageDouble(@Nonnull Observable<java.lang.Double> source)
source - the source of Doubles to aggregate.@Nonnull public static Observable<java.lang.Float> averageFloat(@Nonnull Observable<java.lang.Float> source)
source - the source of Floats to aggregate.@Nonnull public static Observable<java.lang.Double> averageInt(@Nonnull Observable<java.lang.Integer> source)
source - the source of integers to aggregate.@Nonnull public static Observable<java.lang.Double> averageLong(@Nonnull Observable<java.lang.Long> source)
source - the source of longs to aggregate.public static <T> T await(@Nonnull
Observable<? extends T> source)
T - the element typesource - the source sequence.The difference from the last operator is that
unlike last, this operator does not treat the error event
as just a termination signal.
last(Observable)public static <T> T await(@Nonnull
Observable<? extends T> source,
long time,
@Nonnull
java.util.concurrent.TimeUnit unit)
The difference from the last operator is that
unlike last, this operator does not treat the error event
as just a termination signal.
T - the element typesource - the source sequence.time - the wait timeunit - the wait time unitlast(Observable)public static <T,U> Observable<java.util.List<T>> buffer(@Nonnull Observable<? extends T> source, @Nonnull Func0<? extends Observable<U>> bufferCloseSelector)
T - the source and result element typeU - the window's own type (ignored)source - the source sequencebufferCloseSelector - the function that returns a buffer close observable
per registering party.@Nonnull public static <T> Observable<java.util.List<T>> buffer(@Nonnull Observable<? extends T> source, int bufferSize)
T - the type of the elementssource - the source observablebufferSize - the target buffer size@Nonnull public static <T> Observable<java.util.List<T>> buffer(@Nonnull Observable<? extends T> source, int bufferSize, int skip)
T - the type of the elementssource - the source observablebufferSize - the target buffer sizeskip - the number of elements to skip between buffers.@Nonnull public static <T> Observable<java.util.List<T>> buffer(@Nonnull Observable<? extends T> source, int bufferSize, long time, @Nonnull java.util.concurrent.TimeUnit unit)
T - the type of the valuessource - the source observablebufferSize - the allowed buffer sizetime - the time value to wait betveen buffer fillsunit - the time unit@Nonnull public static <T> Observable<java.util.List<T>> buffer(@Nonnull Observable<? extends T> source, int bufferSize, long time, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler pool)
T - the type of the valuessource - the source observablebufferSize - the allowed buffer sizetime - the time value to wait between buffer fillsunit - the time unitpool - the pool where to schedule the buffer splits@Nonnull public static <T> Observable<java.util.List<T>> buffer(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit)
T - the type of elements to observesource - the source of Ts.time - the time value to split the buffer contents.unit - the time unit of the time@Nonnull public static <T> Observable<java.util.List<T>> buffer(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler pool)
T - the type of elements to observesource - the source of Ts.time - the time value to split the buffer contents.unit - the time unit of the timepool - the scheduled execution pool to usepublic static <T,U,V> Observable<java.util.List<T>> buffer(@Nonnull Observable<? extends T> source, @Nonnull Observable<? extends U> windowOpening, @Nonnull Func1<? super U,? extends Observable<V>> windowClosing)
Exception semantics: if any Observable throws an error, the whole process terminates with error.
T - the source and result element typeU - the buffer opening selector typeV - the buffer closing element type (irrelevant)source - the source sequencewindowOpening - the window-open observablewindowClosing - the function that returns a window-close observable
for a value from the window-openpublic static <T,U> Observable<java.util.List<T>> buffer(@Nonnull Observable<? extends T> source, @Nonnull Observable<U> boundary)
Exception semantics: if any Observable throws an error, the whole process terminates with error.
T - the source and result element typeU - the window's own type (ignored)source - the source sequenceboundary - the notification source of the boundary@Nonnull public static <T> Observable<T> cast(@Nonnull Observable<?> source)
Note that generics information is erased, the actual exception might come from much deeper of the operator chain.
T - the type of the expected valuessource - the source of unknown elements@Nonnull public static <T> Observable<T> cast(@Nonnull Observable<?> source, @Nonnull java.lang.Class<T> token)
T - the type of the expected valuessource - the source of unknown elementstoken - the token to test agains the elements@Nonnull public static <T> CloseableIterable<java.util.List<T>> chunkify(@Nonnull Observable<? extends T> source)
T - element typesource - the source sequence@Nonnull public static <T,U> CloseableIterable<U> collect(@Nonnull Observable<? extends T> source, @Nonnull Func0<? extends U> newCollector, @Nonnull Func2<? super U,? super T,? extends U> merge)
T - the source typeU - the result typesource - the source sequencenewCollector - the factory method for the current collectormerge - the merger that combines elements@Nonnull public static <T,U> CloseableIterable<U> collect(@Nonnull Observable<? extends T> source, @Nonnull Func0<? extends U> initialCollector, @Nonnull Func2<? super U,? super T,? extends U> merge, @Nonnull Func1<? super U,? extends U> newCollector)
T - the source element typeU - the result element typesource - the source sequenceinitialCollector - the initial collector factorymerge - the merger operatornewCollector - the factory to replace the current collector@Nonnull public static <T> Observable<java.util.List<T>> combine(@Nonnull Func0<? extends T> supplier, @Nonnull Observable<? extends T> src)
T - the element typesupplier - the function that returns a valuesrc - the source of Ts@Nonnull public static <T,U,V> Observable<V> combineLatest(@Nonnull Observable<? extends T> left, @Nonnull Observable<? extends U> right, @Nonnull Func2<? super T,? super U,? extends V> selector)
Exception semantics: if any stream throws an exception, the output stream throws an exception and all registrations are terminated.
Completion semantics: The output stream terminates after both streams terminate.
The function will start combining the values only when both sides have already sent a value.
T - the left element typeU - the right element typeV - the result element typeleft - the left streamright - the right streamselector - the function which combines values from both streams and returns a new value@Nonnull public static <T,U,V> Observable<V> combineLatest0(@Nonnull Observable<? extends T> left, @Nonnull Observable<? extends U> right, @Nonnull Func2<? super T,? super U,? extends V> selector)
Exception semantics: if any stream throws an exception, the output stream throws an exception and all registrations are terminated.
Completion semantics: The output stream terminates after both streams terminate.
Note that at the beginning, when the left or right fires first, the selector function
will receive (value, null) or (null, value). If you want to react only in cases when both have sent
a value, use the combineLatest(Observable, Observable, Func2) method.
T - the left element typeU - the right element typeV - the result element typeleft - the left streamright - the right streamselector - the function which combines values from both streams and returns a new value@Nonnull public static <T,U> Observable<U> concat(@Nonnull Func1<? super T,? extends Observable<? extends U>> resultSelector, @Nonnull T... source)
Remark: RX calls this For.
T - the source element typeU - the result typeresultSelector - the observable selectorsource - the source sequence@Nonnull public static <T,U> Observable<U> concat(@Nonnull Func2<? super T,? super java.lang.Integer,? extends Observable<? extends U>> resultSelector, @Nonnull T... source)
Remark: RX calls this For.
T - the source element typeU - the result typeresultSelector - the observable selectorsource - the source sequence@Nonnull public static <T> Observable<T> concat(@Nonnull java.lang.Iterable<? extends Observable<? extends T>> sources)
If the sources sequence is empty, a no-op observable is returned.
Note that the source iterable is not consumed up front but as the individual observables complete, therefore the Iterator methods might be called from any thread.
T - the type of the values to observesources - the source list of subsequent observables@Nonnull public static <T,U> Observable<U> concat(@Nonnull java.lang.Iterable<? extends T> source, @Nonnull Func1<? super T,? extends Observable<? extends U>> resultSelector)
Remark: RX calls this For.
T - the source element typeU - the result typesource - the source sequenceresultSelector - the observable selector@Nonnull public static <T,U> Observable<U> concat(@Nonnull java.lang.Iterable<? extends T> source, @Nonnull Func2<? super T,? super java.lang.Integer,? extends Observable<? extends U>> resultSelector)
Remark: RX calls this For.
T - the source element typeU - the result typesource - the source sequenceresultSelector - the observable selector@Nonnull public static <T> Observable<T> concat(@Nonnull Observable<? extends Observable<? extends T>> sources)
Exception semantics: if the sources or any inner observer signals an error, the outer observable will signal that error and the sequence is terminated.
T - the element typesources - the observable sequence of the observable sequence of Ts.@Nonnull public static <T,U> Observable<U> concat(@Nonnull Observable<? extends Observable<? extends T>> sources, @Nonnull Func1<? super Observable<? extends T>,? extends Observable<? extends U>> resultSelector)
Exception semantics: if the sources or any inner observer signals an error, the outer observable will signal that error and the sequence is terminated.
T - the source element typeU - the result element typesources - the observable sequence of the observable sequence of Ts.resultSelector - the concatenation result selector@Nonnull public static <T,U> Observable<U> concat(@Nonnull Observable<? extends Observable<? extends T>> sources, @Nonnull Func2<? super Observable<? extends T>,? super java.lang.Integer,? extends Observable<? extends U>> resultSelector)
Exception semantics: if the sources or any inner observer signals an error, the outer observable will signal that error and the sequence is terminated.
T - the source element typeU - the result element typesources - the observable sequence of the observable sequence of Ts.resultSelector - the indexed concatenation result selector@Nonnull public static <T> Observable<T> concat(@Nonnull Observable<? extends T>... sources)
If the sources sequence is empty, a no-op observable is returned.
Note that the source iterable is not consumed up front but as the individual observables complete, therefore the Iterator methods might be called from any thread.
T - the type of the values to observesources - the source list of subsequent observables@Nonnull public static <T> Observable<T> concat(@Nonnull Observable<? extends T> first, @Nonnull Observable<? extends T> second)
T - the type of the elementsfirst - the first observablesecond - the second observable@Nonnull public static <T> Observable<java.lang.Boolean> contains(@Nonnull Observable<? extends T> source, @Nonnull Func0<? extends T> supplier)
T - the type of the observed valuessource - the source observablesupplier - the supplier for the value containment test@Nonnull public static <T> Observable<java.lang.Boolean> contains(@Nonnull Observable<? extends T> source, T value)
T - the type of the observed valuessource - the source observablevalue - the value to look for@Nonnull public static <T> Observable<java.lang.Integer> count(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,java.lang.Boolean> predicate)
T - the element typesource - the source sequence of Tspredicate - the predicate function@Nonnull public static <T> Observable<java.lang.Integer> count(@Nonnull Observable<T> source)
T - the element typesource - the source observable@Nonnull public static <T> Observable<java.lang.Long> countLong(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,java.lang.Boolean> predicate)
T - the element typesource - the source sequence of Tspredicate - the predicate function@Nonnull public static <T> Observable<java.lang.Long> countLong(@Nonnull Observable<T> source)
T - the element typesource - the source observable@Nonnull public static <T> Observable<T> debugState(@Nonnull Observable<? extends T> source)
T - the element type.source - the source observable@Nonnull public static <T> Observable<T> defaultIfEmpty(@Nonnull Observable<? extends T> source, Func0<? extends T> defaultValueFunc)
T - the element typesource - the source sequencedefaultValueFunc - the default value factory@Nonnull public static <T> Observable<T> defaultIfEmpty(@Nonnull Observable<? extends T> source, T defaultValue)
T - the element typesource - the source sequencedefaultValue - the default value@Nonnull public static <T> Observable<T> defer(@Nonnull Func0<? extends Observable<? extends T>> observableFactory)
observableFactory whenever an observer
tries to register with it.T - the type of elements to observerobservableFactory - the factory which is responsible to create a source observable.public static <T,U> Observable<T> delay(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Observable<U>> delaySelector)
Exception semantics: Exceptions appearing through any observable will terminate the sequence immediately.
T - the source and result element typeU - the element type of the registration delaying observable, irrelevantsource - the source sequencedelaySelector - for each source value T, it returns an observable
whose next or finish events will deliver the original value T.@Nonnull public static <T> Observable<T> delay(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit)
T - the type of elementssource - the source of Tstime - the time valueunit - the time unit@Nonnull public static <T> Observable<T> delay(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler pool)
Exceptions are delivered to observers without delay and any outstanding next events will be discarded.
T - the type of elementssource - the source of Tstime - the time valueunit - the time unitpool - the pool to use for schedulingpublic static <T,U,V> Observable<T> delay(@Nonnull Observable<? extends T> source, @Nonnull Observable<U> registerDelay, @Nonnull Func1<? super T,? extends Observable<V>> delaySelector)
Exception semantics: Exceptions appearing through any observable will terminate the sequence immediately.
T - the source and result element typeU - the element type of the registration delaying observable, irrelevantV - the element type of the value delivery observables, irrelevantsource - the source sequenceregisterDelay - the actual registration to the source
is delayed by the first next or finish event from this observable.delaySelector - for each source value T, it returns an observable
whose next or finish events will deliver the original value T.public static <T> Observable<T> delayRegister(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit)
T - the element typesource - the source observable.time - the time to waitunit - the time unit@Nonnull public static <T> Observable<T> delayRegister(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler pool)
T - the element typesource - the source observable.time - the time to waitunit - the time unitpool - the scheduler pool where to wait.@Nonnull public static <T> Observable<T> dematerialize(@Nonnull Observable<? extends Option<T>> source)
next* (error|finish)? pattern,
which ensures that no further options are relayed after an error or finish.T - the source element typesource - the source of Tsmaterialize(Observable)public static <T> void dispatch(@Nonnull
Observer<? super T> observer,
@Nonnull
Option<T> value)
T - the value typeobserver - the observervalue - the value to dispatch@Nonnull public static <T> Observable<T> distinct(@Nonnull Observable<? extends T> source)
T - the element typesource - the source sequence@Nonnull public static <T,U> Observable<T> distinct(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends U> keyExtractor)
T - the source and result element typeU - the key typesource - the source sequencekeyExtractor - the key extractor@Nonnull public static <T,U> Observable<T> distinct(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends U> keyExtractor, @Nonnull Func2<? super U,? super U,java.lang.Boolean> keyComparer)
T - the source and result element typeU - the key typesource - the source sequencekeyExtractor - the key extractor functionkeyComparer - the key comparer function.@Nonnull public static <T> Observable<T> distinct(@Nonnull Observable<? extends T> source, @Nonnull Func2<? super T,? super T,java.lang.Boolean> comparer)
T - the element typesource - the source sequencecomparer - the element comparer@Nonnull public static <T> Observable<T> doWhile(@Nonnull Observable<? extends T> source, @Nonnull Func0<java.lang.Boolean> condition)
Exception semantics: exception received will stop the repeat process and is delivered to observers as-is.
T - the element typesource - the source sequencecondition - the condition to check@Nonnull public static <T> Observable<java.lang.Void> drain(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Observable<java.lang.Void>> pump)
T - the type of the valuessource - the source of Tspump - the pump that drains the queue@Nonnull public static <T> Observable<java.lang.Void> drain(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Observable<java.lang.Void>> pump, @Nonnull Scheduler pool)
T - the type of the valuessource - the source of Tspump - the pump that drains the queuepool - the pool for the drain@Nonnull public static <T> Observable<T> elementAt(@Nonnull Observable<? extends T> source, int index)
Exception semantics: errors from source are propagated as-is.
T - the element typesource - the source sequence of Tsindex - the index to look at@Nonnull public static <T> Observable<T> elementAt(@Nonnull Observable<? extends T> source, int index, @Nonnull Func0<? extends T> defaultSupplier)
Exception semantics: errors from source are propagated as-is.
T - the element typesource - the source sequence of Tsindex - the index to look atdefaultSupplier - the function that will supply the default value@Nonnull public static <T> Observable<T> elementAt(@Nonnull Observable<? extends T> source, int index, T defaultValue)
Exception semantics: errors from source are propagated as-is.
T - the element typesource - the source sequence of Tsindex - the index to look atdefaultValue - the value to return if the sequence is sorter than index@Nonnull public static <T> Observable<T> empty()
T - the type of the values to observe (irrelevant)@Nonnull public static <T> Observable<T> empty(@Nonnull Scheduler pool)
T - the expected type, (irrelevant)pool - the pool to invoke the the finish()@Nonnull public static <T> Observable<T> finish(@Nonnull Observable<? extends T> source, @Nonnull Action0 action)
T - the type of the observed valuessource - the source of Tsaction - the action to invoke on finish() or error()public static <T> T first(@Nonnull
Observable<? extends T> source)
T - the type of the elementssource - the source of Tspublic static <T> T first(@Nonnull
Observable<? extends T> source,
@Nonnull
Func0<? extends T> defaultSupplier)
T - the element typesource - the source of TsdefaultSupplier - the value to return if the source is emptypublic static <T> T first(@Nonnull
Observable<? extends T> source,
T defaultValue)
T - the element typesource - the source of TsdefaultValue - the value to return if the source is empty@Nonnull public static <T> Observable<T> firstAsync(@Nonnull Observable<? extends T> source)
Exception semantics: errors from source are propagated as-is.
T - the element typesource - the source sequence@Nonnull public static <T> Observable<T> firstAsync(@Nonnull Observable<? extends T> source, @Nonnull Func0<? extends T> defaultSupplier)
Exception semantics: errors from source are propagated as-is.
T - the element typesource - the source sequencedefaultSupplier - the default value supplier@Nonnull public static <T> Observable<T> firstAsync(@Nonnull Observable<? extends T> source, T defaultValue)
Exception semantics: errors from source are propagated as-is.
T - the element typesource - the source sequencedefaultValue - the default value to returnpublic static <T> void forEach(@Nonnull
Observable<T> source,
@Nonnull
Action1<? super T> action)
throws java.lang.InterruptedException
The observation of the source is not serialized,
therefore, action might be invoked concurrently
by subsequent source elements.
T - the element typesource - the source sequenceaction - the action to invoke on each element.java.lang.InterruptedException - if the wait is interruptedpublic static <T> boolean forEach(@Nonnull
Observable<T> source,
@Nonnull
Action1<? super T> action,
long time,
@Nonnull
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
The observation of the source is not serialized,
therefore, action might be invoked concurrently
by subsequent source elements.
T - the element typesource - the source sequenceaction - the action to invoke on each element.time - the waiting timeunit - the waiting time unitjava.lang.InterruptedException - if the wait is interruptedpublic static <T> void forEach(@Nonnull
Observable<T> source,
@Nonnull
Action2<? super T,? super java.lang.Integer> action)
throws java.lang.InterruptedException
The observation of the source is not serialized,
therefore, action might be invoked concurrently
by subsequent source elements.
T - the element typesource - the source sequenceaction - the action to invoke on each element.java.lang.InterruptedException - if the wait is interruptedpublic static <T> boolean forEach(@Nonnull
Observable<T> source,
@Nonnull
Action2<? super T,? super java.lang.Integer> action,
long time,
@Nonnull
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
The observation of the source is not serialized,
therefore, action might be invoked concurrently
by subsequent source elements.
T - the element typesource - the source sequenceaction - the action to invoke on each element.time - the waiting timeunit - the waiting time unitjava.lang.InterruptedException - if the wait is interrupted@Nonnull public static <T> Observable<java.util.List<T>> forkJoin(@Nonnull java.lang.Iterable<? extends Observable<? extends T>> sources)
T - the type of the source valuessources - the list of sources@Nonnull public static <T> Observable<java.util.List<T>> forkJoin(@Nonnull Observable<? extends T>... sources)
T - the type of the source valuessources - the list of sources@Nonnull public static <T,U> Observable<U> generate(T initial, @Nonnull Func1<? super T,java.lang.Boolean> condition, @Nonnull Func1<? super T,? extends T> next, @Nonnull Func1<? super T,? extends U> selector)
for (int i = 0; i < 10; i++) { yield return i / 2.0; }T - the type of the generator valuesU - the type of the observed valuesinitial - the initial generator valuecondition - the condition that must hold to continue generating Tsnext - the function that computes the next value of Tselector - the selector which turns Ts into Us.@Nonnull public static <T,U> Observable<U> generate(T initial, @Nonnull Func1<? super T,java.lang.Boolean> condition, @Nonnull Func1<? super T,? extends T> next, @Nonnull Func1<? super T,? extends U> selector, @Nonnull Scheduler pool)
for (int i = 0; i < 10; i++) { yield return i / 2.0; }T - the type of the generator valuesU - the type of the observed valuesinitial - the initial generator valuecondition - the condition that must hold to continue generating Tsnext - the function that computes the next value of Tselector - the selector which turns Ts into Us.pool - the thread pool where the generation loop should run.@Nonnull public static <T,U> Observable<Timestamped<U>> generateTimed(T initial, @Nonnull Func1<? super T,java.lang.Boolean> condition, @Nonnull Func1<? super T,? extends T> next, @Nonnull Func1<? super T,? extends U> selector, @Nonnull Func1<? super T,java.lang.Long> delay)
for (int i = 0; i < 10; i++) { sleep(time); yield return i / 2.0; }T - the type of the generator valuesU - the type of the observed valuesinitial - the initial generator valuecondition - the condition that must hold to continue generating Tsnext - the function that computes the next value of Tselector - the selector which turns Ts into Us.delay - the selector which tells how much to wait before releasing the next U@Nonnull public static <T,U> Observable<Timestamped<U>> generateTimed(T initial, @Nonnull Func1<? super T,java.lang.Boolean> condition, @Nonnull Func1<? super T,? extends T> next, @Nonnull Func1<? super T,? extends U> selector, @Nonnull Func1<? super T,java.lang.Long> delay, @Nonnull Scheduler pool)
for (int i = 0; i < 10; i++) { sleep(time); yield return i / 2.0; }T - the type of the generator valuesU - the type of the observed valuesinitial - the initial generator valuecondition - the condition that must hold to continue generating Tsnext - the function that computes the next value of Tselector - the selector which turns Ts into Us.delay - the selector which tells how much to wait (in milliseconds) before releasing the next Upool - the scheduled pool where the generation loop should run.@Nonnull public static <T,U> Observable<Timestamped<U>> generateTimedWithUnit(T initial, @Nonnull Func1<? super T,java.lang.Boolean> condition, @Nonnull Func1<? super T,? extends T> next, @Nonnull Func1<? super T,? extends U> selector, @Nonnull Func1<? super T,Pair<java.lang.Long,java.util.concurrent.TimeUnit>> delay, @Nonnull Scheduler pool)
for (int i = 0; i < 10; i++) { sleep(time); yield return i / 2.0; }T - the type of the generator valuesU - the type of the observed valuesinitial - the initial generator valuecondition - the condition that must hold to continue generating Tsnext - the function that computes the next value of Tselector - the selector which turns Ts into Us.delay - the selector which returns a pair of time and timeunit that
tells how much time to wait before releasing the next Upool - the scheduled pool where the generation loop should run.@Nonnull public static <T,Key> Observable<GroupedObservable<Key,T>> groupBy(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Key> keyExtractor)
T - the type of the source elementKey - the key type of the groupsource - the source of TskeyExtractor - the key extractor which creates Keys from Ts@Nonnull public static <T,U,Key> Observable<GroupedObservable<Key,U>> groupBy(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Key> keyExtractor, @Nonnull Func1<? super T,? extends U> valueExtractor)
Exception semantics: if the source sends an exception, the group observable and the individual groups' observables receive this error.
T - the type of the source elementU - the type of the output elementKey - the key type of the groupsource - the source of TskeyExtractor - the key extractor which creates Keys from TsvalueExtractor - the extractor which makes Us from Ts@Nonnull public static <T,Key> Observable<GroupedObservable<Key,T>> groupBy(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Key> keyExtractor, @Nonnull Func2<? super Key,? super Key,java.lang.Boolean> keyComparer)
T - the type of the source elementKey - the key type of the groupsource - the source of TskeyExtractor - the key extractor which creates Keys from TskeyComparer - the key equality comparer@Nonnull public static <T,U,Key> Observable<GroupedObservable<Key,U>> groupBy(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Key> keyExtractor, @Nonnull Func2<? super Key,? super Key,java.lang.Boolean> keyComparer, @Nonnull Func1<? super T,? extends U> valueExtractor)
Exception semantics: if the source sends an exception, the group observable and the individual groups' observables receive this error.
T - the type of the source elementU - the type of the output elementKey - the key type of the groupsource - the source of TskeyExtractor - the key extractor which creates Keys from TskeyComparer - the key equality comparervalueExtractor - the extractor which makes Us from Ts@Nonnull public static <T,K,D> Observable<GroupedObservable<K,T>> groupByUntil(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends K> keySelector, @Nonnull Func1<? super GroupedObservable<K,T>,? extends Observable<D>> durationSelector)
The key comparison is done by the Object.equals() semantics of the HashMap.
Exception semantics: if the source throws an exception, all active groups will receive the exception followed by the outer observer of the groups.
Completion semantics: if the source finishes, all active groups will receive a finish signal followed by the outer observer.
T - the source element typeK - the key typeD - the duration element type, ignoredsource - the source of TskeySelector - the key extractordurationSelector - the observable for a particular group termination@Nonnull public static <T,K,D> Observable<GroupedObservable<K,T>> groupByUntil(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends K> keySelector, @Nonnull Func1<? super GroupedObservable<K,T>,? extends Observable<D>> durationSelector, @Nonnull Func2<? super K,? super K,java.lang.Boolean> keyComparer)
Exception semantics: if the source throws an exception, all active groups will receive the exception followed by the outer observer of the groups.
Completion semantics: if the source finishes, all active groups will receive a finish signal followed by the outer observer.
T - the source element typeK - the key typeD - the duration element type, ignoredsource - the source of TskeySelector - the key extractordurationSelector - the observable for a particular group terminationkeyComparer - the key comparer for the grouping@Nonnull public static <T,K,V,D> Observable<GroupedObservable<K,V>> groupByUntil(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends K> keySelector, @Nonnull Func1<? super T,? extends V> valueSelector, @Nonnull Func1<? super GroupedObservable<K,V>,? extends Observable<D>> durationSelector)
The key comparison is done by the Object.equals() semantics of the HashMap.
Exception semantics: if the source throws an exception, all active groups will receive the exception followed by the outer observer of the groups.
Completion semantics: if the source finishes, all active groups will receive a finish signal followed by the outer observer.
T - the source element typeK - the key typeV - the value typeD - the duration element type, ignoredsource - the source of TskeySelector - the key extractorvalueSelector - the value extractordurationSelector - the observable for a particular group termination@Nonnull public static <T,K,V,D> Observable<GroupedObservable<K,V>> groupByUntil(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends K> keySelector, @Nonnull Func1<? super T,? extends V> valueSelector, @Nonnull Func1<? super GroupedObservable<K,V>,? extends Observable<D>> durationSelector, @Nonnull Func2<? super K,? super K,java.lang.Boolean> keyComparer)
Exception semantics: if the source throws an exception, all active groups will receive the exception followed by the outer observer of the groups.
Completion semantics: if the source finishes, all active groups will receive a finish signal followed by the outer observer.
T - the source element typeK - the key typeV - the value typeD - the duration element type, ignoredsource - the source of TskeySelector - the key extractorvalueSelector - the value extractordurationSelector - the observable for a particular group terminationkeyComparer - the key comparer for the grouping@Nonnull public static <Left,Right,LeftDuration,RightDuration,Result> Observable<Result> groupJoin(@Nonnull Observable<? extends Left> left, @Nonnull Observable<? extends Right> right, @Nonnull Func1<? super Left,? extends Observable<LeftDuration>> leftDurationSelector, @Nonnull Func1<? super Right,? extends Observable<RightDuration>> rightDurationSelector, @Nonnull Func2<? super Left,? super Observable<? extends Right>,? extends Result> resultSelector)
Left - the element type of the left streamRight - the element type of the right streamLeftDuration - the overlapping duration indicator for the left stream (e.g., the event when it leaves)RightDuration - the overlapping duration indicator for the right stream (e.g., the event when it leaves)Result - the type of the grouping based on the coincidence.left - the left source of elementsright - the right source of elementsleftDurationSelector - the duration selector for a left elementrightDurationSelector - the duration selector for a right elementresultSelector - the selector which will produce the output valuejoin(Observable, Observable, Func1, Func1, Func2)@Nonnull public static <T> Observable<T> ifThen(@Nonnull Func0<java.lang.Boolean> condition, @Nonnull Observable<? extends T> then)
then source is allowed to submit values or else
an empty sequence is used.T - the type of the values to observecondition - the condition functionthen - the source to use when the condition is true@Nonnull public static <T> Observable<T> ifThen(@Nonnull Func0<java.lang.Boolean> condition, @Nonnull Observable<? extends T> then, @Nonnull Observable<? extends T> orElse)
then or orElse
source is allowed to submit values.T - the type of the values to observecondition - the condition functionthen - the source to use when the condition is trueorElse - the source to use when the condition is false@Nonnull public static <T> Observable<T> ifThen(@Nonnull Func0<java.lang.Boolean> condition, @Nonnull Observable<? extends T> then, @Nonnull Scheduler scheduler)
then source is allowed to submit values
or else an empty sequence is returned.T - the type of the values to observecondition - the condition functionthen - the source to use when the condition is truescheduler - the scheduler for the empty case.@Nonnull public static <T> Observable<T> ignoreValues(@Nonnull Observable<? extends T> source)
T - the source element typesource - the source of Ts@Nonnull public static Observable<java.lang.Long> intToLong(@Nonnull Observable<java.lang.Integer> source)
source - the source sequence@Nonnull public static <T> Observable<T> invoke(@Nonnull Observable<? extends T> source, @Nonnull Action1<? super T> action)
action might
have some effect on each individual Ts passing through this filter.
Rx: Do
T - the type of the values observedsource - the source of Tsaction - the action to invoke on every T@Nonnull public static <T> Observable<T> invoke(@Nonnull Observable<? extends T> source, @Nonnull Action1<? super T> onNext, @Nonnull Action0 onFinish)
T - the element typesource - the source sequenceonNext - the action for nextonFinish - the action for finish@Nonnull public static <T> Observable<T> invoke(@Nonnull Observable<? extends T> source, @Nonnull Action1<? super T> onNext, @Nonnull Action1<? super java.lang.Throwable> onError)
T - the element typesource - the source sequenceonNext - the action for nextonError - the action for error@Nonnull public static <T> Observable<T> invoke(@Nonnull Observable<? extends T> source, @Nonnull Action1<? super T> onNext, @Nonnull Action1<? super java.lang.Throwable> onError, @Nonnull Action0 onFinish)
T - the element typesource - the source sequenceonNext - the action for nextonError - the action for erroronFinish - the action for finish@Nonnull public static <T> Observable<T> invoke(@Nonnull Observable<? extends T> source, @Nonnull Observer<? super T> observer)
action might
have some effect on each individual Ts passing through this filter.T - the type of the values observedsource - the source of Tsobserver - the observer to invoke before any registered observers are called@Nonnull
public static <T> java.util.List<java.util.List<T>> invokeAll(@Nonnull
java.lang.Iterable<? extends Observable<? extends T>> sources)
throws java.lang.InterruptedException
T - the common element typesources - the source sequencesjava.lang.InterruptedException - if the wait is interrupted@Nonnull
public static <T> java.util.List<java.util.List<T>> invokeAll(@Nonnull
java.lang.Iterable<? extends Observable<? extends T>> sources,
@Nonnull
Scheduler scheduler)
throws java.lang.InterruptedException
T - the common element typesources - the source sequencesscheduler - the schedulerjava.lang.InterruptedException - if the wait is interrupted@Nonnull
public static <T> java.util.List<java.util.List<T>> invokeAll(@Nonnull
Observable<? extends T>... sources)
throws java.lang.InterruptedException
T - the common element typesources - the source sequencesjava.lang.InterruptedException - if the wait is interrupted@Nonnull
public static <T> java.util.List<java.util.List<T>> invokeAll(@Nonnull
Observable<? extends T> source1,
@Nonnull
Observable<? extends T> source2)
throws java.lang.InterruptedException
T - the common element typesource1 - the first sourcesource2 - the second sourcejava.lang.InterruptedException - if the wait is interrupted@Nonnull
public static <T> java.util.List<java.util.List<T>> invokeAll(@Nonnull
Observable<? extends T> source1,
@Nonnull
Observable<? extends T> source2,
@Nonnull
Scheduler scheduler)
throws java.lang.InterruptedException
T - the common element typesource1 - the first sourcesource2 - the second sourcescheduler - the target schedulerjava.lang.InterruptedException - if the wait is interrupted@Nonnull public static <T> Observable<T> invokeAsync(@Nonnull java.util.concurrent.Callable<? extends T> call)
T - the return typecall - the callable@Nonnull public static <T> Observable<T> invokeAsync(@Nonnull java.util.concurrent.Callable<? extends T> call, @Nonnull Scheduler pool)
T - the return typecall - the callablepool - the thread pool@Nonnull public static <T> Observable<T> invokeAsync(@Nonnull java.lang.Runnable run)
T - the return typerun - the runnable@Nonnull public static <T> Observable<T> invokeAsync(@Nonnull java.lang.Runnable run, @Nonnull Scheduler pool)
T - the return typerun - the runnablepool - the thread pool@Nonnull public static <T> Observable<T> invokeAsync(@Nonnull java.lang.Runnable run, T defaultValue)
T - the return typerun - the runnabledefaultValue - the value to return when the Runnable completes@Nonnull public static <T> Observable<T> invokeAsync(@Nonnull java.lang.Runnable run, T defaultValue, @Nonnull Scheduler pool)
T - the return typerun - the runnablepool - the thread pooldefaultValue - the value to return by default@Nonnull public static Observable<java.lang.Boolean> isEmpty(@Nonnull Observable<?> source)
source - the source observable of any typepublic static <Left,Right,LeftDuration,RightDuration,Result> Observable<Result> join(Observable<? extends Left> left, Observable<? extends Right> right, Func1<? super Left,? extends Observable<LeftDuration>> leftDurationSelector, Func1<? super Right,? extends Observable<RightDuration>> rightDurationSelector, Func2<? super Left,? super Right,? extends Result> resultSelector)
The difference between this operator and the groupJoin operator is that in this case, the result selector takes the concrete left and right elements, whereas the groupJoin associates an observable of rights for each left.
Left - the element type of the left streamRight - the element type of the right streamLeftDuration - the overlapping duration indicator for the left stream (e.g., the event when it leaves)RightDuration - the overlapping duration indicator for the right stream (e.g., the event when it leaves)Result - the type of the grouping based on the coincidence.left - the left source of elementsright - the right source of elementsleftDurationSelector - the duration selector for a left elementrightDurationSelector - the duration selector for a right elementresultSelector - the selector which will produce the output valuegroupJoin(Observable, Observable, Func1, Func1, Func2)public static <T> T last(@Nonnull
Observable<? extends T> source)
Exception semantics: the exceptions thrown by the source are ignored and treated as termination signals.
The difference between this and the wait operator is that
it returns the last valid value from before an error or finish, ignoring any
exceptions.
T - the type of the elementssource - the source of Tsawait(Observable)public static <T> T last(@Nonnull
Observable<? extends T> source,
@Nonnull
Func0<? extends T> defaultSupplier)
Exception semantics: the exceptions thrown by the source are ignored and treated as termination signals.
T - the type of the elementssource - the source of TsdefaultSupplier - the function to provide the default valuepublic static <T> T last(@Nonnull
Observable<? extends T> source,
T defaultValue)
Exception semantics: the exceptions thrown by the source are ignored and treated as termination signals.
T - the type of the elementssource - the source of TsdefaultValue - the value to provide if the source is empty@Nonnull public static <T> Observable<T> lastAsync(@Nonnull Observable<? extends T> source)
Exception semantics: errors from source are propagated as-is.
T - the element typesource - the source of Ts@Nonnull public static <T> Observable<T> lastAsync(@Nonnull Observable<? extends T> source, @Nonnull Func0<? extends T> defaultSupplier)
Exception semantics: errors from source are propagated as-is.
T - the element typesource - the source of TsdefaultSupplier - the supplier to produce a value to return in case the source is empty@Nonnull public static <T> Observable<T> lastAsync(@Nonnull Observable<? extends T> source, T defaultValue)
Exception semantics: errors from source are propagated as-is.
T - the element typesource - the source of TsdefaultValue - the default value to return in case the source is empty@Nonnull public static <T> CloseableIterable<T> latest(@Nonnull Observable<? extends T> source)
Note that it is possible one doesn't receive the last value of a fixed-length observable sequence in case the last next() call is is quickly followed by a finish() event.
T - the type of the valuessource - the source@Nonnull public static <T,U> Observable<U> let(T value, @Nonnull Func1<? super T,? extends Observable<U>> selector)
return selector.invoke(value).register(observer) in the outer register method.T - the selection key typeU - the result typevalue - the value to pass to the selector functionselector - the selector function@Nonnull public static Observable<java.lang.Integer> longToInt(@Nonnull Observable<java.lang.Long> source)
source - the source sequence@Nonnull public static Observable<java.lang.Integer> longToInt(@Nonnull Observable<java.lang.Long> source, boolean overflow)
source - the source sequenceoverflow - report overflow as exceptions?@Nonnull public static <T,U> Observable<U> manySelect(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super Observable<T>,? extends Observable<U>> selector)
For example, a source sequence of (1, 2, 3) will create three function calls with (1, 2, 3), (2, 3) and (3) as a content. FIXME rework
T - the source element typeU - the result element typesource - the source of Tsselector - the selector function@Nonnull public static <T,U> Observable<U> manySelect(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super Observable<T>,? extends U> selector, @Nonnull Scheduler scheduler)
It is sometimes called the comonadic bind operator and compared to the ContinueWith semantics.
FIXME reworkT - the source element typeU - the result element typesource - the source of Tsselector - the selector that extracts an U from the series of Ts.scheduler - the scheduler where the extracted U will be emitted from.@Nonnull public static <T,U> Observable<U> manySelect0(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super Observable<T>,? extends U> selector)
T - the source element typeU - the result element typesource - the source of Tsselector - the selector that extracts an U from the series of Ts.@Nonnull public static <T> Observable<Option<T>> materialize(@Nonnull Observable<? extends T> source)
Option value.
The returned observable terminates once error or finish is received.
Its dual is the dematerialize method.
Note, before 0.97, this materialize sequence never terminated, but consulting with Rx, I changed its behavior to terminating. For unterminating version (usable for testing), use the materializeForever method.
T - the source element typesource - the source of TsmaterializeForever(Observable),
dematerialize(Observable)@Nonnull public static <T> Observable<Option<T>> materializeForever(@Nonnull Observable<? extends T> source)
Option value.
The returned observable never terminates on its own, providing an infinte stream of events.
Its dual is the dematerialize method.
For terminating version, see the materialize method.
T - the source element typesource - the source of Tsmaterialize(Observable),
dematerialize(Observable)@Nonnull public static <T extends java.lang.Comparable<? super T>> Observable<T> max(@Nonnull Observable<? extends T> source)
T - the element type which must be comparable to itselfsource - the source of integers@Nonnull public static <T> Observable<T> max(@Nonnull Observable<? extends T> source, @Nonnull java.util.Comparator<? super T> comparator)
T - the element typesource - the source of integerscomparator - the comparator to decide the relation of valuesFunctions.asComparator(Func2)@Nonnull public static <T,Key extends java.lang.Comparable<? super Key>> Observable<java.util.List<T>> maxBy(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Key> keyExtractor)
Ts which had their keys as maximums.
The returned observer may finish() if the source sends finish() without any next().
The generated list is modifiable.T - the type of elementsKey - the key type, which must be comparable to itselfsource - the source of TskeyExtractor - the key extractor to produce Keys from Ts.@Nonnull public static <T,Key> Observable<java.util.List<T>> maxBy(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Key> keyExtractor, @Nonnull java.util.Comparator<? super Key> keyComparator)
Ts which had their keys as maximums.
The returned observer may finish() if the source sends finish() without any next().
The generated list is modifiable.T - the type of elementsKey - the key typesource - the source of TskeyExtractor - the key extractor to produce Keys from Ts.keyComparator - the comparator for the keys@Nonnull public static <T> Observable<T> merge(@Nonnull java.lang.Iterable<? extends Observable<? extends T>> sources)
T - the type of the valuessources - the list of sourcespublic static <T> Observable<T> merge(Observable<? extends Observable<? extends T>> sources)
Exception semantics: if the sources or any inner observer signals an error, the outer observable will signal that error and all active source observers are terminated.
T - the element typesources - the observable sequence of observable sequence of Ts@Nonnull public static <T> Observable<T> merge(@Nonnull Observable<? extends T>... sources)
T - the type of the valuessources - the list of sources@Nonnull public static <T> Observable<T> merge(@Nonnull Observable<? extends T> first, @Nonnull Observable<? extends T> second)
T - the type of the elementsfirst - the first observablesecond - the second observable@Nonnull public static <T extends java.lang.Comparable<? super T>> Observable<T> min(@Nonnull Observable<? extends T> source)
T - the element type which must be comparable to itselfsource - the source of integers@Nonnull public static <T> Observable<T> min(@Nonnull Observable<? extends T> source, @Nonnull java.util.Comparator<? super T> comparator)
T - the element typesource - the source of integerscomparator - the comparator to decide the relation of valuesFunctions.asComparator(Func2)@Nonnull public static <T,Key extends java.lang.Comparable<? super Key>> Observable<java.util.List<T>> minBy(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Key> keyExtractor)
Ts which had their keys as minimums.
The returned observer may finish() if the source sends finish() without any next().
The generated list is modifiable.T - the type of elementsKey - the key type, which must be comparable to itselfsource - the source of TskeyExtractor - the key extractor to produce Keys from Ts.@Nonnull public static <T,Key> Observable<java.util.List<T>> minBy(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Key> keyExtractor, @Nonnull java.util.Comparator<? super Key> keyComparator)
Ts which had their keys as minimums.
The returned observer may finish() if the source sends finish() without any next().
The generated list is modifiable.T - the type of elementsKey - the key typesource - the source of TskeyExtractor - the key extractor to produce Keys from Ts.keyComparator - the comparator for the keysFunctions.asComparator(Func2)@Nonnull public static <T,Key> Observable<java.util.List<T>> minMax(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Key> keyExtractor, @Nonnull java.util.Comparator<? super Key> keyComparator, boolean max)
Ts which had their keys as maximums.
The returned observer may finish() if the source sends finish() without any next().
The generated list is modifiable.T - the type of elementsKey - the key typesource - the source of TskeyExtractor - the key extractor to produce Keys from Ts.keyComparator - the comparator for the keysmax - compute the maximums?Functions.asComparator(Func2)@Nonnull public static <T> CloseableIterable<T> mostRecent(@Nonnull Observable<? extends T> source, T initialValue)
The returned iterator throws UnsupportedOperationException for its remove() method.
T - the source element typesource - the source of TsinitialValue - the initial value to return until the source actually produces something.@Nonnull public static <T,U,V> Observable<V> multicast(@Nonnull Observable<? extends T> source, @Nonnull Func0<? extends Subject<? super T,? extends U>> subjectSelector, @Nonnull Func1<? super Observable<? extends U>,? extends Observable<? extends V>> selector)
T - the element type of the sourceU - the element type of the intermediate subject's outputV - the result typesource - the source sequence to be multicastedsubjectSelector - the factory function to create an intermediate
subject which through the source values will be multicasted.selector - the factory method to use the multicasted subject and enforce some policies on it@Nonnull public static <T,U> ConnectableObservable<U> multicast(@Nonnull Observable<? extends T> source, @Nonnull Subject<? super T,? extends U> subject)
Scenario: having a continuous source, the event sequence can be interrupted and reestablished at any time, during the time the registered observers won't receive any events.
T - the source element typeU - the type of the elements the observers will receivesource - the source observablesubject - the observer that receives the Ts and at the same time, the Observable that registers
observers for the Us.@Nonnull public static <T> Observable<T> never()
T - the type of the observable, irrelevant@Nonnull protected static <T> Func2<? super Option<T>,? super Option<T>,java.lang.Boolean> newOptionComparer(@Nonnull Func2<? super T,? super T,java.lang.Boolean> objectComparer)
T - the element typeobjectComparer - the objectComparer.@Nonnull public static <T> CloseableIterable<T> next(@Nonnull Observable<? extends T> source)
The returned iterator will throw an UnsupportedOperationException for its
remove() method.
Exception semantics: in case of exception received, the source is disconnected and the exception is rethrown from the iterator's next method as a wrapped RuntimeException if necessary.
T - the element typesource - the source of elements@Nonnull public static <T> Observable<T> observeOn(@Nonnull Observable<? extends T> source, @Nonnull Scheduler pool)
T - the type of the objects to observesource - the original observablepool - the target observablepublic static <T> Observable<T> ofType(@Nonnull Observable<?> source, @Nonnull java.lang.Class<T> clazz)
T - the target element typesource - the source sequenceclazz - the class token@Nonnull public static <T extends java.lang.Comparable<? super T>> Observable<T> orderBy(@Nonnull Observable<? extends T> source)
T - the source element type, must be self comparablesource - the source of Ts@Nonnull public static <T> Observable<T> orderBy(@Nonnull Observable<? extends T> source, @Nonnull java.util.Comparator<? super T> comparator)
T - the source element type, must be self comparablesource - the source of Tscomparator - the value comparator@Nonnull public static <T,U extends java.lang.Comparable<? super U>> Observable<T> orderBy(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends U> keySelector)
T - the source element typeU - the key type for the ordering, must be self comparablesource - the source of TskeySelector - the key selector for comparison@Nonnull public static <T,U> Observable<T> orderBy(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends U> keySelector, @Nonnull java.util.Comparator<? super U> keyComparator)
Note that it buffers the elements of source until it
signals finish.
Exception semantics: the exception is relayed and no ordering is performed.
Completion semantics: the output terminates when the source terminates and the sorted values are all submitted.
T - the source element typeU - the key type for the orderingsource - the source of TskeySelector - the key selector for comparisonkeyComparator - the key comparator function@Nonnull public static <T> Observable<T> prune(Observable<? extends T> source)
Basically a replay with buffer size 1.
T - the source element typesource - the source of Ts@Nonnull public static <T,U> Observable<U> prune(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super Observable<? extends T>,? extends Observable<U>> selector)
Basically a replay with buffer size 1.
T - the source element typeU - the return element typesource - the source of Tsselector - the output stream selector@Nonnull public static <T,U> Observable<U> prune(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super Observable<? extends T>,? extends Observable<U>> selector, @Nonnull Scheduler scheduler)
Basically a replay with buffer size 1.
T - the source element typeU - the return element typesource - the source of Tsselector - the output stream selectorscheduler - the scheduler for replaying the single value@Nonnull public static <T> Observable<T> prune(@Nonnull Observable<? extends T> source, @Nonnull Scheduler scheduler)
Basically a replay with buffer size 1.
T - the source element typesource - the source of Tsscheduler - the scheduler for replaying the single value@Nonnull public static <T> ConnectableObservable<T> publish(@Nonnull Observable<? extends T> source)
This is a specialization of the multicast operator with a simple forwarding subject.
T - the element typesource - the source of Ts@Nonnull public static <T,U> Observable<U> publish(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super Observable<? extends T>,? extends Observable<? extends U>> selector)
source observable.
This is a specialization of the multicast operator with a regular subject on U.
T - the source element typeU - the result element typesource - the source sequenceselector - the observable selector that can
use the source sequence as many times as necessary, without
multiple registration.@Nonnull public static <T,U> Observable<U> publish(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super Observable<? extends T>,? extends Observable<? extends U>> selector, T initialValue)
source observable and registering parties
receive the initial value immediately.
This is a specialization of the multicast operator with a regular subject on U.
T - the source element typeU - the result element typesource - the source sequenceselector - the observable selector that can
use the source sequence as many times as necessary, without
multiple registration.initialValue - the value received by registering parties immediately.@Nonnull public static <T> ConnectableObservable<T> publish(@Nonnull Observable<? extends T> source, T initialValue)
Registering parties will immediately receive the initial value but the subsequent values depend upon wether the observer is connected or not.
This is a specialization of the multicast operator with a simple forwarding subject.
T - the element typesource - the source of TsinitialValue - the initial value the observers will receive when registering@Nonnull public static <T,U> Observable<U> publishLast(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super Observable<? extends T>,? extends Observable<? extends U>> selector)
source and returns the last event of the source.T - the element typeU - the result typesource - the source sequenceselector - function that can use the multicasted source as many times as necessary without causing new registrations to source@Nonnull public static <T> ConnectableObservable<T> publishLast(@Nonnull Observable<T> source)
T - the element typesource - the source sequence@Nonnull public static Observable<java.math.BigDecimal> range(@Nonnull java.math.BigDecimal start, int count, @Nonnull java.math.BigDecimal step)
start - the start value.count - the countstep - the stepping@Nonnull public static Observable<java.math.BigDecimal> range(@Nonnull java.math.BigDecimal start, int count, @Nonnull java.math.BigDecimal step, @Nonnull Scheduler pool)
start - the start value.count - the countstep - the steppingpool - the execution thread pool.@Nonnull public static Observable<java.math.BigInteger> range(@Nonnull java.math.BigInteger start, @Nonnull java.math.BigInteger count)
start - the start value.count - the count@Nonnull public static Observable<java.math.BigInteger> range(@Nonnull java.math.BigInteger start, @Nonnull java.math.BigInteger count, @Nonnull Scheduler pool)
start - the start value.count - the countpool - the execution thread pool.@Nonnull public static Observable<java.lang.Double> range(double start, int count, double step)
start - the start value.count - the countstep - the stepping@Nonnull public static Observable<java.lang.Double> range(double start, int count, double step, @Nonnull Scheduler pool)
start in count
amount and each subsequent element has a difference of step.start - the starting valuecount - how many values to producestep - the incrementation amountpool - the pool where to emit the values@Nonnull public static Observable<java.lang.Float> range(float start, int count, float step)
start - the start value.count - the countstep - the stepping@Nonnull public static Observable<java.lang.Float> range(float start, int count, float step, @Nonnull Scheduler pool)
start in count
amount and each subsequent element has a difference of step.start - the starting valuecount - how many values to producestep - the incrementation amountpool - the pool where to emit the values@Nonnull public static Observable<java.lang.Integer> range(int start, int count)
start - the start value.count - the count@Nonnull public static Observable<java.lang.Integer> range(int start, int count, @Nonnull Scheduler pool)
start - the start value.count - the countpool - the execution thread pool.@Nonnull public static Observable<java.lang.Long> range(long start, long count)
start - the start value.count - the count@Nonnull public static Observable<java.lang.Long> range(long start, long count, @Nonnull Scheduler pool)
start - the start value.count - the countpool - the execution thread pool.@Nonnull public static <T> Observable<T> refCount(@Nonnull ConnectableObservable<? extends T> source)
T - the element typesource - the source of Ts@Nonnull public static <T> Observable<T> registerOn(@Nonnull Observable<? extends T> observable, @Nonnull Scheduler pool)
T - the type of the objects to observeobservable - the original observablepool - the pool to perform the original register() call@Nonnull public static <T> Observable<T> relayUntil(@Nonnull Observable<? extends T> source, @Nonnull Func0<java.lang.Boolean> condition)
T - the element typesource - the source of elementscondition - the condition that must be false to relay Ts@Nonnull public static <T> Observable<T> relayWhile(@Nonnull Observable<? extends T> source, @Nonnull Func0<java.lang.Boolean> condition)
T - the type of the valuessource - the source of Tscondition - the condition that must hold to relay Ts@Nonnull public static <T> Observable<T> removeTimeInterval(@Nonnull Observable<TimeInterval<T>> source)
T - the element typesource - the source which has its elements in a timeinterval way.@Nonnull public static <T> Observable<T> removeTimestamped(@Nonnull Observable<Timestamped<? extends T>> source)
T - the element typesource - the source which has its elements in a timestamped way.@Nonnull public static <T> Observable<T> repeat(@Nonnull Func0<? extends T> func)
T - the type of elements to producefunc - the function which generates elements@Nonnull public static <T> Observable<T> repeat(@Nonnull Func0<? extends T> func, int count)
count times to generate Ts
and runs on the default pool.T - the element typefunc - the function to call to generate valuescount - the numer of times to repeat the value@Nonnull public static <T> Observable<T> repeat(@Nonnull Func0<? extends T> func, int count, @Nonnull Scheduler pool)
count times to generate Ts
and runs on the given pool.T - the element typefunc - the function to call to generate valuescount - the numer of times to repeat the valuepool - the pool where the loop should be executed@Nonnull public static <T> Observable<T> repeat(@Nonnull Func0<? extends T> func, @Nonnull Scheduler pool)
T - the type of elements to producefunc - the function which generates elementspool - the pool where the generator loop runs@Nonnull public static <T> Observable<T> repeat(@Nonnull Observable<? extends T> source)
T - the element typesource - the source observabledoWhile(Observable, Func0)@Nonnull public static <T> Observable<T> repeat(@Nonnull Observable<? extends T> source, int count)
T - the element typesource - the source observablecount - the number of times to repeatdoWhile(Observable, Func0)@Nonnull public static <T> Observable<T> repeat(T value)
T - the element typevalue - the value to repeat@Nonnull public static <T> Observable<T> repeat(T value, int count)
count times
and runs on the default pool.T - the element typevalue - the value to repeatcount - the numer of times to repeat the value@Nonnull public static <T> Observable<T> repeat(T value, int count, @Nonnull Scheduler pool)
count times
and runs on the given pool.T - the element typevalue - the value to repeatcount - the numer of times to repeat the valuepool - the pool where the loop should be executedpublic static <T> Observable<T> repeat(T value, @Nonnull Scheduler pool)
T - the element typevalue - the value to repeatpool - the pool where the loop should be executed@Nonnull public static <T> Observable<T> replay(@Nonnull Observable<? extends T> source)
T - the element typesource - the source of Ts@Nonnull public static <T,U> Observable<U> replay(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super Observable<? extends T>,? extends Observable<U>> selector, int bufferSize)
T - the element typeU - the return element typesource - the source of Tsselector - the output stream selectorbufferSize - the target buffer size@Nonnull public static <T,U> Observable<U> replay(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super Observable<? extends T>,? extends Observable<U>> selector, int bufferSize, long timeSpan, @Nonnull java.util.concurrent.TimeUnit unit)
T - the source element typeU - the return element typesource - the source of Tsselector - the output stream selectorbufferSize - the buffer sizetimeSpan - the window lengthunit - the time unit@Nonnull public static <T,U> Observable<U> replay(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super Observable<? extends T>,? extends Observable<U>> selector, int bufferSize, long timeSpan, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler scheduler)
T - the source element typeU - the return element typesource - the source of Tsselector - the output stream selectorbufferSize - the buffer sizetimeSpan - the window lengthunit - the time unitscheduler - the target scheduler@Nonnull public static <T,U> Observable<U> replay(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super Observable<? extends T>,? extends Observable<U>> selector, long timeSpan, @Nonnull java.util.concurrent.TimeUnit unit)
T - the source element typeU - the return element typesource - the source of Tsselector - the output stream selectortimeSpan - the window lengthunit - the time unit@Nonnull public static <T,U> Observable<U> replay(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super Observable<? extends T>,? extends Observable<U>> selector, long timeSpan, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler scheduler)
T - the source element typeU - the return element typesource - the source of Tsselector - the output stream selectortimeSpan - the window lengthunit - the time unitscheduler - the target scheduler@Nonnull public static <T> Observable<T> replay(@Nonnull Observable<? extends T> source, int bufferSize)
T - the element typesource - the source of TsbufferSize - the target buffer size@Nonnull public static <T> Observable<T> replay(@Nonnull Observable<? extends T> source, int bufferSize, long timeSpan, @Nonnull java.util.concurrent.TimeUnit unit)
T - the source element typesource - the source of TsbufferSize - the buffer sizetimeSpan - the window lengthunit - the time unit@Nonnull public static <T> Observable<T> replay(@Nonnull Observable<? extends T> source, int bufferSize, long timeSpan, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler scheduler)
T - the source element typesource - the source of TsbufferSize - the buffer sizetimeSpan - the window lengthunit - the time unitscheduler - the target scheduler@Nonnull public static <T> Observable<T> replay(@Nonnull Observable<? extends T> source, int bufferSize, @Nonnull Scheduler scheduler)
T - the element typesource - the source of TsbufferSize - the target buffer sizescheduler - the scheduler from where the historical elements are emitted@Nonnull public static <T> Observable<T> replay(@Nonnull Observable<? extends T> source, long timeSpan, @Nonnull java.util.concurrent.TimeUnit unit)
T - the source element typesource - the source of TstimeSpan - the window lengthunit - the time unit@Nonnull public static <T> Observable<T> replay(@Nonnull Observable<? extends T> source, long timeSpan, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler scheduler)
T - the source element typesource - the source of TstimeSpan - the window lengthunit - the time unitscheduler - the target scheduler@Nonnull public static <T> Observable<T> replay(@Nonnull Observable<? extends T> source, @Nonnull Scheduler scheduler)
T - the element typesource - the source of Tsscheduler - the scheduler from where the historical elements are emitted@Nonnull public static <T,U> Observable<U> replay(@Nonnull Observable<T> source, @Nonnull Func1<? super Observable<? extends T>,? extends Observable<U>> selector, int bufferSize, @Nonnull Scheduler scheduler)
T - the element typeU - the return element typesource - the source of Tsselector - the output stream selectorbufferSize - the target buffer sizescheduler - the scheduler from where the historical elements are emitted@Nonnull public static <T,U> Observable<U> replay(@Nonnull Observable<T> source, @Nonnull Func1<? super Observable<T>,? extends Observable<U>> selector)
T - the source element typeU - the output element typesource - the source of Tsselector - the selector which returns an observable of Us for the given source@Nonnull public static <T> Observable<T> resumeAlways(@Nonnull java.lang.Iterable<? extends Observable<? extends T>> sources)
T - the type of the elementssources - the list of observablespublic static <T> Observable<T> resumeConditionally(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super java.lang.Throwable,? extends Observable<? extends T>> handler)
Exception semantics: in case of an exception in source, the exception is turned into a continuation, but the second observable's error now terminates the sequence.
Note: Rx calls this Catch.
T - the source and result element typesource - The source sequencehandler - The exception handler@Nonnull public static <T> Observable<T> resumeOnError(@Nonnull java.lang.Iterable<? extends Observable<? extends T>> sources)
T - the type of the valuessources - the available source observables.@Nonnull public static <T> Observable<T> retry(@Nonnull Observable<? extends T> source)
T - the type of elementssource - the source observable@Nonnull public static <T> Observable<T> retry(@Nonnull Observable<? extends T> source, int count)
count retry count was used up.T - the type of elementssource - the source observablecount - the retry countpublic static <T> void run(@Nonnull
Observable<? extends T> source,
@Nonnull
Action1<? super T> action)
throws java.lang.InterruptedException
T - the type of the elementssource - the source observableaction - the action to invoke for each valuejava.lang.InterruptedException - if the current thread is interrupted while waiting on
the observable.public static <T> void run(@Nonnull
Observable<? extends T> source,
@Nonnull
Observer<? super T> observer)
throws java.lang.InterruptedException
T - the type of the elementssource - the source observableobserver - the observer to invoke for each eventjava.lang.InterruptedException - if the current thread is interrupted while waiting on
the observable.public static void run(@Nonnull
Observable<?> source)
throws java.lang.InterruptedException
source - the source observablejava.lang.InterruptedException - if the current thread is interrupted while waiting on
the observable.@Nonnull public static <T> Observable<T> sample(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit)
T - the type of elements to watchsource - the source of elementstime - the time value to waitunit - the time unit@Nonnull public static <T> Observable<T> sample(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler pool)
T - the type of elements to watchsource - the source of elementstime - the time value to waitunit - the time unitpool - the scheduler pool where the periodic submission should happen.public static <T,U> Observable<T> sample(Observable<? extends T> source, Observable<? extends U> sampler)
Exception semantics: exceptions raised anywhere will terminate the sequences.
T - the element typeU - the sampler's element type, irrelevantsource - the source sequencesampler - the sampler sequence@Nonnull public static <T> Observable<T> scan(@Nonnull Observable<? extends T> source, @Nonnull Func2<? super T,? super T,? extends T> accumulator)
range(0, 5).accumulate((x, y) -> x + y) produces a sequence of [0, 1, 3, 6, 10];T - the element type to accumulatesource - the source of the accumulationaccumulator - the accumulator which takest the current accumulation value and the current observed value
and returns a new accumulated value@Nonnull public static <T,U> Observable<U> scan(@Nonnull Observable<? extends T> source, U seed, @Nonnull Func2<? super U,? super T,? extends U> accumulator)
range(0, 5).accumulate(1, (x, y) => x + y) produces a sequence of [1, 2, 4, 7, 11];T - the element type to accumulateU - the accumulation typesource - the source of the accumulationseed - the initial value of the accumulationaccumulator - the accumulator which takest the current accumulation value and the current observed value
and returns a new accumulated value@Nonnull public static <T,U> Observable<U> select(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends U> mapper)
T - the type of the original observableU - the type of the new observablesource - the source of Tsmapper - the mapper from Ts to Uspublic static <T,U> Observable<U> select(@Nonnull Observable<? extends T> source, @Nonnull Func2<? super T,? super java.lang.Integer,? extends U> selector)
T - the source element typeU - the output element typesource - the source observableselector - the selector taking an index and the current Tpublic static <T,U> Observable<U> selectLong(@Nonnull Observable<? extends T> source, @Nonnull Func2<? super T,? super java.lang.Long,? extends U> selector)
T - the source element typeU - the output element typesource - the source observableselector - the selector taking an index and the current T@Nonnull public static <T,U> Observable<U> selectMany(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Observable<? extends U>> selector)
T - the input element typeU - the output element typesource - the source of Tsselector - the selector to return an Iterable of Us@Nonnull public static <T,U,V> Observable<V> selectMany(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Observable<? extends U>> collectionSelector, @Nonnull Func2<? super T,? super U,? extends V> resultSelector)
T - the source element typeU - the intermediate element typeV - the output element typesource - the source of TscollectionSelector - the selector which returns an observable of intermediate VsresultSelector - the selector which gives an U for a T and V@Nonnull public static <T,U> Observable<U> selectMany(@Nonnull Observable<? extends T> source, @Nonnull Observable<? extends U> provider)
T - the type of the source, irrelevantU - the output typesource - the source of Tsprovider - the source of Us@Nonnull public static <T,U> Observable<U> selectManyIterable(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends java.lang.Iterable<? extends U>> selector)
T - the input element typeU - the output element typesource - the source of Tsselector - the selector to return an Iterable of Us@Nonnull public static <T,U,V> Observable<V> selectManyIterable(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends java.lang.Iterable<? extends U>> selector, @Nonnull Func2<? super T,? super U,? extends V> resultSelector)
T - the input element typeU - the intermediate type ofV - the output typesource - the source of Tsselector - the selector to return an Iterable of UsresultSelector - the selector for a pair of T and Upublic static <T> Observable<java.lang.Boolean> sequenceEqual(java.lang.Iterable<? extends T> first, Observable<? extends T> second)
The equality only stands if the two sequence produces the same amount of values and those values are pairwise equal. If one of the sequences terminates before the other, the equality test will return false.
T - the common element typefirst - the first source of Tssecond - the second source of Ts@Nonnull public static <T> Observable<java.lang.Boolean> sequenceEqual(@Nonnull java.lang.Iterable<? extends T> first, @Nonnull Observable<? extends T> second, @Nonnull Func2<? super T,? super T,java.lang.Boolean> comparer)
The equality only stands if the two sequence produces the same amount of values and those values are pairwise equal. If one of the sequences terminates before the other, the equality test will return false.
T - the common element typefirst - the first source of Tssecond - the second source of Tscomparer - the equality comparison function@Nonnull public static <T> Observable<java.lang.Boolean> sequenceEqual(@Nonnull Observable<? extends T> first, @Nonnull Observable<? extends T> second)
The equality only stands if the two sequence produces the same amount of values and those values are pairwise equal. If one of the sequences terminates before the other, the equality test will return false.
T - the common element typefirst - the first source of Tssecond - the second source of Ts@Nonnull public static <T> Observable<java.lang.Boolean> sequenceEqual(@Nonnull Observable<? extends T> first, @Nonnull Observable<? extends T> second, @Nonnull Func2<? super T,? super T,java.lang.Boolean> comparer)
The equality only stands if the two sequence produces the same amount of values and those values are pairwise equal. If one of the sequences terminates before the other, the equality test will return false.
T - the common element typefirst - the first source of Tssecond - the second source of Tscomparer - the equality comparison functionpublic static <T> T single(@Nonnull
Observable<? extends T> source)
T - the type of the elementsource - the source of Tspublic static <T> T single(@Nonnull
Observable<? extends T> source,
@Nonnull
Func0<? extends T> defaultSupplier)
T - the type of the elementsource - the source of TsdefaultSupplier - the function that produces the default valuefirst(Observable, Func0)public static <T> T single(@Nonnull
Observable<? extends T> source,
T defaultValue)
T - the type of the elementsource - the source of TsdefaultValue - the value to return if the source is emptyfirst(Observable, Object)@Nonnull public static <T> Observable<T> singleAsync(@Nonnull Observable<? extends T> source)
T - the element typesource - the source sequence of Ts@Nonnull public static <T> Observable<T> singleAsync(@Nonnull Observable<? extends T> source, @Nonnull Func0<? extends T> defaultSupplier)
T - the element typesource - the source sequence of TsdefaultSupplier - the function that produces@Nonnull public static <T> Observable<T> singleAsync(@Nonnull Observable<? extends T> source, @Nonnull T defaultValue)
T - the element typesource - the source sequence of TsdefaultValue - the default value to return in case the source is empty@Nonnull public static <T> Observable<T> singleton(Func0<? extends T> supplier)
T - the value typesupplier - the value supplier@Nonnull public static <T> Observable<T> singleton(Func0<? extends T> supplier, @Nonnull Scheduler pool)
T - the value typesupplier - the value supplierpool - the pool where to submit the value to the observers@Nonnull public static <T> Observable<T> singleton(T value)
T - the value typevalue - the value@Nonnull public static <T> Observable<T> singleton(T value, @Nonnull Scheduler pool)
T - the value typevalue - the valuepool - the pool where to submit the value to the observers@Nonnull public static <T> Observable<T> skip(@Nonnull Observable<? extends T> source, int count)
T - the element typesource - the source of Tscount - the number of messages to skip@Nonnull public static <T> Observable<T> skip(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit)
Exceptions are always forwarded immediately, even if it occurs before the skip time runs out.
T - the element typesource - the source sequencetime - the time to waitunit - the unit@Nonnull public static <T> Observable<T> skip(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler pool)
Exceptions are always forwarded immediately, even if it occurs before the skip time runs out.
T - the element typesource - the source sequencetime - the time to waitunit - the unitpool - the scheduler@Nonnull public static <T> Observable<T> skipLast(Observable<? extends T> source, int count)
count elements from the source observable.T - the element typesource - the source of Tscount - the number of elements to skip at the end@Nonnull public static <T> Observable<T> skipLast(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit)
Since there is no way to know the total duration of the sequence, the operator queues elements unit they become older than the specified time, causing the elements to be delayed by time.
T - the element typesource - the source sequencetime - the time to skip from lastunit - the time unit@Nonnull public static <T,U> Observable<T> skipUntil(@Nonnull Observable<? extends T> source, @Nonnull Observable<U> signaller)
Once the signaller sends its first value, it gets deregistered.
Exception semantics: exceptions thrown by source or singaller is immediately forwarded to the output and the stream is terminated.
T - the element type of the sourceU - the element type of the signaller, irrelevantsource - the source of Tssignaller - the source of Us@Nonnull public static <T> Observable<T> skipWhile(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,java.lang.Boolean> condition)
T - the element typessource - the source of Tscondition - the condition that must turn false in order to start relaying@Nonnull public static <T> Observable<T> skipWhile(@Nonnull Observable<? extends T> source, @Nonnull Func2<? super T,? super java.lang.Integer,java.lang.Boolean> condition)
T - the element typessource - the source of Tscondition - the condition that must turn false in order to start relaying@Nonnull public static <T> Observable<T> skipWhileLong(@Nonnull Observable<? extends T> source, @Nonnull Func2<? super T,? super java.lang.Long,java.lang.Boolean> condition)
T - the element typessource - the source of Tscondition - the condition that must turn false in order to start relaying@Nonnull public static Observable<java.lang.Void> start(@Nonnull Action0 action)
action - the action to invoke@Nonnull public static Observable<java.lang.Void> start(@Nonnull Action0 action, @Nonnull Scheduler pool)
action - the action to invokepool - the pool where the action should run@Nonnull public static <T> Observable<T> start(@Nonnull Func0<? extends T> func)
T - the function return typefunc - the function@Nonnull public static <T> Observable<T> start(@Nonnull Func0<? extends T> func, @Nonnull Scheduler pool)
T - the function return typefunc - the functionpool - the pool where the action should run@Nonnull public static <T> Observable<T> startWith(@Nonnull Observable<? extends T> source, @Nonnull java.lang.Iterable<? extends T> values)
T - the element typesource - the sourcevalues - the values to start with@Nonnull public static <T> Observable<T> startWith(@Nonnull Observable<? extends T> source, @Nonnull java.lang.Iterable<? extends T> values, @Nonnull Scheduler pool)
T - the element typesource - the sourcevalues - the values to start withpool - the pool where the iterable values should be emitted@Nonnull public static <T> Observable<T> startWith(@Nonnull Observable<? extends T> source, @Nonnull Scheduler pool, T... values)
T - the element typesource - the sourcepool - the pool where the iterable values should be emittedvalues - the values to start with@Nonnull public static <T> Observable<T> startWith(@Nonnull Observable<? extends T> source, T... values)
T - the element typesource - the sourcevalues - the array of values@Nonnull public static Observable<java.math.BigDecimal> sumBigDecimal(@Nonnull Observable<java.math.BigDecimal> source)
source - the source of BigDecimals to aggregate.@Nonnull public static Observable<java.math.BigInteger> sumBigInteger(@Nonnull Observable<java.math.BigInteger> source)
source - the source of BigIntegers to aggregate.@Nonnull public static Observable<java.lang.Double> sumDouble(@Nonnull Observable<java.lang.Double> source)
source - the source of Doubles to aggregate.@Nonnull public static Observable<java.lang.Float> sumFloat(@Nonnull Observable<java.lang.Float> source)
source - the source of Floats to aggregate.@Nonnull public static Observable<java.lang.Integer> sumInt(@Nonnull Observable<java.lang.Integer> source)
source - the source of integers to aggregate.@Nonnull public static Observable<java.lang.Double> sumIntAsDouble(@Nonnull Observable<java.lang.Integer> source)
source - the source of integers to aggregate.@Nonnull public static Observable<java.lang.Long> sumLong(@Nonnull Observable<java.lang.Long> source)
source - the source of longs to aggregate.@Nonnull public static Observable<java.lang.Double> sumLongAsDouble(@Nonnull Observable<java.lang.Long> source)
source - the source of longs to aggregate.@Nonnull public static <T,U> Observable<U> switchCase(@Nonnull Func0<? extends T> selector, @Nonnull java.util.Map<? super T,? extends Observable<U>> sources)
T - the selector typeU - the observable element typeselector - the selectorsources - the map of sources@Nonnull public static <T,U> Observable<U> switchCase(@Nonnull Func0<? extends T> selector, @Nonnull java.util.Map<? super T,? extends Observable<U>> sources, @Nonnull Observable<U> defaultSource)
T - the selector typeU - the observable element typeselector - the selectorsources - the map of sourcesdefaultSource - the default source@Nonnull public static <T,U> Observable<U> switchCase(@Nonnull Func0<? extends T> selector, @Nonnull java.util.Map<? super T,? extends Observable<U>> sources, @Nonnull Scheduler pool)
T - the selector typeU - the observable element typeselector - the selectorsources - the map of sourcespool - the scheduler to use for the empty casepublic static <T> Observable<T> switchToNext(Observable<? extends Observable<? extends T>> sources)
T - the element typesources - the source of multiple observables of Ts.@Nonnull public static <T> Observable<T> synchronize(@Nonnull Observable<? extends T> source)
T - the element typesource - the source sequence.@Nonnull public static <T> Observable<T> take(@Nonnull Observable<? extends T> source, int count)
T - the element typesource - the source of Tscount - the number of elements to relay, setting
it to zero will finish the output after the reception of
the first event.@Nonnull public static <T> Observable<T> take(@Nonnull Observable<? extends T> source, int count, @Nonnull Scheduler scheduler)
T - the element typesource - the source of Tscount - the number of elements to relay, setting
it to zero will finish the output after the reception of
the first event.scheduler - the scheduler to emit the finish event
if the count is zero@Nonnull public static <T> Observable<T> take(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit)
T - the element typesource - the source sequencetime - the timeunit - the unit@Nonnull public static <T> Observable<T> take(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler pool)
T - the element typesource - the source sequencetime - the timeunit - the unitpool - the pool for timed operation@Nonnull public static <T> Observable<T> takeLast(@Nonnull Observable<? extends T> source, int count)
count
elements from the source observable.T - the element typesource - the source of the elementscount - the number elements to return@Nonnull public static <T> Observable<T> takeLast(@Nonnull Observable<? extends T> source, int count, @Nonnull Scheduler pool)
count
elements from the source observable and emits them from
the specified scheduler pool.T - the element typesource - the source of the elementscount - the number elements to returnpool - the scheduler where from emit the last values@Nonnull public static <T> Observable<T> takeLast(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit)
These last elements are drained in the caller's thread of the finish event.
Since there is no way to know the total duration of the sequence, the operator queues elements unit they become older than the specified time, causing the elements to be delayed by time.
T - the element typesource - the source sequencetime - the timeunit - the unit@Nonnull public static <T> Observable<T> takeLast(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler drainPool)
These last elements are drained in the given scheduler.
Since there is no way to know the total duration of the sequence, the operator queues elements unit they become older than the specified time, causing the elements to be delayed by time.
T - the element typesource - the source sequencetime - the timeunit - the unitdrainPool - the optional pool to drain the accumulated values,
if null, the thread of the finish caller is used.@Nonnull public static <T> Observable<java.util.List<T>> takeLastBuffer(@Nonnull Observable<? extends T> source, int count)
count
elements from the source observable and
returns it as a single list.T - the element typesource - the source of the elementscount - the number elements to return@Nonnull public static <T> Observable<java.util.List<T>> takeLastBuffer(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit)
These last elements are drained in the caller's thread of the finish event.
Since there is no way to know the total duration of the sequence, the operator queues elements unit they become older than the specified time, causing the elements to be delayed by time.
T - the element typesource - the source sequencetime - the timeunit - the unit@Nonnull public static <T> Observable<java.util.List<T>> takeLastBuffer(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler drainPool)
These last elements are drained in the given scheduler.
Since there is no way to know the total duration of the sequence, the operator queues elements unit they become older than the specified time, causing the elements to be delayed by time.
T - the element typesource - the source sequencetime - the timeunit - the unitdrainPool - the optional pool to drain the accumulated values,
if null, the thread of the finish caller is used.@Nonnull public static <T,U> Observable<T> takeUntil(@Nonnull Observable<? extends T> source, @Nonnull Observable<U> signaller)
T - the element typeU - the signaller element type, irrelevantsource - the source of Tssignaller - the source of Us@Nonnull public static <T> Observable<T> takeWhile(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,java.lang.Boolean> predicate)
T - the element typesource - the source of Tspredicate - the predicate@Nonnull public static <T> Observable<T> takeWhile(@Nonnull Observable<? extends T> source, @Nonnull Func2<? super T,? super java.lang.Integer,java.lang.Boolean> predicate)
T - the element typesource - the source of Tspredicate - the predicate@Nonnull public static <T> Observable<T> takeWhileLong(@Nonnull Observable<? extends T> source, @Nonnull Func2<? super T,? super java.lang.Long,java.lang.Boolean> predicate)
T - the element typesource - the source of Tspredicate - the predicate@Nonnull public static <T,U> Observable<T> throttle(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Observable<U>> durationSelector)
Exception semantics: exceptions from the source and windows are forwarded immediately and the sequence is terminated.
The window close is triggered by either a next or finish event.
T - the source and result element typeU - the window observable's type, irrelevantsource - the source sequencedurationSelector - the duration selector.@Nonnull public static <T> Observable<T> throttle(@Nonnull Observable<? extends T> source, long delay, @Nonnull java.util.concurrent.TimeUnit unit)
It is basically how Content Assistant popup works after the user pauses in its typing. Uses the default scheduler.
T - the value typesource - the source of Tsdelay - how much time should elapse since the last event to actually forward that eventunit - the delay time unit@Nonnull public static <T> Observable<T> throttle(@Nonnull Observable<? extends T> source, long delay, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler pool)
It is basically how Content Assistant popup works after the user pauses in its typing.
T - the value typesource - the source of Tsdelay - how much time should elapse since the last event to actually forward that eventunit - the delay time unitpool - the pool where the delay-watcher should operate@Nonnull public static <T,E extends java.lang.Throwable> Observable<T> throwException(@Nonnull Func0<E> supplier)
T - the element type, irrelevantE - the exception typesupplier - the exception supplier@Nonnull public static <T,E extends java.lang.Throwable> Observable<T> throwException(@Nonnull Func0<E> supplier, @Nonnull Scheduler pool)
T - the element type, irrelevantE - the exception typesupplier - the function that supplies the exceptionpool - the pool from where to send the values@Nonnull public static <T> Observable<T> throwException(@Nonnull java.lang.Throwable ex)
T - the element type, irrelevantex - the exception to throw@Nonnull public static <T> Observable<T> throwException(@Nonnull java.lang.Throwable ex, @Nonnull Scheduler pool)
T - the element type, irrelevantex - the exception to throwpool - the pool from where to send the values@Nonnull public static Observable<java.lang.Long> tick(long start, long end, long delay, @Nonnull java.util.concurrent.TimeUnit unit)
It uses the default scheduler pool.
Finishes right after reaching the final value of end - 1
start - the starting value of the tickend - the finishing value of the tick exclusivedelay - the delay valueunit - the time unit of the delay@Nonnull public static Observable<java.lang.Long> tick(long start, long end, long delay, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler pool)
Finishes right after reaching the final value of end - 1
start - the starting value of the tick inclusiveend - the finishing value of the tick exclusivedelay - the delay valueunit - the time unit of the delaypool - the scheduler pool for the wait@Nonnull public static Observable<java.lang.Long> tick(long delay, @Nonnull java.util.concurrent.TimeUnit unit)
delay - the delay valueunit - the time unit of the delay@Nonnull public static <T,V> Observable<T> timeout(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Observable<V>> timeoutSelector)
The first element is waited forever, the timeout observables fire on both next and finish events.
Exception semantics: any exceptions thrown are immediately forwarded and the sequence terminated.
T - the source and result element typeV - the per-element timeout type, irrelevantsource - the source sequencetimeoutSelector - the timeout selector for each value@Nonnull public static <T,V> Observable<T> timeout(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,? extends Observable<V>> timeoutSelector, @Nonnull Observable<? extends T> other)
The first element is waited forever, the timeout observables fire on both next and finish events.
Exception semantics: any exceptions thrown are immediately forwarded and the sequence terminated.
T - the source and result element typeV - the per-element timeout type, irrelevantsource - the source sequencetimeoutSelector - the timeout selector for each valueother - the outer source to switch to in case of timeout@Nonnull public static <T> Observable<T> timeout(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit)
T - the element type to observesource - the source observabletime - the maximum allowed timespan between eventsunit - the time unit@Nonnull public static <T> Observable<T> timeout(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Observable<? extends T> other)
other observable.T - the element type to observesource - the source observabletime - the maximum allowed timespan between eventsunit - the time unitother - the other observable to continue with in case a timeout occurs@Nonnull public static <T> Observable<T> timeout(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Observable<? extends T> other, @Nonnull Scheduler pool)
other observable.T - the element type to observesource - the source observabletime - the maximum allowed timespan between eventsunit - the time unitother - the other observable to continue with in case a timeout occurspool - the scheduler pool for the timeout evaluation@Nonnull public static <T> Observable<T> timeout(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler pool)
T - the element type to observesource - the source observabletime - the maximum allowed timespan between eventsunit - the time unitpool - the scheduler pool for the timeout evaluation@Nonnull public static <T,U,V> Observable<T> timeout(@Nonnull Observable<? extends T> source, @Nonnull Observable<U> firstTimeout, @Nonnull Func1<? super T,? extends Observable<V>> timeoutSelector)
The first element is until the given firstTimeout observable fires. The timeout observables fire on both next and finish events.
Exception semantics: any exceptions thrown are immediately forwarded and the sequence terminated.
T - the source and result element typeU - the initial timeout element type, irrelevantV - the per-element timeout type, irrelevantsource - the source sequencefirstTimeout - the timeout for the first element, use never() to wait for it indefinitelytimeoutSelector - the timeout selector for each value@Nonnull public static <T,U,V> Observable<T> timeout(@Nonnull Observable<? extends T> source, @Nonnull Observable<U> firstTimeout, @Nonnull Func1<? super T,? extends Observable<V>> timeoutSelector, @Nonnull Observable<? extends T> other)
T - the source and result element typeU - the initial timeout element type, irrelevantV - the per-element timeout type, irrelevantsource - the source sequencefirstTimeout - the timeout for the first element, use never() to wait for it indefinitelytimeoutSelector - the timeout selector for each valueother - the outer source to switch to in case of timeout@Nonnull public static <T> Observable<T> timeoutFinish(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit)
T - the element type.source - the source sequencetime - the time to waitunit - the time unit to wait@Nonnull public static <T> Observable<T> timeoutFinish(@Nonnull Observable<? extends T> source, long time, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler scheduler)
T - the element type.source - the source sequencetime - the time to waitunit - the time unit to waitscheduler - the scheduler used for the waitpublic static <T> Observable<T[]> toArray(@Nonnull Observable<? extends T> source, @Nonnull T[] a)
Exception semantics: if the source throws an exception, that exception is forwarded (e.g., no partial array is created).
T - the source element typesource - the source of Tsa - the template array, noes not change its value@Nonnull public static Observable<java.lang.Object[]> toArray(@Nonnull Observable<?> source)
Exception semantics: if the source throws an exception, that exception is forwarded (e.g., no partial array is created).
source - the source of anythingpublic static DoubleObservable toDoubleObservable(@Nonnull Observable<java.lang.Double> source)
source - the source sequencepublic static IntObservable toIntObservable(@Nonnull Observable<java.lang.Integer> source)
source - the source sequence@Nonnull public static <T> CloseableIterable<T> toIterable(@Nonnull Observable<? extends T> observable)
The resulting iterable does not support the remove() method.
T - the element type to iterateobservable - the original observablepublic static <T> Observable<java.util.List<T>> toList(Observable<? extends T> source)
T - the source element typesource - the source observablepublic static LongObservable toLongObservable(@Nonnull Observable<java.lang.Long> source)
source - the source sequencepublic static <T,K,V> Observable<java.util.Map<K,V>> toMap(Observable<? extends T> source, Func1<? super T,? extends K> keySelector, Func1<? super T,? extends V> valueSelector)
Object.equals() semantics.
Exception semantics: if the source throws an exception, that exception is forwarded (e.g., no partial map is created).
T - the element typeK - the key typeV - the value typesource - the source of TskeySelector - the key selectorvalueSelector - the value selectorpublic static <T,K,V> Observable<java.util.Map<K,V>> toMap(Observable<? extends T> source, Func1<? super T,? extends K> keySelector, Func1<? super T,? extends V> valueSelector, Func2<? super K,? super K,java.lang.Boolean> keyComparer)
Exception semantics: if the source throws an exception, that exception is forwarded (e.g., no partial map is created).
T - the element typeK - the key typeV - the value typesource - the source of TskeySelector - the key selectorvalueSelector - the value selectorkeyComparer - the comparison function for keyspublic static <K,T> Observable<java.util.Map<K,T>> toMap(Observable<? extends T> source, Func1<? super T,? extends K> keySelector, Func2<? super K,? super K,java.lang.Boolean> keyComparer)
Exception semantics: if the source throws an exception, that exception is forwarded (e.g., no partial map is created).
T - the element typeK - the key typesource - the source of TskeySelector - the key selectorkeyComparer - the key comparer functionpublic static <K,T> Observable<java.util.Map<K,T>> toMap(Observable<T> source, Func1<? super T,? extends K> keySelector)
Object.equals() semantics.
Exception semantics: if the source throws an exception, that exception is forwarded (e.g., no partial map is created).
T - the element typeK - the key typesource - the source of TskeySelector - the key selectorpublic static <T,K> Observable<java.util.Map<K,java.util.Collection<T>>> toMultiMap(Observable<? extends T> source, Func1<? super T,? extends K> keySelector, Func0<? extends java.util.Collection<T>> collectionSupplier)
Object.equals() semantics.
Exception semantics: if the source throws an exception, that exception is forwarded (e.g., no partial map is created).
T - the element typeK - the key typesource - the source of TskeySelector - the key selectorcollectionSupplier - the function which retuns a collection to hold the Vs.public static <T,K> Observable<java.util.Map<K,java.util.Collection<T>>> toMultiMap(Observable<? extends T> source, Func1<? super T,? extends K> keySelector, Func0<? extends java.util.Collection<T>> collectionSupplier, Func2<? super K,? super K,java.lang.Boolean> keyComparer)
Exception semantics: if the source throws an exception, that exception is forwarded (e.g., no partial map is created).
T - the element typeK - the key typesource - the source of TskeySelector - the key selectorcollectionSupplier - the function which retuns a collection to hold the Vs.keyComparer - the comparison function for keyspublic static <T,K,V> Observable<java.util.Map<K,java.util.Collection<V>>> toMultiMap(Observable<? extends T> source, Func1<? super T,? extends K> keySelector, Func0<? extends java.util.Collection<V>> collectionSupplier, Func1<? super T,? extends V> valueSelector)
Object.equals() semantics.
Exception semantics: if the source throws an exception, that exception is forwarded (e.g., no partial map is created).
T - the element typeK - the key typeV - the value typesource - the source of TskeySelector - the key selectorcollectionSupplier - the function which retuns a collection to hold the Vs.valueSelector - the value selectorpublic static <T,K,V> Observable<java.util.Map<K,java.util.Collection<V>>> toMultiMap(Observable<? extends T> source, Func1<? super T,? extends K> keySelector, Func0<? extends java.util.Collection<V>> collectionSupplier, Func1<? super T,? extends V> valueSelector, Func2<? super K,? super K,java.lang.Boolean> keyComparer)
Exception semantics: if the source throws an exception, that exception is forwarded (e.g., no partial map is created).
T - the element typeK - the key typeV - the value typesource - the source of TskeySelector - the key selectorcollectionSupplier - the function which retuns a collection to hold the Vs.valueSelector - the value selectorkeyComparer - the comparison function for keyspublic static <T> Observable<T> toObservable(@Nonnull java.util.concurrent.Future<? extends T> future)
T - the return typefuture - the future to wrappublic static <T> Observable<T> toObservable(@Nonnull java.util.concurrent.Future<? extends T> future, @Nonnull Scheduler pool)
T - the return typefuture - the future to wrappool - the scheduler pool to wait on@Nonnull public static <T> Observable<T> toObservable(@Nonnull java.lang.Iterable<? extends T> iterable)
T - the type of the valuesiterable - the iterable instance@Nonnull public static <T> Observable<T> toObservable(@Nonnull java.lang.Iterable<? extends T> iterable, @Nonnull Scheduler pool)
T - the type of the valuesiterable - the iterable instancepool - the thread pool where to generate the events from the iterable@Nonnull public static <T> Func1<TimeInterval<T>,T> unwrapTimeInterval()
T - the value type@Nonnull public static <T> Func1<Timestamped<? extends T>,T> unwrapTimestamped()
T - the value type@Nonnull public static <T,U extends java.io.Closeable> Observable<T> using(@Nonnull Func0<? extends U> resourceSelector, @Nonnull Func1<? super U,? extends Observable<? extends T>> resourceUsage)
T - the output resource type.U - the closeable resource to work withresourceSelector - the function that gives a resourceresourceUsage - a function that returns an observable of T for the given resource.@Nonnull public static <T> Observable<T> where(@Nonnull Observable<? extends T> source, @Nonnull Func0<? extends Func2<? super T,? super java.lang.Integer,java.lang.Boolean>> clauseFactory)
T - the element typesource - the source of TsclauseFactory - the filter clause, the first parameter receives the current index, the second receives the current element@Nonnull public static <T> Observable<T> where(@Nonnull Observable<? extends T> source, @Nonnull Func1<? super T,java.lang.Boolean> clause)
T - the element typesource - the source of Tsclause - the filter clause@Nonnull public static <T> Observable<T> where(@Nonnull Observable<? extends T> source, @Nonnull Func2<? super T,? super java.lang.Integer,java.lang.Boolean> clause)
T - the element typesource - the source of Tsclause - the filter clause, the first parameter receives the current index, the second receives the current element@Nonnull public static <T> Observable<T> whereLong(@Nonnull Observable<? extends T> source, @Nonnull Func2<? super T,? super java.lang.Long,java.lang.Boolean> clause)
T - the element typesource - the source of Tsclause - the filter clause, the first parameter receives the current index, the second receives the current elementpublic static <T> Observable<T> whileDo(@Nonnull Observable<? extends T> source, @Nonnull Func0<java.lang.Boolean> condition)
T - the element typesource - the source sequencecondition - the condition to check@Nonnull public static <T,U> Observable<Observable<T>> window(@Nonnull Observable<? extends T> source, @Nonnull Func0<? extends Observable<U>> windowClosingSelector)
T - the element type to observeU - the closing event type, irrelevantsource - the source of TswindowClosingSelector - the source of the window splitting events@Nonnull public static <T> Observable<Observable<T>> window(@Nonnull Observable<? extends T> source, int size)
T - the element typesource - the source sequencesize - the window size@Nonnull public static <T> Observable<Observable<T>> window(@Nonnull Observable<? extends T> source, int size, int skip)
T - the element typesource - the source sequencesize - the window sizeskip - the elements to skip between windows.@Nonnull public static <T> Observable<Observable<T>> window(@Nonnull Observable<? extends T> source, int size, long timespan, @Nonnull java.util.concurrent.TimeUnit unit)
T - the source element typesource - the source sequencesize - the window sizetimespan - the window lengthunit - the time unit@Nonnull public static <T> Observable<Observable<T>> window(@Nonnull Observable<? extends T> source, int size, long timespan, @Nonnull java.util.concurrent.TimeUnit unit, @Nonnull Scheduler pool)
T - the source element typesource - the source sequencesize - the window sizetimespan - the window lengthunit - the time unitpool - the scheduler to run the timed operationspublic static <T> Observable<Observable<T>> window(Observable<? extends T> source, long timespan, long timeshift, java.util.concurrent.TimeUnit unit)
Uses the default scheduler.
T - the source element typesource - the source sequencetimespan - the length of each windowtimeshift - the interval between the creation of consequtive windowsunit - the time unitpublic static <T> Observable<Observable<T>> window(Observable<? extends T> source, long timespan, long timeshift, java.util.concurrent.TimeUnit unit, Scheduler pool)
T - the source element typesource - the source sequencetimespan - the length of each windowtimeshift - the interval between the creation of consequtive windowsunit - the time unitpool - the scheduler for the timed operationspublic static <T> Observable<Observable<T>> window(Observable<? extends T> source, long timespan, java.util.concurrent.TimeUnit unit)
Uses the default scheduler.
T - the source element typesource - the source sequencetimespan - the length of each windowunit - the time unitpublic static <T> Observable<Observable<T>> window(Observable<? extends T> source, long timespan, java.util.concurrent.TimeUnit unit, Scheduler pool)
T - the source element typesource - the source sequencetimespan - the length of each windowunit - the time unitpool - the scheduler for the timed operations@Nonnull public static <T,U,V> Observable<Observable<T>> window(@Nonnull Observable<? extends T> source, @Nonnull Observable<? extends U> windowOpening, @Nonnull Func1<? super U,? extends Observable<V>> windowClosing)
T - the element type to observeU - the opening event type, irrelevantV - the closing event type, irrelevantsource - the source of TswindowOpening - te source of the window opening eventswindowClosing - the source of the window splitting eventspublic static <T,U> Observable<Observable<T>> window(@Nonnull Observable<? extends T> source, @Nonnull Observable<U> boundary)
The first window opens immediately, The current window is closed when the boundary observable sequence has sent a value. The finish of the boundary will finish both inner and outer observables.
Exception semantics: exception thrown by the source or the windowClosingSelector's observable is propagated to both the outer and inner observable returned.
T - the source and result element typeU - the window boundary element type (irrelevantsource - the source sequenceboundary - the window boundary indicator.@Nonnull public static <T> Func1<T,Timestamped<T>> wrapTimestamped()
T - the type of the contained element@Nonnull public static <T> Observable<java.util.List<T>> zip(@Nonnull java.lang.Iterable<? extends Observable<? extends T>> srcs)
The resulting sequence terminates if no more pairs can be established, i.e., streams of length 1 and 2 zipped will produce only 1 item.
Exception semantics: errors from the source observable are propagated as-is.
T - the element typesrcs - the iterable of observable sources.@Nonnull public static <T,U> Observable<U> zip(@Nonnull java.lang.Iterable<? extends Observable<? extends T>> srcs, @Nonnull Func1<? super java.util.List<T>,? extends U> selector)
The resulting sequence terminates if no more pairs can be established, i.e., streams of length 1 and 2 zipped will produce only 1 item.
Exception semantics: errors from the source observable are propagated as-is.
T - the element typeU - the result element typesrcs - the iterable of observable sources.selector - the result selector function@Nonnull public static <T,U,V> Observable<V> zip(@Nonnull Observable<? extends T> left, @Nonnull java.lang.Iterable<? extends U> right, @Nonnull Func2<? super T,? super U,? extends V> selector)
T - the resulting element typeU - the value type streamed on the right iterableV - the value type streamed on the left observableleft - the left iterable of Usright - the right observable of Vsselector - the selector taking the left Us and right Vs.@Nonnull public static <T,U,V> Observable<V> zip(@Nonnull Observable<? extends T> left, @Nonnull Observable<? extends U> right, @Nonnull Func2<? super T,? super U,? extends V> selector)
T - the value type streamed on the left observableU - the value type streamed on the right iterableV - the resulting element typeleft - the left observables of Usright - the right iterable of Vsselector - the selector taking the left Us and right Vs.@Nonnull public static <T> Observable<java.util.List<T>> zip(@Nonnull Observable<? extends T> src, T constant)
T - the element typesrc - the source of Tsconstant - the constant T to combine with@Nonnull public static <T> Observable<java.util.List<T>> zip(T constant, @Nonnull Observable<? extends T> src)
T - the element typeconstant - the constant T to combine withsrc - the source of Tspublic static <T> Observable<T> just(T value)
T - the value typevalue - the value to return