Switch Expressions Coming to JDK 12

Wednesday Aug 29th 2018 by Developer.com Staff

The new feature could simplify Java coding and pave the way for pattern matching.

Java Development Kit (JDK) 11 hasn't yet reached general availability, but the OpenJDK community is already hard at work on JDK 12. That release, due in March 2019, will feature switch expressions.

According to InfoWorld, "Switch expressions, which will be in beta state in JDK 12, extends the switch statement so it can be used as either a statement or an expression. This would enable both forms to use either 'traditional' or 'simplified' scoping and control flow behavior. These changes would result in simplified 'everyday' coding and prepare the way for use of pattern matching in switch."

View article

Mobile Site | Full Site