I am currently using scala 2.9.1.
I create a mutable.HashMap using :
> val m = mutable.HashMap.empty[Int, Int]
I am kind of new to scala. In java, I was able to specify the capacity and load factor in the constructor of a HashMap. I am not able to find any way to do the same in scala.
Thanks in Advance
According to the API, this does not seem to be possible. One explanation is that mutable collections are strongly discouraged, and immutable collections don’t need the default capacity information since the number of items must be known at the time of construction.
However, note that Scala will implicitly use default capacity information if you construct a collection (including mutable and immutable
HashMap) via the many available collection methods. For example, if you callmapon aHashMap, it will usemapdefined onTraversableLike(reproduced below), and you can see that it provides a “size hint” to the builder that provides that capacity information.