combineLatest

fun <T, O> List<Observable<T>>.combineLatest(collector: (List<T>) -> O): Observable<Option<O>>

Collects the latest values emitted by a list of Observables and transforms them into a new Observable using the provided collector function.

This is the combineLatest operator of the ReactiveX convention, also known as combine in Kotlin flows. Since observables always have a current value, the result does not wait for every source to emit before producing a value; an empty list of sources yields arrow.core.None.

Return

a Observable of type O, which emits the transformed result whenever the state of the source Observables changes.

Parameters

collector

a function that takes a list of the latest values from the source Observables and transforms them into a result of type O, which will be emitted by the resulting Observable.

Type Parameters

T

the type of the values emitted by the source Observables.

O

the type of the combined and transformed result emitted by the resulting Observable.