Added comments about object sharing in Flyweight example + some minor
fixes.
This commit is contained in:
@ -11,8 +11,8 @@ import java.util.List;
|
||||
*/
|
||||
public class AlchemistShop {
|
||||
|
||||
List<Potion> topShelf;
|
||||
List<Potion> bottomShelf;
|
||||
private List<Potion> topShelf;
|
||||
private List<Potion> bottomShelf;
|
||||
|
||||
public AlchemistShop() {
|
||||
topShelf = new ArrayList<>();
|
||||
|
@ -10,6 +10,9 @@ package com.iluwatar.flyweight;
|
||||
* the Flyweight in this example). Internally PotionFactory holds a map
|
||||
* of the potions and lazily creates new ones when requested.
|
||||
*
|
||||
* To enable safe sharing, between clients and threads, Flyweight objects must
|
||||
* be immutable. Flyweight objects are by definition value objects.
|
||||
*
|
||||
*/
|
||||
public class App {
|
||||
|
||||
|
Reference in New Issue
Block a user