The throttle() operators

The buffer() and window() operators gather emissions. The throttle operators omit emissions. We will discuss it in greater detail in the later chapters, but we will take a look at it right now:

    fun main(args: Array<String>) { 
      val flowable = Flowable.interval(100, TimeUnit.MILLISECONDS)//(1) 
      flowable.throttleFirst(200,TimeUnit.MILLISECONDS)//(2) 
        .subscribe { println(it) } 
     
      runBlocking { delay(1,TimeUnit.SECONDS) } 
    } 

This is the output:

The throttleFirst skips the first emissions in every 200 milliseconds.

There are throttleLast and throttleWithTimeout operators as well.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.137.67