Eugene is a software developer, Ph.D., speaker, and blogger. He is working at JetBrains on the Developer Advocacy team and contributing to open source. His passion includes software architecture, server-side, clouds, AWS, production, programming languages. Eugene speaks and works with Java, Kotlin, Go, C/C++, Qt, .NET, Web. He started using Kotlin before trait was renamed to interface. Eugene has been a Kotlin fan fun for years and completed his first production Kotlin code back in 2013.
Coroutines for Java Developers
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