I generate list of Either[A,B]
and use partition
to obtain 2 collections of A
and B
so:
val (bad, good) = l.partition(_.isLeft)
val b = bad.map(_.left.getOrElse(Error("Error.check failed getting error")))
val g = good.map(_.right.get)
but both right
and get
are deprecated as shown in the ScalaDocs below:
right: RightProjection[A, B]
Projects this Either as a Right.
Because Either is right-biased, this method is not normally needed.
So how am I supposed to extract the types within?
TIA.