Why is Scala Map auto-imported but HashMap isn't? -
if utilize map no need import immutable map
scala> val map=map[string,int]() map: scala.collection.immutable.map[string,int] = map()
but if utilize hashmap, without doing import, gives error.
scala> val a=hashmap[int,int]() <console>:7: error: not found: value hashmap val a=hashmap[int,int]() ^
but doing import scala.collection.immutable.hashmap, works.
i see set , hashset..
i notice 1 thing map , set trait , hashset,hashmap classes.
so why ???
edit
class stack , queue exist in scala.collection package. why need import these classes. ???
program interface, not implementation. scala designers encouraged providing shortcuts interfaces in predef.
scala scala-collections
No comments:
Post a Comment