Skip to content

Added the switch operator to Observable #259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 16, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions rxjava-core/src/main/java/rx/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import rx.operators.OperationScan;
import rx.operators.OperationSkip;
import rx.operators.OperationSubscribeOn;
import rx.operators.OperationSwitch;
import rx.operators.OperationSynchronize;
import rx.operators.OperationTake;
import rx.operators.OperationTakeLast;
Expand Down Expand Up @@ -1981,6 +1982,19 @@ public static <T> Observable<T> skip(final Observable<T> items, int num) {
return create(OperationSkip.skip(items, num));
}

/**
* Accepts an {@link Observable} sequence of {@link Observable} sequences, and transforms it into a single
* {@link Observable} sequence, which publishes the values of the most recently published {@link Observable} sequence.
*
* @param sequenceOfSequences
* the {@link Observable} sequence of {@link Observable} sequences.
* @return an {@link Observable} which publishes only the values of the most recently published
* {@link Observable} sequence.
*/
public static <T> Observable<T> switchDo(Observable<Observable<T>> sequenceOfSequences) {
return create(OperationSwitch.switchDo(sequenceOfSequences));
}

/**
* Accepts an Observable and wraps it in another Observable that ensures that the resulting
* Observable is chronologically well-behaved.
Expand Down
Loading