Option filter
filter function that will turn any Option into a None if it doesn't satisfy the provided predicate can be implemented in a following way:def filter(f: A => Boolean): Option[A] = this match {
case Some(a) if f(a) => this
case _ => None
}
Login in to like
Login in to comment