@Test public void iteratorHasNextCrash2ndCall() { TestSubscriber<Integer> ts = new TestSubscriber<>(); Single.just(1).flatMapIterable(v -> () -> new Iterator<Integer>() { int calls; @Override public boolean hasNext() { if (++calls == 2) { throw new IllegalArgumentException(); } return true; } @Override public Integer next() { return 1; } }) .subscribe(ts); ts.request1(); assertEquals(ts.getItems(), Collections.singleton(1)); assertThat(ts.isComplete(), is(false)); assertThat(ts.getLastError(), instanceOf(IllegalArgumentException.class)); }
@Override public void subscribe(Flow.Subscriber<? super R> subscriber) { source.subscribe(new FlatMapIterableSubscriber<>(subscriber, mapper)); }
SingleFlatMapIterable implements Multi<R> { @Override public void subscribe(Flow.Subscriber<? super R> subscriber) { source.subscribe(new FlatMapIterableSubscriber<>(subscriber, mapper)); } }
SingleFlatMapIterable implements Multi<R> { @Override public void subscribe(Flow.Subscriber<? super R> subscriber) { source.subscribe(new FlatMapIterableSubscriber<>(subscriber, mapper)); } SingleFlatMapIterable(Single<T> source, Function<? super T, ? extends Iterable<? extends R>> mapper); }
SingleFlatMapIterable implements Multi<R> { @Override public void subscribe(Flow.Subscriber<? super R> subscriber) { source.subscribe(new FlatMapIterableSubscriber<>(subscriber, mapper)); } SingleFlatMapIterable(Single<T> source, Function<? super T, ? extends Iterable<? extends R>> mapper); @Override void subscribe(Flow.Subscriber<? super R> subscriber); }
SingleFlatMapIterable implements Multi<R> { @Override public void subscribe(Flow.Subscriber<? super R> subscriber) { source.subscribe(new FlatMapIterableSubscriber<>(subscriber, mapper)); } SingleFlatMapIterable(Single<T> source, Function<? super T, ? extends Iterable<? extends R>> mapper); @Override void subscribe(Flow.Subscriber<? super R> subscriber);  }