hu.akarnokd.rxjava2.expr

## Class StatementFlowable

- java.lang.Object
- - hu.akarnokd.rxjava2.expr.StatementFlowable

    public final class StatementFlowable
    extends java.lang.Object

Imperative statements expressed as Flowable operators.

### Method Summary

All Methods Static Methods Concrete Methods
`static <T> io.reactivex.Flowable<T>` `doWhile(org.reactivestreams.Publisher<? extends T> source, io.reactivex.functions.BooleanSupplier postCondition)` Return an Flowable that re-emits the emissions from the source Flowable, and then re-subscribes to the source long as a condition is true.
`static <R> io.reactivex.Flowable<R>` `ifThen(io.reactivex.functions.BooleanSupplier condition, org.reactivestreams.Publisher<? extends R> then)` Return an Flowable that emits the emissions from a specified Flowable if a condition evaluates to true, otherwise return an empty Flowable.
`static <R> io.reactivex.Flowable<R>` `ifThen(io.reactivex.functions.BooleanSupplier condition, org.reactivestreams.Publisher<? extends R> then, io.reactivex.Flowable<? extends R> orElse)` Return an Flowable that emits the emissions from one specified Flowable if a condition evaluates to true, or from another specified Flowable otherwise.
`static <R> io.reactivex.Flowable<R>` `ifThen(io.reactivex.functions.BooleanSupplier condition, org.reactivestreams.Publisher<? extends R> then, io.reactivex.Scheduler scheduler)` Return an Flowable that emits the emissions from a specified Flowable if a condition evaluates to true, otherwise return an empty Flowable that runs on a specified Scheduler.
`static <K,R> io.reactivex.Flowable<R>` `switchCase(java.util.concurrent.Callable<? extends K> caseSelector, java.util.Map<? super K,? extends org.reactivestreams.Publisher<? extends R>> mapOfCases)` Return a particular one of several possible Observables based on a case selector.

`static <K,R> io.reactivex.Flowable<R>`

`switchCase(java.util.concurrent.Callable<? extends K> caseSelector, java.util.Map<? super K,? extends org.reactivestreams.Publisher<? extends R>> mapOfCases, org.reactivestreams.Publisher<? extends R> defaultCase)`
Return a particular one of several possible Observables based on a case selector, or a default Flowable if the case selector does not map to a particular one.

`static <K,R> io.reactivex.Flowable<R>` `switchCase(java.util.concurrent.Callable<? extends K> caseSelector, java.util.Map<? super K,? extends org.reactivestreams.Publisher<? extends R>> mapOfCases, io.reactivex.Scheduler scheduler)` Return a particular one of several possible Observables based on a case selector and run it on the designated scheduler.
`static <T> io.reactivex.Flowable<T>` `whileDo(org.reactivestreams.Publisher<? extends T> source, io.reactivex.functions.BooleanSupplier preCondition)` Return an Flowable that re-emits the emissions from the source Flowable as long as the condition is true before the first or subsequent subscribe() calls.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### switchCase

    public static <K,R> io.reactivex.Flowable<R> switchCase(java.util.concurrent.Callable<? extends K> caseSelector,
                                                            java.util.Map<? super K,? extends org.reactivestreams.Publisher<? extends R>> mapOfCases)

Return a particular one of several possible Observables based on a case selector.

Type Parameters:
  `K` - the case key type
  `R` - the result value type
Parameters:
  `caseSelector` - the function that produces a case key when an Observer subscribes
  `mapOfCases` - a map that maps a case key to an Flowable
Returns:
  a particular Flowable chosen by key from the map of Observables, or an empty Flowable if no Flowable matches the key

#### switchCase

    public static <K,R> io.reactivex.Flowable<R> switchCase(java.util.concurrent.Callable<? extends K> caseSelector,
                                                            java.util.Map<? super K,? extends org.reactivestreams.Publisher<? extends R>> mapOfCases,
                                                            io.reactivex.Scheduler scheduler)

Return a particular one of several possible Observables based on a case selector and run it on the designated scheduler.

Type Parameters:
  `K` - the case key type
  `R` - the result value type
Parameters:
  `caseSelector` - the function that produces a case key when an Observer subscribes
  `mapOfCases` - a map that maps a case key to an Flowable
  `scheduler` - the scheduler where the empty observable is observed
Returns:
  a particular Flowable chosen by key from the map of Observables, or an empty Flowable if no Flowable matches the key, but one that runs on the designated scheduler in either case

