Class | Description |
---|---|
Singleton1 |
Singleton1 is an implementation of a class that only allows one
instantiation.
It has a simple state of a single integer variable Singleton1.data .Tested by TestSingleton1 |
Singleton2 |
Singleton2 is an implementation of a class that only allows one
instantiation.
It has a simple state of a single integer variable Singleton2.data .Tested by TestSingleton2 |
Singleton3 |
Singleton3 is an implementation of a class that only allows one
instantiation.
It has a simple state of a single integer variable Singleton3.data .Tested by TestSingleton3 |
Singleton4 |
Singleton4 is an implementation of a class that only allows one
instantiation.
It has a simple state of a single integer variable Singleton4.data .Follows Java specific design proposed by Bill Pugh from Concurrent programming in Java: design principles and patterns Tested by TestSingleton4 |
Singleton4.SingletonHolder |
SingletonHolder is loaded on the first execution of
Singleton4.getInstance() or the first access to SingletonHolder.INSTANCE,
not before.
|