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
Post a Comment