Improved Flyweight example comments.

This commit is contained in:
Ilkka Seppala
2014-12-26 10:09:53 +02:00
parent 57cef65eb4
commit 74b43303e3
6 changed files with 19 additions and 9 deletions
@@ -4,7 +4,10 @@ import java.util.EnumMap;
/**
*
* Flyweight.
* PotionFactory is the Flyweight in this example.
* It minimizes memory use by sharing object instances.
* It holds a map of potion instances and new potions
* are created only when none of the type already exists.
*
*/
public class PotionFactory {
@@ -45,5 +48,4 @@ public class PotionFactory {
}
return potion;
}
}