There are many implementations for a singleton in java.
Here is a full article of different ways and the advantages or disadvantages of each.
http://www.javaworld.com/article/2073352/core-java/simply-singleton.html
What surprised me is that the best solution is not in that blog.
The best solution seems to be using enum:
http://javarevisited.blogspot.co.il/2012/07/why-enum-singleton-are-better-in-java.html
No comments:
Post a Comment