1 /*
<lambda>null2 * Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3 */
4
5 // This file was automatically generated from coroutines-guide-reactive.md by Knit tool. Do not edit.
6 package kotlinx.coroutines.rx2.guide.context01
7
8 import io.reactivex.*
9 import io.reactivex.functions.BiFunction
10 import io.reactivex.schedulers.Schedulers
11 import java.util.concurrent.TimeUnit
12
13 fun rangeWithIntervalRx(scheduler: Scheduler, time: Long, start: Int, count: Int): Flowable<Int> =
14 Flowable.zip(
15 Flowable.range(start, count),
16 Flowable.interval(time, TimeUnit.MILLISECONDS, scheduler),
17 BiFunction { x, _ -> x })
18
mainnull19 fun main() {
20 rangeWithIntervalRx(Schedulers.computation(), 100, 1, 3)
21 .subscribe { println("$it on thread ${Thread.currentThread().name}") }
22 Thread.sleep(1000)
23 }
24