|
Singleton result = instance; |
|
if (result == null) { |
|
synchronized (Singleton.class) { |
|
result = instance; |
|
if (result == null) { |
|
instance = result = new Singleton(value); |
|
} |
|
} |
|
} |
|
return instance; |
Why do you prefer this overcomplicated code instead of concise, simple, thread-safe, and lazy enough
private static final Singleton instance = new Singleton();
?