mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 08:58:49 +00:00
Improved Flyweight example comments.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user