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.
This book is published in PDF, EPUB, and MOBI/Kindle formats, for use in your favorite digital book reader.
Details
- Published on: 2021-03-07
- 244 pages
- Errata
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
SharedFlow
andStateFlow
- 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