@Test public void cancelMain() { SubmissionPublisher<Integer> sp = new SubmissionPublisher<>(Runnable::run, 32); TestSubscriber<Integer> ts = new TestSubscriber<>(); Single.create(sp) .flatMapSingle(v -> Single.just(2)) .subscribe(ts); assertThat(sp.hasSubscribers(), is(true)); ts.getSubcription().cancel(); assertThat(sp.hasSubscribers(), is(false)); }
@Override public void subscribe(Flow.Subscriber<? super R> subscriber) { Objects.requireNonNull(subscriber, "subscriber is null"); source.subscribe(new FlatMapSubscriber<>(subscriber, mapper)); }
SingleFlatMapSingle extends CompletionSingle<R> { @Override public void subscribe(Flow.Subscriber<? super R> subscriber) { Objects.requireNonNull(subscriber, "subscriber is null"); source.subscribe(new FlatMapSubscriber<>(subscriber, mapper)); } }
SingleFlatMapSingle extends CompletionSingle<R> { @Override public void subscribe(Flow.Subscriber<? super R> subscriber) { Objects.requireNonNull(subscriber, "subscriber is null"); source.subscribe(new FlatMapSubscriber<>(subscriber, mapper)); } SingleFlatMapSingle(Single<T> source, Function<? super T, ? extends Single<? extends R>> mapper); }
SingleFlatMapSingle extends CompletionSingle<R> { @Override public void subscribe(Flow.Subscriber<? super R> subscriber) { Objects.requireNonNull(subscriber, "subscriber is null"); source.subscribe(new FlatMapSubscriber<>(subscriber, mapper)); } SingleFlatMapSingle(Single<T> source, Function<? super T, ? extends Single<? extends R>> mapper); @Override void subscribe(Flow.Subscriber<? super R> subscriber); }
SingleFlatMapSingle extends CompletionSingle<R> { @Override public void subscribe(Flow.Subscriber<? super R> subscriber) { Objects.requireNonNull(subscriber, "subscriber is null"); source.subscribe(new FlatMapSubscriber<>(subscriber, mapper)); } SingleFlatMapSingle(Single<T> source, Function<? super T, ? extends Single<? extends R>> mapper); @Override void subscribe(Flow.Subscriber<? super R> subscriber);  }