elizarov
04/19/2017, 10:03 AMpromise.then {
it.doSomething()
}
with
launch {
promise.await().doSomething()
}
This is quite a liberal example hand-crafted so that both direct usage of promise and coroutines somewhat match in readability. Coroutine benefits accrue with complex processing pipelines (do something async, then something else async, handle exceptions of multiple async actions in one place, etc).adeln
04/19/2017, 10:24 AMsuspend
, it becomes much cleaner 🙂elizarov
04/19/2017, 11:08 AMelizarov
04/19/2017, 12:11 PMadeln
04/19/2017, 12:15 PM