Created
July 27, 2012 04:02
-
-
Save infynyxx/3186119 to your computer and use it in GitHub Desktop.
immutable class from mutable objects
This file contains hidden or 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
public final class ThreeStooges { | |
private final Set<String> stooges = new HashSet<String>(); | |
public ThreeStooges() { | |
stooges.add("Moe"); | |
stooges.add("Larry"); | |
stooges.add("Curly"); | |
} | |
public boolean isStooge(String name) { | |
return stooges.contains(name); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment