This is an excerpt from the Scala Cookbook (partially modified for the internet). This is one of the shortest recipes, Recipe 11.21, “How to Test for the Existence of a Key or Value in a Scala Map”
You want to test whether a Scala
Map contains a given key or value.
To test for the existence of a key in a
Map, use the