Skip to content

Commit add6c29

Browse files
Alias from switchOnNext to switchLatest to match RxJS
- keeping onNext to be locally consistent with doOnNext
1 parent 88c4955 commit add6c29

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

rxjava-core/src/main/java/rx/Observable.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,6 +1930,23 @@ public static <T> Observable<T> switchDo(Observable<? extends Observable<? exten
19301930
public static <T> Observable<T> switchOnNext(Observable<? extends Observable<? extends T>> sequenceOfSequences) {
19311931
return create(OperationSwitch.switchDo(sequenceOfSequences));
19321932
}
1933+
1934+
/**
1935+
* Given an Observable that emits Observables, returns an Observable that
1936+
* emits the items emitted by the most recently emitted of those
1937+
* Observables.
1938+
* <p>
1939+
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/switchDo.png">
1940+
*
1941+
* @param sequenceOfSequences the source Observable that emits Observables
1942+
* @return an Observable that emits only the items emitted by the Observable
1943+
* most recently emitted by the source Observable
1944+
* @see <a href="https://github.com/Netflix/RxJava/wiki/Combining-Observables#switchonnext">RxJava Wiki: switchOnNext()</a>
1945+
* @see {@link #switchOnNext(Observable)}
1946+
*/
1947+
public static <T> Observable<T> switchLatest(Observable<? extends Observable<? extends T>> sequenceOfSequences) {
1948+
return create(OperationSwitch.switchDo(sequenceOfSequences));
1949+
}
19331950

19341951
/**
19351952
* Return an Observable that subscribes to an observable sequence

0 commit comments

Comments
 (0)