Jean-Michel Fayard
Jul 20, 2017 · 1 min read

Nice! RxKotlin use a variant of that strategy to achieve the same goal

Observable.from(1,2,3)
.subscribeBy( // named arguments for lambda Subscribers
onNext = { println(it) },
onError = { it.printStackTrace() },
onComplete = { println("Done!") }
)

Implementation here

https://github.com/ReactiveX/RxKotlin/blob/53da6557012a5b1ace980fe3c6b5e54c0789e3b7/src/main/kotlin/io/reactivex/rxkotlin/subscribers.kt#L7-L18

https://github.com/ReactiveX/RxKotlin/blob/53da6557012a5b1ace980fe3c6b5e54c0789e3b7/src/main/kotlin/io/reactivex/rxkotlin/subscribers.kt#L7-L18

)

    Jean-Michel Fayard

    Written by

    “Weeks of programming can save hours of planning.”

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade