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
@@ -44,23 +44,13 @@ public class PotionFactory {
var potion = potions.get(type);
if (potion == null) {
switch (type) {
case HEALING:
potion = new HealingPotion();
break;
case HOLY_WATER:
potion = new HolyWaterPotion();
break;
case INVISIBILITY:
potion = new InvisibilityPotion();
break;
case POISON:
potion = new PoisonPotion();
break;
case STRENGTH:
potion = new StrengthPotion();
break;
default:
break;
case HEALING -> potion = new HealingPotion();
case HOLY_WATER -> potion = new HolyWaterPotion();
case INVISIBILITY -> potion = new InvisibilityPotion();
case POISON -> potion = new PoisonPotion();
case STRENGTH -> potion = new StrengthPotion();
default -> {
}
}
if (potion != null) {
potions.put(type, potion);