This repository demonstrates all main patterns which can be used to create singletons in Java. A more detailed explanation can be found at http://blog.dulaj.info/2017/07/java-singletons-using-enum-type-best.html.
- Singleton with public static final field
- Singleton with static factory method
- Singleton with lazy initialization and fine grained synchronization
- Singleton with enum
- Serialize and Deserialize problem
- Problem with private constructor when using reflection
All the source code has been licensed under MIT License and free to use for any kind of work.