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?
Here it is
val (ints, strs) = seq.unzip
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With