public final class StatementSingle extends Object
Modifier and Type | Method and Description |
---|---|
static <R> Single<R> |
ifThen(BooleanSupplier condition,
SingleSource<? extends R> then,
Single<? extends R> orElse)
Return a Single that emits the emissions from one specified
Single if a condition evaluates to true, or from another specified
Single otherwise.
|
static <K,R> Single<R> |
switchCase(Supplier<? extends K> caseSelector,
Map<? super K,? extends SingleSource<? extends R>> mapOfCases,
SingleSource<? extends R> defaultCase)
Return a particular one of several possible Singles based on a case
selector, or a default Single if the case selector does not map to
a particular one.
|
public static <K,R> Single<R> switchCase(Supplier<? extends K> caseSelector, Map<? super K,? extends SingleSource<? extends R>> mapOfCases, SingleSource<? extends R> defaultCase)
K
- the case key typeR
- the result value typecaseSelector
- the function that produces a case key when an
SingleObserver subscribesmapOfCases
- a map that maps a case key to a SingledefaultCase
- the default Single if the mapOfCases
doesn't contain a value for the key returned by the caseSelector
public static <R> Single<R> ifThen(BooleanSupplier condition, SingleSource<? extends R> then, Single<? extends R> orElse)
R
- the result value typecondition
- the condition that decides which Single to emit the
emissions fromthen
- the Single sequence to emit to if condition
is true
orElse
- the Single sequence to emit to if condition
is false
then
or orElse
Singles depending on a condition function