Skip to content

Instantly share code, notes, and snippets.

@kiwiandroiddev
Created May 28, 2018 03:03
Show Gist options
  • Select an option

  • Save kiwiandroiddev/1f89c7936f6449956527c60f55e5c11f to your computer and use it in GitHub Desktop.

Select an option

Save kiwiandroiddev/1f89c7936f6449956527c60f55e5c11f to your computer and use it in GitHub Desktop.
Async combine latest operator implementation for RxJava2 in Kotlin
fun <T1, T2, T3, R> asyncCombineLatest(o1: Observable<T1>,
o2: Observable<T2>,
o3: Observable<T3>,
asyncCombineFunc: (T1, T2, T3) -> Observable<R>): Observable<R> =
Observable.combineLatest(o1, o2, o3,
Function3<T1, T2, T3, Observable<R>> { t1, t2, t3 -> asyncCombineFunc(t1, t2, t3) }
).flatMap { it }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment