Chapter 14. Pattern Matching and Case Classes

Topics in This Chapter image

14.1 A Better Switch — page 184

14.2 Guards — page 185

14.3 Variables in Patterns — page 185

14.4 Type Patterns — page 186

14.5 Matching Arrays, Lists, and Tuples — page 187

14.6 Extractors — page 188

14.7 Patterns in Variable Declarations — page 188

14.8 Patterns in for Expressions — page 189

14.9 Case Classes — page 189

14.10 The copy Method and Named Parameters — page 190

14.11 Infix Notation in case Clauses — page 191

14.12 Matching Nested Structures — page 192

14.13 Are Case Classes Evil? — page 192

14.14 Sealed Classes — page 193

14.15 Simulating ...

Get Scala for the Impatient 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.