given:
val m = Map[String, Int](\"a\" -> 1, \"b\" -> 2, \"c\" -> 3) m.foreach((key: String, value: Int) => println(\">>> key=\" + key + \",
You need to patter-match on the Tuple2 argument to assign variables to its subparts key, value. You can do with very few changes:
Tuple2
key
value
m.foreach{ case (key: String, value: Int) => println(">>> key=" + key + ", value=" + value)}