Skip to content

Instantly share code, notes, and snippets.

@kiwiandroiddev
Created May 28, 2018 22:52
Show Gist options
  • Save kiwiandroiddev/1dd18f6cefbe2d2b0fd944c80606d96a to your computer and use it in GitHub Desktop.
Save kiwiandroiddev/1dd18f6cefbe2d2b0fd944c80606d96a to your computer and use it in GitHub Desktop.
fun <T1, T2, R> asyncZip(source1: Single<T1>,
source2: Single<T2>,
zipper: (T1, T2) -> Single<R>): Single<R> =
Single.zip(
source1, source2,
io.reactivex.functions.BiFunction<T1, T2, Single<R>> { t1, t2 -> zipper(t1, t2) }
).flatMap { it }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment