diff --git a/flyweight/README.md b/flyweight/README.md index efb867f70..84821dadd 100644 --- a/flyweight/README.md +++ b/flyweight/README.md @@ -77,21 +77,13 @@ public class PotionFactory { var potion = potions.get(type); if (potion == null) { switch (type) { - case HEALING -> { - potion = new HealingPotion(); - potions.put(type, potion); - } - case HOLY_WATER -> { - potion = new HolyWaterPotion(); - potions.put(type, potion); - } - case INVISIBILITY -> { - potion = new InvisibilityPotion(); - potions.put(type, potion); - } + case HEALING -> potion = new HealingPotion(); + case HOLY_WATER -> potion = new HolyWaterPotion(); + case INVISIBILITY -> potion = new InvisibilityPotion(); default -> { } } + potions.put(type, potion); } return potion; }