Skip to content

Commit cd9a6ec

Browse files
committed
Merge pull request #3661 from akarnokd/CombineLatestManyV3
1.x: CombineLatest now supports any number of sources
2 parents 8d95d16 + dc2e516 commit cd9a6ec

File tree

3 files changed

+473
-286
lines changed

3 files changed

+473
-286
lines changed

src/main/java/rx/Observable.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,31 @@ public static <T, R> Observable<R> combineLatest(List<? extends Observable<? ext
810810
return create(new OnSubscribeCombineLatest<T, R>(sources, combineFunction));
811811
}
812812

813+
/**
814+
* Combines a collection of source Observables by emitting an item that aggregates the latest values of each of
815+
* the source Observables each time an item is received from any of the source Observables, where this
816+
* aggregation is defined by a specified function.
817+
* <dl>
818+
* <dt><b>Scheduler:</b></dt>
819+
* <dd>{@code combineLatest} does not operate by default on a particular {@link Scheduler}.</dd>
820+
* </dl>
821+
*
822+
* @param <T>
823+
* the common base type of source values
824+
* @param <R>
825+
* the result type
826+
* @param sources
827+
* the collection of source Observables
828+
* @param combineFunction
829+
* the aggregation function used to combine the items emitted by the source Observables
830+
* @return an Observable that emits items that are the result of combining the items emitted by the source
831+
* Observables by means of the given aggregation function
832+
* @see <a href="http://reactivex.io/documentation/operators/combinelatest.html">ReactiveX operators documentation: CombineLatest</a>
833+
*/
834+
public static <T, R> Observable<R> combineLatest(Iterable<? extends Observable<? extends T>> sources, FuncN<? extends R> combineFunction) {
835+
return create(new OnSubscribeCombineLatest<T, R>(sources, combineFunction));
836+
}
837+
813838
/**
814839
* Returns an Observable that emits the items emitted by each of the Observables emitted by the source
815840
* Observable, one after the other, without interleaving them.

0 commit comments

Comments
 (0)