zip2<A, B, T> static method

Single<T> zip2<A, B, T>(
  1. Single<A> singleA,
  2. Single<B> singleB,
  3. T zipper(
    1. A,
    2. B
    )
)

Merges the specified Singles into one Single sequence using the given zipper function whenever all of the Single sequences have produced an element.

When the first data event or error event is emitted, the returned Single will emit that event and then close with a done-event. The returned Single is single-subscription Stream.

Marble

singleA: ----------a|
singleB: ---------------b|
result : ---------------ab|

singleA: ----------x|
singleB: ---------------b|
result : ----------x|

singleA: ----------x|
singleB: ---------------x|
result : ----------x|

NOTE: x is error event

Interactive marble diagram

See Rx.zip2 and ZipStream.

Implementation

static Single<T> zip2<A, B, T>(
  Single<A> singleA,
  Single<B> singleB,
  T Function(A, B) zipper,
) =>
    Rx.zip2(singleA, singleB, zipper).takeFirstDataOrFirstErrorAndClose();