Given a Set[Either[BadObject, GoodObject]], I'd like to convert it into a Set[GoodObject], while logging all the BadObjects.
The problem I am having is that when I try to add logging in a collect call, like:
someMethodThatReurnsTheSet.collect {
case Right(value) => value
case Left(res) => logger.warn(s"Bad object : $res")
}
This changes the return value and I am getting a Set[None], which is not what I want.