I have a list of pairs:
val pairs = List("a" -> 1, "b" -> 2, "c" -> 3)
I'd like to convert it to a pair of lists:
List("a", "b", "c") -> List(1, 2, 3)
Basically, I want the opposite of zip()
Any elegant way of doing so?
The opposite of zip? What might that be? unzip
maybe?
scala> List("a" -> 1, "b" -> 2, "c" -> 3).unzip
res0: (List[java.lang.String], List[Int]) = (List(a, b, c),List(1, 2, 3))
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