Chapter 4. Having fun with functional data structures

This chapter covers

  • Introducing type parameterization with covariance and contravariance
  • Having fun with higher-order functions
  • Creating your own function objects in Scala
  • Introducing the Scala collection hierarchy and parallel collections

In this chapter you’ll switch gears to begin a fun and interesting part of the Scala language: Scala collections which broadly support two categories of data structures—immutable and mutable.

To understand and benefit from Scala collections, you need to know two concepts: type parameterization and higher-order functions. Type parameterization allows you to create types that take another type as a parameter (similar to Java generics). Higher-order ...

Get Scala in Action now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.