Elements of Kotlin Coroutines
Coroutines are an important addition to the world of Kotlin.
Coroutines offer a first-class reactive programming approach, tightly integrated with the language itself. Coroutines help simplify multi-threaded development, allowing you to retain a “normal” imperative sort of programming model while still designating certain code sections to run on alternative thread pools. Beyond that, flows and channels let you model data streams while retaining the same multi-threaded characteristics.
This book is designed to help you get “spun up” on coroutines and how they can be applied in your projects.
Most of the sample code from the book is available in the Klassbook, so you can try running it in your Web browser. Some Android samples are available via GitLab repositories.
Right now, this book is in a “beta” state, but it covers most of basics of coroutines.
This book is published in PDF, EPUB, and MOBI/Kindle formats, for use in your favorite digital book reader. Or, read directly in your Web browser on the Warescription site, complete with full-text searching.
The Table of Contents
Each bullet shown below represents a chapter. Use the search field in the nav bar to search all of the CommonsWare books to see what they hold!
- Introducing Coroutines
- Introducing Flows and Channels
- Exploring Builders and Scopes
- Choosing a Dispatcher
- Suspending Function Guidelines
- Managing Jobs
- Deferring Results
- Structuring Concurrency
- Working with Flows
- Opting Into
- Tuning Into Channels
- Bridging to Callback APIs
- Selecting Results
- Creating Custom Scopes
- Testing Coroutines
- Integrating with RxJava
- Applying Coroutines to Your UI
- Java Interoperability
- Appendix A: Hands-On Converting RxJava to Coroutines
- New chapter on custom coroutine scopes
- Overhauled chapter on
- Reworked material on channels
- Other updates for coroutines version 1.4.2
- Version 0.3
- Published on: 2021-03-07
- 244 pages