July 2018
Intermediate to advanced
242 pages
8h 6m
English
suspend fun getResults(): List<Result> = suspendCoroutine { continuation: Continuation<List<Result>> -> getResultsAsync { continuation.resume(it) } }
val asyncResults = async { getResults()}
val asyncResults = async { getResults()}println("getResults() is running in bacground. Main thread is not blocked.")asyncResults.await().map { println(it.displayName) }println("getResults() completed")
Read now
Unlock full access