Skip to content

Instantly share code, notes, and snippets.

@oznus
Created February 15, 2016 00:33
Show Gist options
  • Save oznus/479db5417ec737dab6cc to your computer and use it in GitHub Desktop.
Save oznus/479db5417ec737dab6cc to your computer and use it in GitHub Desktop.
public class LazySingleton {
private LazySingleton() {
}
private static LazySingleton sInstance;
public static LazySingleton INSTANCE() {
synchronized (LazySingleton.class) {
if (sInstance == null) {
sInstance = new LazySingleton();
}
}
return sInstance;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment