forkJoin2<A, B, T> static method

Single<T> forkJoin2<A, B, T>(
  1. Single<A> singleA,
  2. Single<B> singleB,
  3. T combiner(
    1. A,
    2. B
    )
)

Merges the given Singles into a single Single sequence by using the combiner function when all of the Single sequences emits their last item.

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

See Rx.forkJoin2 and ForkJoinStream.

Implementation

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