Skip to content

Commit

Permalink
SwitchDo
Browse files Browse the repository at this point in the history
- remove instance method
- rename to switchOnNext (leaving behind deprecated switchDo for now)

See ReactiveX#342
  • Loading branch information
benjchristensen committed Sep 5, 2013
1 parent bd0e5c7 commit 4bfd6a4
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions rxjava-core/src/main/java/rx/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -783,29 +783,28 @@ public static <T> Observable<T> never() {
* the source Observable that emits Observables
* @return an Observable that emits only the items emitted by the most recently published
* Observable
* @deprecated Being renamed to {@link #switchOnNext}
*/
@Deprecated
public static <T> Observable<T> switchDo(Observable<? extends Observable<? extends T>> sequenceOfSequences) {
// TODO should this static remain? I have left it because it is an Observable<Observable>
return create(OperationSwitch.switchDo(sequenceOfSequences));
}

/**
* On an Observable that emits Observables, creates a single Observable that
* Given an Observable that emits Observables, creates a single Observable that
* emits the items emitted by the most recently published of those Observables.
* <p>
* <img width="640" src="https://github.com/Netflix/RxJava/wiki/images/rx-operators/switchDo.png">
*
* @param sequenceOfSequences
* the source Observable that emits Observables
* @return an Observable that emits only the items emitted by the most recently published
* Observable
* @throws ClassCastException
* if sequence not of type {@code Observable<Observable<T>}
*/
@SuppressWarnings("unchecked")
public Observable<T> switchDo() {
// TODO can we come up with a better name than this? It should be 'switch' but that is reserved.
// Perhaps 'switchOnNext'?
return create(OperationSwitch.switchDo((Observable<? extends Observable<? extends T>>) this));
public static <T> Observable<T> switchOnNext(Observable<? extends Observable<? extends T>> sequenceOfSequences) {
return create(OperationSwitch.switchDo(sequenceOfSequences));
}


/**
* Accepts an Observable and wraps it in another Observable that ensures that the resulting
Expand Down

0 comments on commit 4bfd6a4

Please sign in to comment.