RxJava
rx.operators
Class OperationTakeWhile
java.lang.Object
rx.operators.OperationTakeWhile
public final class OperationTakeWhile
- extends java.lang.Object
Returns an Observable that emits items emitted by the source Observable as long as a specified
condition is true.
|
Method Summary |
static
|
takeWhile(Observable<? extends T> items,
Func1<? super T,java.lang.Boolean> predicate)
Returns values from an observable sequence as long as a specified condition is true, and then skips the remaining values. |
static
|
takeWhileWithIndex(Observable<? extends T> items,
Func2<? super T,? super java.lang.Integer,java.lang.Boolean> predicate)
Returns values from an observable sequence as long as a specified condition is true, and then skips the remaining values. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OperationTakeWhile
public OperationTakeWhile()
takeWhile
public static <T> Observable.OnSubscribeFunc<T> takeWhile(Observable<? extends T> items,
Func1<? super T,java.lang.Boolean> predicate)
- Returns values from an observable sequence as long as a specified condition is true, and then skips the remaining values.
- Parameters:
items - predicate - a function to test each source element for a condition
- Returns:
- sequence of observable values from the start as long as the predicate is true
takeWhileWithIndex
public static <T> Observable.OnSubscribeFunc<T> takeWhileWithIndex(Observable<? extends T> items,
Func2<? super T,? super java.lang.Integer,java.lang.Boolean> predicate)
- Returns values from an observable sequence as long as a specified condition is true, and then skips the remaining values.
- Parameters:
items - predicate - a function to test each element for a condition; the second parameter of the function represents the index of the source element; otherwise, false.
- Returns:
- sequence of observable values from the start as long as the predicate is true