Updated 16 April 2018
Coroutine are light-weight threads. A light weight thread means it doesn’t map on native thread, so it doesn’t require context switching on processor, so they are faster. Coroutines is a new way of writing asynchronous, non-blocking code in kotlin.
These are the functions to start the coroutine:
1. launch{}
2. async{}
The difference is that the launch{} does not return anything and the async{} returns an instance of Deferred<T>, which has an await function that returns the result of the coroutine like we have future in Java. and we do future.get() in Java to the get the result.
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.