docs: #2546 Remove code repetition from flyweight README (#2926)

This commit is contained in:
Samuel Souza
2024-05-21 02:53:50 -03:00
committed by GitHub
parent 547cf20140
commit 3b2098b80d
+4 -12
View File
@@ -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;
}