Hey guys, I’m using `Observables.combineLatest` fr...
# rx
n
Hey guys, I’m using
Observables.combineLatest
from the
io.reactivex.rxkotlin
project (on Android) and found something strange while doing some Unit testing. At least I think it’s strange.
combineLatest
wasn’t (isn’t) emitting for each update to the first observable parameter, only for the second. I started removing the parameters and replacing them with
just's
and found the following:
Observables.combineLatest(Observable.just(true, false , false, false), Observable.just(false, true)).map{ it.first || it.second}
Emit’s [false, true] Expected [true, false, false, false, false, true] .. or at least 6 emissions The strange part is that if I reverse them, I get the opposite:
Observables.combineLatest(Observable.just(false, true), Observable.just(true, false , false, false)).map{ it.first || it.second}
Emit’s [true, false, false, false] Expected [false, true, true, false, false, false] .. or again, at least 6 emissions What am I missing? A race condition? Or a lack of one, because it’s all running on a single thread?