Skip to content

Commit 621a433

Browse files
Merge pull request #166 from benjchristensen/next-review
Review of Next Operation
2 parents f7f47de + df66270 commit 621a433

File tree

2 files changed

+399
-0
lines changed

2 files changed

+399
-0
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import rx.operators.OperationMaterialize;
3737
import rx.operators.OperationMerge;
3838
import rx.operators.OperationMergeDelayError;
39+
import rx.operators.OperationNext;
3940
import rx.operators.OperationOnErrorResumeNextViaFunction;
4041
import rx.operators.OperationOnErrorResumeNextViaObservable;
4142
import rx.operators.OperationOnErrorReturn;
@@ -1710,6 +1711,17 @@ public Iterator<T> iterator() {
17101711
};
17111712
}
17121713

1714+
/**
1715+
* Samples the next value (blocking without buffering) from in an observable sequence.
1716+
*
1717+
* @param items the source observable sequence.
1718+
* @param <T> the type of observable.
1719+
* @return iterable that blocks upon each iteration until the next element in the observable source sequence becomes available.
1720+
*/
1721+
public static <T> Iterable<T> next(Observable<T> items) {
1722+
return OperationNext.next(items);
1723+
}
1724+
17131725
/**
17141726
* Returns the only element of an observable sequence and throws an exception if there is not exactly one element in the observable sequence.
17151727
*
@@ -2892,6 +2904,15 @@ public Iterable<T> toIterable() {
28922904
return toIterable(this);
28932905
}
28942906

2907+
/**
2908+
* Samples the next value (blocking without buffering) from in an observable sequence.
2909+
*
2910+
* @return iterable that blocks upon each iteration until the next element in the observable source sequence becomes available.
2911+
*/
2912+
public Iterable<T> next() {
2913+
return next(this);
2914+
}
2915+
28952916
public static class UnitTest {
28962917

28972918
@Mock

0 commit comments

Comments
 (0)