Advertisement
Guest User

Untitled

a guest
Apr 15th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. doOneThing() { callbackResult ->
  2. doAnotherThing(callbackResult) { anotherCallbackResult ->
  3. doThirdThing(anotherCallbackResult) { totalResult ->
  4. showResultToUser(totalResult)
  5. }
  6.  
  7. }
  8. }
  9.  
  10.  
  11.  
  12. val result = doOneThing().await()
  13. val secondResult = doAnotherThing(result).await()
  14. val totalResult = doThirdThing(secondResult).await()
  15. showResultToUser(totalResult)
  16.  
  17.  
  18.  
  19. Single.fromCallable(doOneThing())
  20. .flatMap(::doAnotherThing)
  21. .flatMap(::doThirdThing)
  22. .subscribe(::showResultToUser)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement