combineLatest2<A, B, T> method

Observable<T> combineLatest2 <A, B, T>(Stream<A> streamA, Stream<B> streamB, T combiner(A a, B b))

Merges the given Streams into one Observable sequence by using the combiner function whenever any of the observable sequences emits an item.

The Observable will not emit until all streams have emitted at least one item.

Interactive marble diagram

Example

Observable.combineLatest2(
  new Observable.just(1),
  new Observable.fromIterable([0, 1, 2]),
  (a, b) => a + b)
.listen(print); //prints 1, 2, 3

Implementation

static Observable<T> combineLatest2<A, B, T>(
        Stream<A> streamA, Stream<B> streamB, T combiner(A a, B b)) =>
    new Observable<T>(
        CombineLatestStream.combine2(streamA, streamB, combiner));