Android RxJava zip 操作符
不说话,直接举例
// zip 2 observables
Observable.zip(Observable.just(0), Observable.just(0), BiFunction {
t1: Int, t2: Int -> (t1 + t2)
})
// zip 3 observables
Observable.zip(Observable.just(0), Observable.just(0), Observable.just(0), object: Function3<Int, Int, Int, Int> {
override fun apply(t1: Int, t2: Int, t3: Int): Int {
return 0
}
})
// zip observable list
val list = arrayListOf<Observable
Observable.zip(list) { _ -> 0 }
移动开发者