Last active
April 25, 2020 16:36
-
-
Save douglasiacovelli/fb3525bd00d3d03f4961ba817132b539 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Observable.just("Will") | |
.observeOn(Schedulers.io()) | |
.flatMap({ name -> | |
updateUserName.execute(name) //returns another Observable<ApiResult> after calling the API | |
}, { | |
//this is executed after resolving the last observable emitted, so the result is ready. | |
name: String, apiResult: ApiResult -> Pair(name, apiResult) | |
}) | |
.subscribe({ result -> | |
result.first //name | |
result.second //apiResult | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment