Chapter 9. Generic data structures
This chapter covers
- Separating independent concerns
- Using generic data structures for data layout
- Traversing any data structure
- Setting up a data processing pipeline
We’ll start our discussion of generic types by covering a common case in which they should be used: making independent, reusable components. We’ll look at a couple of scenarios in which we would benefit from an identity function (a function that simply returns its argument) and see a generic implementation of such a function. We’ll also review the Optional<T> type we built in chapter 3 as another simple but powerful generic type.
Next, we’ll talk about data structures. Data structures give shape to our data without having to be aware of what ...
Get Programming with Types 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.