Skip to content

This class provides singleton class implementation which provides single instance of class.

Notifications You must be signed in to change notification settings

ladrahul25/Singleton-Design-Pattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Singleton-Design-Pattern

This class provides singleton class implementation which provides single instance of class.

Features of this class :-

  1. Single instance class
  2. Globally accessible object reference
  3. Thread safe
  4. Reflection safe

Requirements :-

  1. Private constructor.
  2. A static reference of its class.
  3. Single entry point static method.
  4. Thread safety measurement.
  5. Reflection safety measurements.

Note: I have purposely shown singleton example in java language, because in kotlin creating a singleton class is very easy.

object SingletonDemo.

Thats it!! Yes object keyword provides singleton implementation.

About

This class provides singleton class implementation which provides single instance of class.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages