Skip to content

Instantly share code, notes, and snippets.

@leon0399
Last active August 23, 2016 21:23
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 leon0399/1750cc9d25d6a828a4101b88e4992339 to your computer and use it in GitHub Desktop.
Save leon0399/1750cc9d25d6a828a4101b88e4992339 to your computer and use it in GitHub Desktop.
Singleton
public final class Singleton {
private Singleton() {
}
public static Singleton getInstance() {
return SingletonHolder.HOLDER_INSTANCE;
}
private static final class SingletonHolder {
private static final Singleton HOLDER_INSTANCE = new Singleton();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment