@Test public void testTakeWhileOnSubject1() { Subject<Integer, Integer> s = PublishSubject.create(); Observable<Integer> take = Observable.create(takeWhile(s, new Func1<Integer, Boolean>() { @Override public Boolean call(Integer input) { return input < 3; } })); @SuppressWarnings("unchecked") Observer<Integer> observer = mock(Observer.class); take.subscribe(observer); s.onNext(1); s.onNext(2); s.onNext(3); s.onNext(4); s.onNext(5); s.onCompleted(); verify(observer, times(1)).onNext(1); verify(observer, times(1)).onNext(2); verify(observer, never()).onNext(3); verify(observer, never()).onNext(4); verify(observer, never()).onNext(5); verify(observer, never()).onError(any(Throwable.class)); verify(observer, times(1)).onCompleted(); }
public static <T> OnSubscribeFunc<T> takeWhile(final Observable<? extends T> items, final Func1<? super T, Boolean> predicate) { return takeWhileWithIndex(items, OperationTakeWhile.<T> skipIndex(predicate)); }
OperationTakeWhile { public static <T> OnSubscribeFunc<T> takeWhile(final Observable<? extends T> items, final Func1<? super T, Boolean> predicate) { return takeWhileWithIndex(items, OperationTakeWhile.<T> skipIndex(predicate)); } }
OperationTakeWhile { public static <T> OnSubscribeFunc<T> takeWhile(final Observable<? extends T> items, final Func1<? super T, Boolean> predicate) { return takeWhileWithIndex(items, OperationTakeWhile.<T> skipIndex(predicate)); }  }
OperationTakeWhile { public static <T> OnSubscribeFunc<T> takeWhile(final Observable<? extends T> items, final Func1<? super T, Boolean> predicate) { return takeWhileWithIndex(items, OperationTakeWhile.<T> skipIndex(predicate)); }  static OnSubscribeFunc<T> takeWhile(final Observable<? extends T> items, final Func1<? super T, Boolean> predicate); static OnSubscribeFunc<T> takeWhileWithIndex(final Observable<? extends T> items, final Func2<? super T, ? super Integer, Boolean> predicate); }
OperationTakeWhile { public static <T> OnSubscribeFunc<T> takeWhile(final Observable<? extends T> items, final Func1<? super T, Boolean> predicate) { return takeWhileWithIndex(items, OperationTakeWhile.<T> skipIndex(predicate)); }  static OnSubscribeFunc<T> takeWhile(final Observable<? extends T> items, final Func1<? super T, Boolean> predicate); static OnSubscribeFunc<T> takeWhileWithIndex(final Observable<? extends T> items, final Func2<? super T, ? super Integer, Boolean> predicate);  }