Created
August 22, 2012 01:45
-
-
Save SeonghoonKim/3421336 to your computer and use it in GitHub Desktop.
Initialize-on-demand holder class idiom - Wikipedia
This file contains 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 Something { | |
private Something() { | |
} | |
private static class LazyHolder { | |
private 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