Skip to content

Instantly share code, notes, and snippets.

@55v
Created February 11, 2012 16:28
Show Gist options
  • Save 55v/1801793 to your computer and use it in GitHub Desktop.
Save 55v/1801793 to your computer and use it in GitHub Desktop.
Initialization-on-demand holder idiom example
public class Something {
private Something() {
}
private static class LazyHolder {
public static final Something INSTANCE = new Something();
}
public static Something getInstance() {
return LazyHolder.INSTANCE;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment