-
-
Save qsLI/b9f6fac431c39322052b to your computer and use it in GitHub Desktop.
Initialization-on-demand holder idiom example
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 { | |
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