Package hu.akarnokd.rxjava3.expr
Class StatementCompletable
- java.lang.Object
-
- hu.akarnokd.rxjava3.expr.StatementCompletable
-
public final class StatementCompletable extends java.lang.ObjectImperative statements expressed as Completable operators.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CompletableifThen(BooleanSupplier condition, CompletableSource then, Completable orElse)Return a Completable that emits the emissions from one specified Completable if a condition evaluates to true, or from another specified Completable otherwise.static <K> CompletableswitchCase(Supplier<? extends K> caseSelector, java.util.Map<? super K,? extends CompletableSource> mapOfCases, CompletableSource defaultCase)Return a particular one of several possible Completables based on a case selector, or a default Completable if the case selector does not map to a particular one.
-
-
-
Method Detail
-
switchCase
public static <K> Completable switchCase(Supplier<? extends K> caseSelector, java.util.Map<? super K,? extends CompletableSource> mapOfCases, CompletableSource defaultCase)
Return a particular one of several possible Completables based on a case selector, or a default Completable if the case selector does not map to a particular one.
- Type Parameters:
K- the case key type- Parameters:
caseSelector- the function that produces a case key when an CompletableObserver subscribesmapOfCases- a map that maps a case key to a CompletabledefaultCase- the default Completable if themapOfCasesdoesn't contain a value for the key returned by thecaseSelector- Returns:
- a particular Completable chosen by key from the map of Completables, or the default case if no Completable matches the key
-
ifThen
public static Completable ifThen(BooleanSupplier condition, CompletableSource then, Completable orElse)
Return a Completable that emits the emissions from one specified Completable if a condition evaluates to true, or from another specified Completable otherwise.
- Parameters:
condition- the condition that decides which Completable to emit the emissions fromthen- the Completable sequence to emit to ifconditionistrueorElse- the Completable sequence to emit to ifconditionisfalse- Returns:
- a Completable that mimics either the
thenororElseCompletables depending on a condition function
-
-