Thursday, May 22, 2014

Multiton Pattern (Registry of Singletons) in Java

Simple Note

From reference:
The multiton pattern expands on the singleton concept to manage a map of named instances as key-value pairs.
Rather than having a single instance per application (e.g. the java.lang.Runtime object in the Java programming language) the multiton pattern instead ensures a single instance per key.


Run to test.

Put Vitamin into VitaminBox, there is only one VitaminBox for a kind of Vitamin.


Multiton pattern

No comments:

Post a Comment