I'm trying to combine multiple observables into one with the following code:
val observables: Array<Observable<out MyItem>> = arrayOf(
obs0,
obs1
obs2,
obs3,
obs4.flatMap { Observable.fromIterable(it) },
obs5,
obs6,
obs7,
obs8,
obs9,
obs10
)
Observable.combineLatestDelayError(observables) { items ->
items.filterIsInstance<MyItem>()
.filter { ... }
.map { ... }
}
All of them has a type of Observable<MyItem>
, except obs4
is Observable<List<MyItem>>
, so I want to unpack it in the result list with .flatMap { Observable.fromIterable(it) }
. The problem here is if obs4
emits an empty list then the resulting chain never emits, because combineLatest
waits for all sources to emit first item.
Is there any operator that would emit on every change of every source ignoring empty sources?