Skip to content

Instantly share code, notes, and snippets.

@krossovochkin
Created May 15, 2020 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krossovochkin/efbc46a2d3a81e6196fc29892154e0dd to your computer and use it in GitHub Desktop.
Save krossovochkin/efbc46a2d3a81e6196fc29892154e0dd to your computer and use it in GitHub Desktop.
map suspend rxjava
fun hiThere(): Single<Int> {
return Completable.timer(1, TimeUnit.SECONDS)
.andThen(Single.just(40))
.subscribeOn(computation())
}
fun test() {
Observable.just(1)
.flatMapSingle { hiThere() }
.subscribeOn(io())
.subscribe { println(it) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment