Created
December 4, 2018 14:12
-
-
Save smhdk/9d4760dd3365d4039174d7339ba45cb4 to your computer and use it in GitHub Desktop.
RxJava Merge Operator Example with Kotlin
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
val alphabets1 = Observable.intervalRange(0, 3, 1, 1, TimeUnit.SECONDS).map { id -> "A" + id } | |
val alphabets2 = Observable.intervalRange(0, 3, 2, 1, TimeUnit.SECONDS).map { id -> "B" + id } | |
Observable.merge(alphabets1, alphabets2) | |
.subscribe(object : Observer<String> { | |
override fun onComplete() { | |
println("onComplete") | |
} | |
override fun onSubscribe(d: Disposable) { | |
println("onSubscribe") | |
} | |
override fun onNext(t: String) { | |
println("onNext: $t") | |
} | |
override fun onError(e: Throwable) { | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment