@Test public void fallback() { TestSubscriber<Integer> ts = new TestSubscriber<>(Long.MAX_VALUE); Multi.<Integer>empty() .switchIfEmpty(Multi.singleton(2)) .subscribe(ts); ts.assertResult(2); }
@Override public void subscribe(Flow.Subscriber<? super T> subscriber) { source.subscribe(new SwitchIfEmptyMainSubscriber<>(subscriber, fallback)); }
MultiSwitchIfEmpty implements Multi<T> { @Override public void subscribe(Flow.Subscriber<? super T> subscriber) { source.subscribe(new SwitchIfEmptyMainSubscriber<>(subscriber, fallback)); } }
MultiSwitchIfEmpty implements Multi<T> { @Override public void subscribe(Flow.Subscriber<? super T> subscriber) { source.subscribe(new SwitchIfEmptyMainSubscriber<>(subscriber, fallback)); } MultiSwitchIfEmpty(Multi<T> source, Flow.Publisher<T> fallback); }
MultiSwitchIfEmpty implements Multi<T> { @Override public void subscribe(Flow.Subscriber<? super T> subscriber) { source.subscribe(new SwitchIfEmptyMainSubscriber<>(subscriber, fallback)); } MultiSwitchIfEmpty(Multi<T> source, Flow.Publisher<T> fallback); @Override void subscribe(Flow.Subscriber<? super T> subscriber); }
MultiSwitchIfEmpty implements Multi<T> { @Override public void subscribe(Flow.Subscriber<? super T> subscriber) { source.subscribe(new SwitchIfEmptyMainSubscriber<>(subscriber, fallback)); } MultiSwitchIfEmpty(Multi<T> source, Flow.Publisher<T> fallback); @Override void subscribe(Flow.Subscriber<? super T> subscriber);  }