当前位置: 动力学知识库 > 问答 > 编程问答 >

Converting a Map to a List in Scala without map keys?

问题描述:

How can I convert a map to a list without the map keys being involved in the list in scala?

val mp = collection.mutable.Map[Long, String]()

mp(0) = "val0"

mp(1) = "val1"

mp(2) = "val2"

mp.toList //I want: List("val0", "val1", "val2")

网友答案:

You are probably looking for

mp.values.toList
分享给朋友:
您可能感兴趣的文章:
随机阅读: