RosettaCodeData/Task/Hash-from-two-arrays/Scala/hash-from-two-arrays.scala
Ingy döt Net 776bba907c Sync
2013-10-27 22:24:23 +00:00

7 lines
259 B
Scala

val keys = List(1, 2, 3)
val values = Array("A", "B", "C") // Array mixed with List
val map = keys.zip(values).toMap // and other Seq are possible.
// Testing
assert(map == Map(1 ->"A", 2 -> "B", 3 -> "C"))
println("Successfully completed without errors.")