Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
4.0.0
Description
refer to JEP 361
Example:
double getPrice(String fruit) { switch (fruit) { case "Apple": return 1.0; case "Orange": return 1.5; case "Mango": return 2.0; default: throw new IllegalArgumentException(); } }
Can be changed to
double getPrice(String fruit) { return switch (fruit) { case "Apple" -> 1.0; case "Orange" -> 1.5; case "Mango" -> 2.0; default -> throw new IllegalArgumentException(); }; }