Coroutines for Java Developers
Java Day Istanbul
16 March 2019, talk
Did you know that coroutines were invented about 50 years ago? A coroutine is a function that can not only return but also suspend its execution somewhere in the middle, it can be later resumed to continue the execution.Imagine, in Java or JVM, a function that can suspend its execution and free the call stack. Does it give power? It does! It simplifies the callback hell of your non-blocking application. A for-loop is now enough to implement an iterator, that lazily computes the elements. In Kotlin, “suspend” functions can suspend and are called coroutines. And it is the power. We’ll use it as the remedy for the callback hell problem of our non-blocking applications. Of course, we’ll build an iterator with for-loop and yield-return. Coroutines help to offload the work from a UI thread of a desktop or Android applications easily. The main giveaway is you’ll learn how to use Kotlin suspend functions and coroutines to simplify your daily tasks.
Feedback:
12
References:
Need a speaker? Eugene is happy to speak at your event, training, or workshop. Reach him via twitter or email “me” at jonnyzzz.com.
comments powered by Disqus