Maps in Scala
Maps are Scala’s built-in associative data type (usually called hashes or dicts in other languages).
To create an empty map, use the Map
class constructor:
To run the program, save the code in a file named maps.scala
and use scala
to execute it.
Note that maps appear in the form Map(k -> v, k -> v)
when printed with println
.