Scala: Pattern matching when one of two items meets some condition
I'm often writing code that compares two objects and produces a value based on whether they are the same, or different, based on how they are different. So I might write: val result = (v1,v2) match { case (Some(value1), Some(value2)) => "a" case (Some(value), None)) => "b" case (None, Some(value)) => "b" case _ = > "c" } Thos...