Assume I have a Seq or pairs(or tuples):
val s = Seq((1, "1"), (2, "2"), (3, "3"))
How could I do:
val (ints, strs) = (s.map(_._1), s.map(_._2))
Without iterating the Seq twice?
Assume I have a Seq or pairs(or tuples):
val s = Seq((1, "1"), (2, "2"), (3, "3"))
How could I do:
val (ints, strs) = (s.map(_._1), s.map(_._2))
Without iterating the Seq twice?