I have a nested map which i want to manipulate.
My data type is of the following:
nestedMap :SortedMap[Long, SortedMap[String, Double]]
I have an instance of nestedMap.
I want to create a List / SortedMap of the String (i.e. the key of the inner SortedMap).
For example:
val nestedMap: SortedMap[Long, SortedMap[String, Double]] = (1000L -> ("component1" -> 1.), 2000L -> ("component1" -> 1.1), 3000L -> ("component1" -> 0.95, "component2" -> 1.))
I want to create the following list:
component = List("component1", "component2")
The number of components could be a couple of dozen elements, however the number of Long and Double elements could be thousands.
What is the most efficient way of doing this?
Thanks