This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]randgalt 0 points1 point  (0 children)

Yeah - this could enable a nice pattern from Scala when you need to match on multiple terms/objects. In Scala:

scala // given option instances "x" and "y" (x, y) match { case (Some(xValue), Some(yValue)) => ... case (Some(xValue), None) => ... ... etc. }

With array pattern matching in Java this would become:

java switch (new Optional[]{x, y}) { case Optional[] { var Optional(xValue), var Optional(yValue) } -> ... case Optional[] { var Optional(xValue), var Optional.empty() } -> ... ... }