@Test public void limited() { TestSubscriber<Integer> ts = new TestSubscriber<>(); Multi.just(1, 2, 3, 4, 5) .takeWhile(v -> v < 4) .subscribe(ts); ts.requestMax(); assertEquals(ts.getItems(), Arrays.asList(1, 2, 3)); assertThat(ts.getLastError(), is(nullValue())); assertThat(ts.isComplete(), is(true)); }
@Override public void subscribe(Flow.Subscriber<? super T> subscriber) { source.subscribe(new TakeWhileSubscriber<>(subscriber, predicate)); }
MultiTakeWhilePublisher implements Multi<T> { @Override public void subscribe(Flow.Subscriber<? super T> subscriber) { source.subscribe(new TakeWhileSubscriber<>(subscriber, predicate)); } }
MultiTakeWhilePublisher implements Multi<T> { @Override public void subscribe(Flow.Subscriber<? super T> subscriber) { source.subscribe(new TakeWhileSubscriber<>(subscriber, predicate)); } MultiTakeWhilePublisher(Multi<T> source, Predicate<? super T> predicate); }
MultiTakeWhilePublisher implements Multi<T> { @Override public void subscribe(Flow.Subscriber<? super T> subscriber) { source.subscribe(new TakeWhileSubscriber<>(subscriber, predicate)); } MultiTakeWhilePublisher(Multi<T> source, Predicate<? super T> predicate); @Override void subscribe(Flow.Subscriber<? super T> subscriber); }
MultiTakeWhilePublisher implements Multi<T> { @Override public void subscribe(Flow.Subscriber<? super T> subscriber) { source.subscribe(new TakeWhileSubscriber<>(subscriber, predicate)); } MultiTakeWhilePublisher(Multi<T> source, Predicate<? super T> predicate); @Override void subscribe(Flow.Subscriber<? super T> subscriber);  }