17 Flow operators

This chapter covers

  • Operators used to transform and work with flows
  • Intermediate and terminal operators
  • Building custom flow operators

17.1 Manipulating flows with flow operators

In the previous chapter, you got to know flows as the higher-level abstraction that allows you to work with multiple, sequential values over time while leveraging Kotlin’s concurrency machinery. In this chapter, we’ll discuss how to manipulate and transform them. You’ve already seen that Kotlin provides a vast selection of operators you can use to manipulate collections (as discussed in chapters 5 and 6). Likewise, you can use operators to transform flows.

Just like with sequences, you distinguish between the intermediate flow operators and terminal ...

Get Kotlin in Action, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.