The amazing switch transformation from switch statement to switch expression in java from java 5 to 15
Java 14 adds a new form of switch label “case L ->” which allows multiple constants per case and returns a value for the whole switch-case block so it can be used in expressions (switch expressions). And the yield keyword is used to return value from a switch expression.
Now we can use switch statement as switch expression or switch statement.
#JavaBeam #JavaSwitchTransformation #SwitchExpressionInJava14 #SwitchExpressionVsSwitchStatement #Java