Search⌘ K
AI Features

Exploring Concurrent Data Structures

Learn to understand and use Kotlin's key concurrent data structures including sequences, channels, and flows. This lesson explains the difference between eager collections and lazy sequences, demonstrating how Kotlin manages infinite collections and performs efficient data transformations. Gain foundational knowledge to control data flow using reactive principles and functional programming concepts.

We'll cover the following...

The two most essential concurrent data structures are channels and flows. However, before we can discuss them, we need to look at another data structure: sequences. While this data structure is not concurrent itself, it will provide us with a bridge into the concurrent world.

Sequences

Higher-order functions on collections existed in many functional programming languages for a long time. But for Java developers, the higher-order functions for collections first appeared in Java 8 with the introduction of the Stream API.

Despite providing developers with valuable functions such as map() and filter(), there were two major drawbacks to the Stream API. First, in order to use these functions, we had to migrate to Java 8. And second, our collection had to be ...