scala immutable.Map 和 mutable.Map 相互转化

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

immutable.Map to mutable.Map

val m = collection.immutable.Map(1->"one",2->"Two")
val n = collection.mutable.Map(m.toSeq: _*) 

mutable.Map to immutable.Map

val m = collection.mutable.Map(1->"one",2->"Two")
val n = m.toMap

 

转载于:https://my.oschina.net/u/2000675/blog/1818699

你可能感兴趣的:(scala,python,java)