February 2018
Intermediate to advanced
552 pages
13h 46m
English
Scala Map is a map of key-value pairs. Like other Collections, Scala has the following two sets of maps:
scala.collection.mutable.Map scala.collection.immutable.Map
If a package is not imported or not mentioned in the source code, the Scala compiler uses the default immutable Map:
scala> val numMap = Map("one" -> 1, "two" -> 2, "three" -> 3)
numMap: scala.collection.immutable.Map[String,Int] = Map(one -> 1, two -> 2, three -> 3)
scala> val phoneBook = "Ram" -> 1234567890
phoneBook: (String, Int) = (Ram,1234567890)
Read now
Unlock full access