Skip to content

Commit

Permalink
Merge pull request ReactiveX#166 from benjchristensen/next-review
Browse files Browse the repository at this point in the history
Review of Next Operation
  • Loading branch information
benjchristensen committed Mar 2, 2013
2 parents 0b6d18a + 76abfa7 commit 1269420
Show file tree
Hide file tree
Showing 2 changed files with 399 additions and 0 deletions.
21 changes: 21 additions & 0 deletions rxjava-core/src/main/java/rx/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import rx.operators.OperationMaterialize;
import rx.operators.OperationMerge;
import rx.operators.OperationMergeDelayError;
import rx.operators.OperationNext;
import rx.operators.OperationOnErrorResumeNextViaFunction;
import rx.operators.OperationOnErrorResumeNextViaObservable;
import rx.operators.OperationOnErrorReturn;
Expand Down Expand Up @@ -1710,6 +1711,17 @@ public Iterator<T> iterator() {
};
}

/**
* Samples the next value (blocking without buffering) from in an observable sequence.
*
* @param items the source observable sequence.
* @param <T> the type of observable.
* @return iterable that blocks upon each iteration until the next element in the observable source sequence becomes available.
*/
public static <T> Iterable<T> next(Observable<T> items) {
return OperationNext.next(items);
}

/**
* Returns the only element of an observable sequence and throws an exception if there is not exactly one element in the observable sequence.
*
Expand Down Expand Up @@ -2892,6 +2904,15 @@ public Iterable<T> toIterable() {
return toIterable(this);
}

/**
* Samples the next value (blocking without buffering) from in an observable sequence.
*
* @return iterable that blocks upon each iteration until the next element in the observable source sequence becomes available.
*/
public Iterable<T> next() {
return next(this);
}

public static class UnitTest {

@Mock
Expand Down
Loading

0 comments on commit 1269420

Please sign in to comment.