Kotlin and RxJava - Why is my Single.zip() not compiling?

后端 未结 3 1282
醉梦人生
醉梦人生 2020-12-30 21:31

I\'m going a little crazy here. I\'m trying to create an Observable extension function (against RxJava 2.x) to emit the average of the emissio

3条回答
  •  春和景丽
    2020-12-30 22:06

    If type inferencing is the problem, one thing you can do is use RxKotlin

    implementation "io.reactivex.rxjava2:rxkotlin:$rxKotlinVersion"
    

    RxKotlin specifically provides SAM helpers to help mitigate the issues with type inferencing issues.

    In which case,

    Singles.zip(..., ...)
    

    would be able to work just fine without any ambiguity. Notice I am using Singles and not Single

提交回复
热议问题