withLatestFrom9<A, B, C, D, E, F, G, H, I, R> method

Observable<R> withLatestFrom9 <A, B, C, D, E, F, G, H, I, R>(Stream<A> latestFromStream1, Stream<B> latestFromStream2, Stream<C> latestFromStream3, Stream<D> latestFromStream4, Stream<E> latestFromStream5, Stream<F> latestFromStream6, Stream<G> latestFromStream7, Stream<H> latestFromStream8, Stream<I> latestFromStream9, R fn(T t, A a, B b, C c, D d, E e, F f, G g, H h, I i))

Creates an Observable that emits when the source stream emits, combining the latest values from the ten streams using the provided function.

If any of latestFromStreams has not emitted any values, this stream will not emit either.

Interactive marble diagram

Example

Observable.fromIterable([1, 2])
  .withLatestFrom9(
    Observable.fromIterable([2, 3]),
    Observable.fromIterable([3, 4]),
    Observable.fromIterable([4, 5]),
    Observable.fromIterable([5, 6]),
    Observable.fromIterable([6, 7]),
    Observable.fromIterable([7, 8]),
    Observable.fromIterable([8, 9]),
    Observable.fromIterable([9, 10]),
    Observable.fromIterable([10, 11]),
    (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j) =>
        a + b + c + d + e + f + g + h + i + j,
  )
  .listen(print); // prints 46 (due to the async nature of streams)

Implementation

Observable<R> withLatestFrom9<A, B, C, D, E, F, G, H, I, R>(
  Stream<A> latestFromStream1,
  Stream<B> latestFromStream2,
  Stream<C> latestFromStream3,
  Stream<D> latestFromStream4,
  Stream<E> latestFromStream5,
  Stream<F> latestFromStream6,
  Stream<G> latestFromStream7,
  Stream<H> latestFromStream8,
  Stream<I> latestFromStream9,
  R fn(T t, A a, B b, C c, D d, E e, F f, G g, H h, I i),
) =>
    transform(WithLatestFromStreamTransformer.with9(
      latestFromStream1,
      latestFromStream2,
      latestFromStream3,
      latestFromStream4,
      latestFromStream5,
      latestFromStream6,
      latestFromStream7,
      latestFromStream8,
      latestFromStream9,
      fn,
    ));