Created
December 4, 2018 14:21
-
-
Save smhdk/346bc7690dfbb78ce8ef0970d2f278eb to your computer and use it in GitHub Desktop.
RxJava Concat 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.concat(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