Skip to content

Instantly share code, notes, and snippets.

@qsLI
Forked from 55v/Init-on-demand holder
Created March 14, 2016 09:06
Show Gist options
  • Save qsLI/b9f6fac431c39322052b to your computer and use it in GitHub Desktop.
Save qsLI/b9f6fac431c39322052b 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