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 }

posted @ 2019-04-29 22:02  davesuen  阅读(1884)  评论(0编辑  收藏  举报