by
0
1
115
15
Specified
Popularity: 1227332nd place
Created
Modified May 16, 2017
This snippet is Public
No tags for this snippet yet.
Languagejava
LicenseMIT_X11

lazy singleton

Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/1808172/lazy-singleton?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
public final class Singleton { private static volatile Singleton INSTANCE = null; private Singleton() {// singleton instance} /** * @return the single instance of the class */ public static Singleton getInstance() { if (INSTANCE == null) { synchronized(Singleton.class) { if (INSTANCE == null) { INSTANCE = new Singleton(); } } } return INSTANCE; } }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus