Skip to content

Commit 9710f06

Browse files
akarnokdzsxwing
authored andcommitted
1.x: add termination clarification to switchMap operators (#3974)
Closes #3576 .
1 parent fef520e commit 9710f06

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/main/java/rx/Observable.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2846,6 +2846,9 @@ public static <T> Observable<Boolean> sequenceEqual(Observable<? extends T> firs
28462846
* these emitted Observables, the Observable returned by {@code switchOnNext} begins emitting the items
28472847
* emitted by that Observable. When a new Observable is emitted, {@code switchOnNext} stops emitting items
28482848
* from the earlier-emitted Observable and begins emitting items from the new one.
2849+
* <p>
2850+
* The resulting Observable completes if both the outer Observable and the last inner Observable, if any, complete.
2851+
* If the outer Observable signals an onError, the inner Observable is unsubscribed and the error delivered in-sequence.
28492852
* <dl>
28502853
* <dt><b>Scheduler:</b></dt>
28512854
* <dd>{@code switchOnNext} does not operate by default on a particular {@link Scheduler}.</dd>
@@ -2872,6 +2875,10 @@ public static <T> Observable<T> switchOnNext(Observable<? extends Observable<? e
28722875
* these emitted Observables, the Observable returned by {@code switchOnNext} begins emitting the items
28732876
* emitted by that Observable. When a new Observable is emitted, {@code switchOnNext} stops emitting items
28742877
* from the earlier-emitted Observable and begins emitting items from the new one.
2878+
* <p>
2879+
* The resulting Observable completes if both the main Observable and the last inner Observable, if any, complete.
2880+
* If the main Observable signals an onError, the termination of the last inner Observable will emit that error as is
2881+
* or wrapped into a CompositeException along with the other possible errors the former inner Observables signalled.
28752882
* <dl>
28762883
* <dt><b>Scheduler:</b></dt>
28772884
* <dd>{@code switchOnNext} does not operate by default on a particular {@link Scheduler}.</dd>
@@ -8619,6 +8626,9 @@ public final Observable<T> subscribeOn(Scheduler scheduler) {
86198626
* Observable that returns an Observable, and then emitting the items emitted by the most recently emitted
86208627
* of these Observables.
86218628
* <p>
8629+
* The resulting Observable completes if both the upstream Observable and the last inner Observable, if any, complete.
8630+
* If the upstream Observable signals an onError, the inner Observable is unsubscribed and the error delivered in-sequence.
8631+
* <p>
86228632
* <img width="640" height="350" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/switchMap.png" alt="">
86238633
* <dl>
86248634
* <dt><b>Scheduler:</b></dt>
@@ -8640,6 +8650,10 @@ public final <R> Observable<R> switchMap(Func1<? super T, ? extends Observable<?
86408650
* Observable that returns an Observable, and then emitting the items emitted by the most recently emitted
86418651
* of these Observables and delays any error until all Observables terminate.
86428652
* <p>
8653+
* The resulting Observable completes if both the upstream Observable and the last inner Observable, if any, complete.
8654+
* If the upstream Observable signals an onError, the termination of the last inner Observable will emit that error as is
8655+
* or wrapped into a CompositeException along with the other possible errors the former inner Observables signalled.
8656+
* <p>
86438657
* <img width="640" height="350" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/switchMap.png" alt="">
86448658
* <dl>
86458659
* <dt><b>Scheduler:</b></dt>

0 commit comments

Comments
 (0)