Created
January 2, 2019 08:06
-
-
Save bearprada/c2ae51b66f6a55beeb0c9aba8f3ba3ed to your computer and use it in GitHub Desktop.
Test Delay with FlatMap operator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun `test delay`() { | |
Observable.just(listOf(1,2,3,4,5)) | |
.flatMap { nums -> | |
val obs = mutableListOf<Observable<Int>>() | |
for (i in nums) { | |
obs.add(Observable.just(i).delay(i.toLong(), TimeUnit.MILLISECONDS)) | |
} | |
Observable.merge(obs) | |
} | |
.subscribe { println("$it") } | |
Thread.sleep(6000) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected log message should be