scala.collection.Map is the interface for immutable maps while
scala.collection.HashMap is a concrete implementation.
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
HashMap is known as HashMap because it uses a technique called Hashing. Hashing is a technique of converting a large String to small String that represents same String. A shorter value helps in indexing and faster searches.
Some points on HashMap:
Internal Structure of HashMap
Internally HashMap contains an array of Node and a node is represented as a class which contains 4 fields :
HashMap is preferrably used where you want the key values to be unque while storing information.
Hope this helps.