I was thinking about a nice way to convert a List of tuple with duplicate key [(\"a\",\"b\"),(\"c\",\"d\"),(\"a\",\"f\")] into map (\"a\" -> [\"b\", \"
[(\"a\",\"b\"),(\"c\",\"d\"),(\"a\",\"f\")]
(\"a\" -> [\"b\", \"
You can try this
scala> val b = new Array[Int](3) // b: Array[Int] = Array(0, 0, 0) scala> val c = b.map(x => (x -> x * 2)) // c: Array[(Int, Int)] = Array((1,2), (2,4), (3,6)) scala> val d = Map(c : _*) // d: scala.collection.immutable.Map[Int,Int] = Map(1 -> 2, 2 -> 4, 3 -> 6)