How can I convert immutable.Map to mutable.Map in Scala? -


how can convert immutable.map mutable.map in scala can update values in map?

the cleanest way use mutable.map varargs factory. unlike ++ approach, uses canbuildfrom mechanism, , has potential more efficient if library code written take advantage of this:

val m = collection.immutable.map(1->"one",2->"two") val n = collection.mutable.map(m.toseq: _*)  

this works because map can viewed sequence of pairs.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -