/** * 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. * <p> * <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/whileDo.png" alt=""> * * @param <T> the value type * @param source the source Flowable to work with * @param preCondition * the condition to evaluate before subscribing to or * replaying the source Flowable * @return an Flowable that replays the emissions from the source * Flowable so long as <code>preCondition</code> is true */ public static <T> Flowable<T> whileDo(Publisher<? extends T> source, BooleanSupplier preCondition) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(preCondition, "preCondition is null"); return RxJavaPlugins.onAssembly(new FlowableWhileDoWhile<T>(source, preCondition, 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. * <p> * <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/whileDo.png" alt=""> * * @param <T> the value type * @param source the source Flowable to work with * @param preCondition * the condition to evaluate before subscribing to or * replaying the source Flowable * @return an Flowable that replays the emissions from the source * Flowable so long as <code>preCondition</code> is true */ public static <T> Flowable<T> whileDo(Publisher<? extends T> source, BooleanSupplier preCondition) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(preCondition, "preCondition is null"); return RxJavaPlugins.onAssembly(new FlowableWhileDoWhile<T>(source, preCondition, preCondition)); }
/** * 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. * <p> * <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/doWhile.png" alt=""> * * @param <T> the value type * @param source the source Flowable to work with * @param postCondition * the post condition to test after the source * Flowable completes * @return an Flowable that replays the emissions from the source * Flowable, and then continues to replay them so long as the post * condition is true */ public static <T> Flowable<T> doWhile(Publisher<? extends T> source, BooleanSupplier postCondition) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(postCondition, "postCondition is null"); return RxJavaPlugins.onAssembly(new FlowableWhileDoWhile<T>(source, AlwaysTrueBooleanSupplier.INSTANCE, 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. * <p> * <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/doWhile.png" alt=""> * * @param <T> the value type * @param source the source Flowable to work with * @param postCondition * the post condition to test after the source * Flowable completes * @return an Flowable that replays the emissions from the source * Flowable, and then continues to replay them so long as the post * condition is true */ public static <T> Flowable<T> doWhile(Publisher<? extends T> source, BooleanSupplier postCondition) { ObjectHelper.requireNonNull(source, "source is null"); ObjectHelper.requireNonNull(postCondition, "postCondition is null"); return RxJavaPlugins.onAssembly(new FlowableWhileDoWhile<T>(source, AlwaysTrueBooleanSupplier.INSTANCE, postCondition)); }