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 an early “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
- Tuning Into Channels
- Bridging to Callback APIs
- Creating Custom Scopes
- Testing Coroutines
- Applying Coroutines to Your UI
- Tying Scopes to Components
- Using Coroutines with the Jetpack
- Java Interoperability
- Appendix A: Hands-On Converting RxJava to Coroutines
- Brand-new book!
- Version 0.1
- 170 pages