Created
May 7, 2014 04:49
-
-
Save amano41/eda80acfe68a9f807e7a to your computer and use it in GitHub Desktop.
Singleton 遅延初期化ホルダー イディオム
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 Singleton { | |
private Singleton(){} | |
public static Singleton getInstance() { | |
return SingletonHolder.instance; | |
} | |
private static class SingletonHolder { | |
static final Singleton instance = new Singleton(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment