Controlling the Data Flow
Having discussed coroutines in the previous chapter, we will now broaden our exploration to include features that enhance communication and data handling across different coroutines. This chapter focuses on further important aspects of Kotlin’s concurrency toolkit, namely channels and flows. We will also look into higher-order functions for collections, noting their APIs’ similarity to those of channels and flows.
Building on the foundation laid by our discussion of functional programming, this chapter will emphasize the use of small, reusable, and composable functions. These functions enable us to write expressive code that clearly outlines what we want to achieve, rather than focusing on the steps needed to accomplish it.
In this chapter, the topics we’ll cover are:
- Reactive principles
- Higher-order functions for collections
- Exploring concurrent data structures
- Sequences
- Channels
- Flows...