Created
February 7, 2014 22:21
-
-
Save idefixcert/8873203 to your computer and use it in GitHub Desktop.
Singleton the Highlander way
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 Highlander { | |
private Highlander() { | |
// Singleton | |
} | |
private static class SingletonHolder { | |
public static final Highlander SINGLETONHOLDER = new Highlander(); | |
} | |
public static Highlander getInstance() { | |
return SingletonHolder.SINGLETONHOLDER; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment