There was an error while loading. Please reload this page.
1 parent 47a97fb commit 690b4b8Copy full SHA for 690b4b8
1 file changed
singleton/README.md
@@ -37,6 +37,17 @@ Sequence diagram
37
38

39
40
+## Singleton Implementation Comparison (for eager and lazy initialization)
41
+
42
+| Feature | Eager Initialization | Thread-Safe Lazy Initialization |
43
+|----------|----------|----------|
44
+| Object Creation | During class loading | First call to `getInstance()` |
45
+| Thread Safe | Yes | Yes |
46
+| Synchronization Required | No | Yes |
47
+| Memory Usage | Higher | Lower |
48
+| Performance | Faster access | Slight synchronization overhead |
49
+| Complexity | Simple | Moderate |
50
51
## Programmatic Example of Singleton Pattern in Java
52
53
Joshua Bloch, Effective Java 2nd Edition p.18
0 commit comments