Class StatementCompletable


  • public final class StatementCompletable
    extends java.lang.Object
    Imperative statements expressed as Completable operators.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 subscribes
        mapOfCases - a map that maps a case key to a Completable
        defaultCase - the default Completable if the mapOfCases doesn't contain a value for the key returned by the caseSelector
        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 from
        then - the Completable sequence to emit to if condition is true
        orElse - the Completable sequence to emit to if condition is false
        Returns:
        a Completable that mimics either the then or orElse Completables depending on a condition function