Flailing around here, seems simple.
Have a Seq[Tuple2[A,B]], call it foo, and I’d like to extract the Tuple2 into a (Seq[A],Seq[B]) that I can do a one stop shop multi-assignment on.
val(a,b) = foo ??
Tried map, flatmap and other variations of fail.
Shed the light if you will 😉
Try
unzip.The docs specify it as
So you can just say
val (a, b) = foo.unzipTo go the other way (from
x: Seq[A]andy: Seq[B]toz: Seq[(A,B)]), you can useval z = x.zip(y).