I want to split a List[Either[A, B]] in two lists.
List[Either[A, B]]
Is there a better way ?
def lefts[A, B](eithers : List[Either[A, B]]) : List[A] = eit
A compact, but not CPU-effictive solution:
val lefts = list.flatMap(_.left.toOption) val rights = list.flatMap(_.right.toOption)