public final class StatementObservable extends Object
Modifier and Type | Method and Description |
---|---|
static <T> Observable<T> |
doWhile(ObservableSource<? extends T> source,
BooleanSupplier postCondition)
Return an Observable that re-emits the emissions from the source
Observable, and then re-subscribes to the source long as a condition is
true.
|
static <R> Observable<R> |
ifThen(BooleanSupplier condition,
ObservableSource<? extends R> then)
Return an Observable that emits the emissions from a specified Observable
if a condition evaluates to true, otherwise return an empty Observable.
|
static <R> Observable<R> |
ifThen(BooleanSupplier condition,
ObservableSource<? extends R> then,
Observable<? extends R> orElse)
Return an Observable that emits the emissions from one specified
Observable if a condition evaluates to true, or from another specified
Observable otherwise.
|
static <R> Observable<R> |
ifThen(BooleanSupplier condition,
ObservableSource<? extends R> then,
Scheduler scheduler)
Return an Observable that emits the emissions from a specified Observable
if a condition evaluates to true, otherwise return an empty Observable
that runs on a specified Scheduler.
|
static <K,R> Observable<R> |
switchCase(Supplier<? extends K> caseSelector,
Map<? super K,? extends ObservableSource<? extends R>> mapOfCases)
Return a particular one of several possible Observables based on a case
selector.
|
static <K,R> Observable<R> |
switchCase(Supplier<? extends K> caseSelector,
Map<? super K,? extends ObservableSource<? extends R>> mapOfCases,
ObservableSource<? extends R> defaultCase)
Return a particular one of several possible Observables based on a case
selector, or a default Observable if the case selector does not map to
a particular one.
|
static <K,R> Observable<R> |
switchCase(Supplier<? extends K> caseSelector,
Map<? super K,? extends ObservableSource<? extends R>> mapOfCases,
Scheduler scheduler)
Return a particular one of several possible Observables based on a case
selector and run it on the designated scheduler.
|
static <T> Observable<T> |
whileDo(ObservableSource<? extends T> source,
BooleanSupplier preCondition)
Return an Observable that re-emits the emissions from the source
Observable as long as the condition is true before the first or subsequent subscribe() calls.
|
public static <K,R> Observable<R> switchCase(Supplier<? extends K> caseSelector, Map<? super K,? extends ObservableSource<? extends R>> mapOfCases)
K
- the case key typeR
- the result value typecaseSelector
- the function that produces a case key when an
Observer subscribesmapOfCases
- a map that maps a case key to an Observablepublic static <K,R> Observable<R> switchCase(Supplier<? extends K> caseSelector, Map<? super K,? extends ObservableSource<? extends R>> mapOfCases, Scheduler scheduler)
K
- the case key typeR
- the result value typecaseSelector
- the function that produces a case key when an
Observer subscribesmapOfCases
- a map that maps a case key to an Observablescheduler
- the scheduler where the empty observable is observedpublic static <K,R> Observable<R> switchCase(Supplier<? extends K> caseSelector, Map<? super K,? extends ObservableSource<? extends R>> mapOfCases, ObservableSource<? extends R> defaultCase)
K
- the case key typeR
- the result value typecaseSelector
- the function that produces a case key when an
Observer subscribesmapOfCases
- a map that maps a case key to an ObservabledefaultCase
- the default Observable if the mapOfCases
doesn't contain a value for the key returned by the caseSelector
public static <T> Observable<T> doWhile(ObservableSource<? extends T> source, BooleanSupplier postCondition)
T
- the value typesource
- the source Observable to work withpostCondition
- the post condition to test after the source
Observable completespublic static <T> Observable<T> whileDo(ObservableSource<? extends T> source, BooleanSupplier preCondition)
T
- the value typesource
- the source Observable to work withpreCondition
- the condition to evaluate before subscribing to or
replaying the source ObservablepreCondition
is truepublic static <R> Observable<R> ifThen(BooleanSupplier condition, ObservableSource<? extends R> then)
R
- the result value typecondition
- the condition that decides whether to emit the emissions
from the then
Observablethen
- the Observable sequence to emit to if condition
is true
then
Observable if the condition
function evaluates to true, or an empty
Observable otherwisepublic static <R> Observable<R> ifThen(BooleanSupplier condition, ObservableSource<? extends R> then, Scheduler scheduler)
R
- the result value typecondition
- the condition that decides whether to emit the emissions
from the then
Observablethen
- the Observable sequence to emit to if condition
is true
scheduler
- the Scheduler on which the empty Observable runs if the
in case the condition returns falsethen
Observable if the condition
function evaluates to true, or an empty
Observable running on the specified Scheduler otherwisepublic static <R> Observable<R> ifThen(BooleanSupplier condition, ObservableSource<? extends R> then, Observable<? extends R> orElse)
R
- the result value typecondition
- the condition that decides which Observable to emit the
emissions fromthen
- the Observable sequence to emit to if condition
is true
orElse
- the Observable sequence to emit to if condition
is false
then
or orElse
Observables depending on a condition function