December 2017
Intermediate to advanced
322 pages
7h 3m
English
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.
Read now
Unlock full access