Divide a pair of pairs into two lists?

Suppose I have Seqeither pairs (or tuples):

val s = Seq((1, "1"), (2, "2"), (3, "3"))

How can i do:

val (ints, strs) = (s.map(_._1), s.map(_._2))

Without repeating Seq twice?

+4
source share
1 answer

Here

val (ints, strs) = seq.unzip
+11
source

All Articles