Glossary: Java Beyond the Basics
Pattern matching
Also written: type pattern, record pattern, pattern-matching switch
A type pattern (case Card c) tests an object's type and gives it to you as that type; a record pattern (case GiftCard(String code, int cents)) also takes the record apart into its fields.