[Solved] Convert a Map[Int, Array[(Int, Int)]] to Map[Int, Map[Int, Int]] in Scala
It is really simple: yourMap.mapValues(_.toMap) scala> :paste // Entering paste mode (ctrl-D to finish) Map( 0 -> Array((1,1), (2,1)), 1 -> Array((2,1), (3,1), (0,1)), 2 -> Array((4,1), (0,1), (1,1)), 3 -> Array((1,1)), 4 -> Array((5,1), (2,1)), 5 -> Array((4,1)) ) // Exiting paste mode, now interpreting. res0: scala.collection.immutable.Map[Int,Array[(Int, Int)]] = Map(0 -> Array((1,1), (2,1)), 5 … Read more