Kotlin Coroutines Sample

in #kotlin8 years ago

Kotlin 1.1 comes with a new feature called Coroutines.

Quoting the official Kotlin blog:

Honestly, it’s hard to over-emphasize coroutines. The future has come, and we are stuck with it: we need non-blocking asynchronous APIs to keep up with the loads of data we are processing. We’ve been through callback hell and conquered it, but we deserve better. We want to simply write the code following its natural sequential logic, and let the compiler figure the asynchrony out for us. This is what coroutines are about: async/await, generate/yield, non-blocking IO, Rx and much more brought under the single unified paradigm of a suspending function. Such a function (or lambda) represents a computation that can be suspended (without blocking any threads) and resumed later.

For a better blocking, asynchronous and non-blocking APIs understanding I have created a github repository ( github.com/aleixmorgadas/kotlin-coroutines-sample ) with sample code. The project aims to show you how each type of API call is executed.

Have a nice coding day!

Sort:  

Congratulations @aleixmorgadas! You have received a personal award!

Happy Birthday - 1 Year
Click on the badge to view your own Board of Honor on SteemitBoard.

For more information about this award, click here

By upvoting this notification, you can help all Steemit users. Learn how here!

Coin Marketplace

STEEM 0.15
TRX 0.12
JST 0.025
BTC 55326.60
ETH 2348.86
USDT 1.00
SBD 2.32