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.21
TRX 0.20
JST 0.034
BTC 90913.25
ETH 3176.54
USDT 1.00
SBD 2.97