Pat Farrell
,
Rancher
Don't use a singleton class. Singletons are evil.
They can be thread safe if you make the data in them immutable.
Alexey Dubinin
,
Greenhorn
The simplest way is to use enum:
But remember that methods of this class should be thread safe.
Stephan van Hulst
,
Saloon Keeper
staff
Singletons or enums aare no different from other classes when it comes to thread-safety.
Either synchronize them properly, or even better, make them immutable.