The combineLatest operator

The combineLatest operator works in a similar way like the zip operator. It accumulates the emissions of the provided producers. The only difference between combineLatest and zip is that the zip operator waits for each of its source producers to emit, before it starts processing all the emissions to create its new one, but the combineLatest operator starts as soon as it receives any emit from any of its source producers.

To understand this operator better, we will see an example with both, the zip and the combineLatest operator. Let's first try the example with the zip operator, as we gained some grip on it already:

    fun main(args: Array<String>) { 
      val observable1 =   Observable.interval(100,TimeUnit.MILLISECONDS)//(1) ...

Get Reactive Programming in Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.