我正在尝试使用RxJava2压缩List<Flowable>
,但编译失败。代码段如下
private fun flowInts() {
val flows = ArrayList<Flowable<Int>>()
for (i in 0..10) {
flows.add(getFlow(i))
}
Flowable.zip(flows, Function<Array<Int>, List<Int>> {array -> // I get compile error at Flowable.zip
array .toList()
})
}
private fun getFlow(i: Int): Flowable<Int> {
return Flowable.fromCallable { return@fromCallable i }
}
这有什么问题?