How can I transform a list of tuples List[(A,B)] to a tuple of lists (List[A], List[B])?
I have tried for following but it looks crude and I was hoping there was a better way of doing this
val flat: List[AnyRef] = aAndB.map{ x =>
x.map(y => List(y._1, y._2))
}.flatMap(x => x)
val typeA: List[A] = flat.filter {
case x: A => true
case _ => false
}.map(_.asInstanceOf[A])
val typeB: List[B] = flat.filter {
case x: B => true
case _ => false
}.map(_.asInstanceOf[B])