Created
April 7, 2015 15:35
-
-
Save danielrobertson/5cb9f8cb14500ac88360 to your computer and use it in GitHub Desktop.
Multiton
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Multiton { | |
static HashMap<String, Multiton> map = new HashMap<String, Multiton>(); | |
private Multiton(String key) { ... } | |
static Multiton newMultion(String key) { | |
result = map.get(key); | |
if(result == null) { | |
result = new Multiton(key); | |
map.add(key, result); | |
} | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment