I have this combinelatest flowable:
private val subject: BehaviorSubject<Int> = BehaviorSubject.create()
Flowable.combineLatest(
materialA,
materialB,
subject.toFlowable(LATEST),
Function3 { ma, mb, index -> if(index == 0) ... else if(index ==1) ... else ... }
subject.onNext(99)
Basically, i want to observe db changes on both this materials, and combine them to show user some data. On occasion, i need to use the latest output, and do a different combination (computation heavy). Thats why i made the index
a source to the combinelatest
. Is this a valid approach or is there any better alternative?
PS. I need to be able to ask for a different combination any time i want (that's i didnt use Flowable.just()) and i would like to avoid saving state outside of the obs chain.