-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Closed
Labels
Description
Hi, I have trouble figuring this one out, I even check the extensions library.
My usecase is I have upstream of states which I switchMap into contacts observable. Turns out I need my downstream to always see all states (after the switchmapped observable), i.e. all of upstream, where they might get omitted via switchMap.
concatMap doesnt seem to work, because the contactsObservable never completes.
val statesObservable = Observable.just(A, B, C, D)
statesObservable
.switchMap { state -> contactsObservable
.map { contact -> pairOf(state, contact}
}
.subsrcibe {
// Needs to see every state emitted, for example (A, Contact1), (A, Contact2), B(Contact1), C(Contact1), D(Contact2)
}
Is there a way I can guarantee alteast 1 emission of mapped observable with switchMap? I.e. queue upstream states until atleast 1 contact emit per state.
Or, contactMap takeUntil new upstream value?
Thanks