The following can’t be resolved. The culprit seems...
# rx
r
The following can’t be resolved. The culprit seems to be the
BiFunction
, but I can’t figure out what specifically I’ve done incorrectly
Copy code
val one = Observable.fromIterable(listOf(1,2,3))
        val two = Observable.fromIterable(listOf(4,5,6))
        Observable.combineLatest(one, two, BiFunction{ p1:Int, p2:Int -> p1+p2})
g
have you considered using RxKotlin ? It makes working with the types in operators like
zip
and
combineLatest
much easier: https://github.com/ReactiveX/RxKotlin
r
Thank you for the recommendation, I’ll give it a shot. However, it would still be nice to understand why my example doesn’t work
g
Actually, copy pasting your code into my IDE works and compiles
r
I just realized, I think I have the wrong import for
BiFunction
g
it should be from
io.reactivex.functions
r
Yeah, I had the java one imported. Thanks for the help!
👍 1
a
I've hit that issue so many times. It's brutal.
r
In IDE preferences, you can go to Editor > General > Auto Import, and there's a list of classes you can exclude from auto-import. Very helpful for avoiding this sort of mistake.
☝️ 1
Screen Shot 2019-07-01 at 11.10.00.png
💯 2