Is there a difference between a Scala Map
and a HashMap
? I am using the scala.collection.immutable.HashMap
.
scala.collection.immutable.Map
is the interface for immutable maps while scala.collection.immutable.HashMap
is a concrete implementation.
Creating with Map()
or Map.empty
gives a special empty singleton map, with Map(a -> b)
with up to 4 pairs yields specialized classes for such small maps, and 5 and upwards gives you scala.collection.immutable.HashMap