Pattern matching in Scala lets you quickly identify what you are looking for in a data, and also extract it.
Pattern matching is used by methods like Collect, but can also be easily integrated into normal functions.
Pattern matches are effectively "Partial Functions", of type
PartialFunction[Input, Output] which is isomorphic to
Input => Option[Output]. See Option Type.