Pregunta

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")
¿Fue útil?

Solución

You are probably looking for

mp.values.toList
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top