I have a scala.List[(String, Double)] of tuple
I want to iterate it and refer to the value into my tuple with meaningful variable name, and not with _tuple.1 or _tuple.2
Currently, I was only able to write and compile with this syntax:
events.foreach( event => {
val (key, value) = event;
_println("key = " + key + ", value = " + value) _
}
)
But I would like to write it in a more compacted way , like this:
events.foreach( (key, value) => println("key = " + key + ", value = " + value) )
What do I miss? Is it possible?