Skip to content

Instantly share code, notes, and snippets.

@infynyxx
Created July 27, 2012 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infynyxx/3186119 to your computer and use it in GitHub Desktop.
Save infynyxx/3186119 to your computer and use it in GitHub Desktop.
immutable class from mutable objects
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