title: How to split a List[Either[A, B]]
body: <p>I want to split a <code>List[Either[A, B]]</code> in two lists.</p>
  
  <p>Is there a better way ?</p>
  
  <pre><code>def lefts[A, B](eithers : List[Either[A, B]]) : List[A] = eithers.collect { case Left(l) =&gt; l}
  def rights[A, B](eithers : List[Either[A, B]]) : List[B] = eithers.collect { case Right(r) =&gt; r}
  </code></pre>