If we use a card, you do not need to import an immutable card
scala> val map=Map[String,Int]()
map: scala.collection.immutable.Map[String,Int] = Map()
But if we use HashMap, then without import, it gives an error.
scala> val a=HashMap[Int,Int]()
<console>:7: error: not found: value HashMap
val a=HashMap[Int,Int]()
^
but making scala.collection.immutable.HashMap import, it works.
I also see it with Set and Hashset ..
I notice that Map and Set are traits, and HashSet, HashMap are classes.
So why is this so ???
EDIT
The Stack and Queue classes also exist in the scala.collection package. then why do we need to import these classes. ???
Rishi source
share