refactoring: issue#2376 (#2491)

Changed all the switch expression according to the JAVA 17.
This commit is contained in:
akshatarora0013
2023-04-01 20:18:38 +05:30
committed by GitHub
parent fc7e672419
commit 9d6ae392b8
23 changed files with 614 additions and 730 deletions
@@ -101,13 +101,10 @@ public class App {
* @return expression
*/
public static Expression getOperatorInstance(String s, Expression left, Expression right) {
switch (s) {
case "+":
return new PlusExpression(left, right);
case "-":
return new MinusExpression(left, right);
default:
return new MultiplyExpression(left, right);
}
return switch (s) {
case "+" -> new PlusExpression(left, right);
case "-" -> new MinusExpression(left, right);
default -> new MultiplyExpression(left, right);
};
}
}