Created
February 15, 2016 00:34
-
-
Save oznus/6205044bedf2c8edda6f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LazySingleton { | |
private LazySingleton() { | |
} | |
private static LazySingleton sInstance; | |
public static LazySingleton INSTANCE() { | |
if (sInstance == null) { | |
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