#### switchCase

    public static <K,R> io.reactivex.Flowable<R> switchCase(java.util.concurrent.Callable<? extends K> caseSelector,
                                                            java.util.Map<? super K,? extends org.reactivestreams.Publisher<? extends R>> mapOfCases,
                                                            org.reactivestreams.Publisher<? extends R> defaultCase)

Return a particular one of several possible Observables based on a case selector, or a default Flowable if the case selector does not map to a particular one.

Type Parameters:
  `K` - the case key type
  `R` - the result value type
Parameters:
  `caseSelector` - the function that produces a case key when an Observer subscribes
  `mapOfCases` - a map that maps a case key to an Flowable
  `defaultCase` - the default Flowable if the `mapOfCases` doesn't contain a value for the key returned by the `caseSelector`
Returns:
  a particular Flowable chosen by key from the map of Observables, or the default case if no Flowable matches the key

#### doWhile

    public static <T> io.reactivex.Flowable<T> doWhile(org.reactivestreams.Publisher<? extends T> source,
                                                       io.reactivex.functions.BooleanSupplier postCondition)

Return an Flowable that re-emits the emissions from the source Flowable, and then re-subscribes to the source long as a condition is true.

Type Parameters:
  `T` - the value type
Parameters:
  `source` - the source Flowable to work with
  `postCondition` - the post condition to test after the source Flowable completes
Returns:
  an Flowable that replays the emissions from the source Flowable, and then continues to replay them so long as the post condition is true

#### whileDo

    public static <T> io.reactivex.Flowable<T> whileDo(org.reactivestreams.Publisher<? extends T> source,
                                                       io.reactivex.functions.BooleanSupplier preCondition)

Return an Flowable that re-emits the emissions from the source Flowable as long as the condition is true before the first or subsequent subscribe() calls.

Type Parameters:
  `T` - the value type
Parameters:
  `source` - the source Flowable to work with
  `preCondition` - the condition to evaluate before subscribing to or replaying the source Flowable
Returns:
  an Flowable that replays the emissions from the source Flowable so long as `preCondition` is true

#### ifThen

    public static <R> io.reactivex.Flowable<R> ifThen(io.reactivex.functions.BooleanSupplier condition,
                                                      org.reactivestreams.Publisher<? extends R> then)

Return an Flowable that emits the emissions from a specified Flowable if a condition evaluates to true, otherwise return an empty Flowable.

Type Parameters:
  `R` - the result value type
Parameters:
  `condition` - the condition that decides whether to emit the emissions from the `then` Flowable
  `then` - the Flowable sequence to emit to if `condition` is `true`
Returns:
  an Flowable that mimics the `then` Flowable if the `condition` function evaluates to true, or an empty Flowable otherwise

#### ifThen

    public static <R> io.reactivex.Flowable<R> ifThen(io.reactivex.functions.BooleanSupplier condition,
                                                      org.reactivestreams.Publisher<? extends R> then,
                                                      io.reactivex.Scheduler scheduler)

Return an Flowable that emits the emissions from a specified Flowable if a condition evaluates to true, otherwise return an empty Flowable that runs on a specified Scheduler.

Type Parameters:
  `R` - the result value type
Parameters:
  `condition` - the condition that decides whether to emit the emissions from the `then` Flowable
  `then` - the Flowable sequence to emit to if `condition` is `true`
  `scheduler` - the Scheduler on which the empty Flowable runs if the in case the condition returns false
Returns:
  an Flowable that mimics the `then` Flowable if the `condition` function evaluates to true, or an empty Flowable running on the specified Scheduler otherwise

#### ifThen

    public static <R> io.reactivex.Flowable<R> ifThen(io.reactivex.functions.BooleanSupplier condition,
                                                      org.reactivestreams.Publisher<? extends R> then,
                                                      io.reactivex.Flowable<? extends R> orElse)

Return an Flowable that emits the emissions from one specified Flowable if a condition evaluates to true, or from another specified Flowable otherwise.

Type Parameters:
  `R` - the result value type
Parameters:
  `condition` - the condition that decides which Flowable to emit the emissions from
  `then` - the Flowable sequence to emit to if `condition` is `true`
  `orElse` - the Flowable sequence to emit to if `condition` is `false`
Returns:
  an Flowable that mimics either the `then` or `orElse` Observables depending on a condition function