Download directly

In this mini Fragment, we introduce Joshua’s third Item: Enforce the Singleton property with a private constructor or an enum type.

Stay tuned for more items from our “Effective Java for Android developers” Fragment series.

Show Notes: ##

Enforce the Singleton property with a private constructor or an enum type

Approaches ####

  1. Create a public static final INSTANCE variable and privatize constructor
  2. Same as 1 but privatize variable and expose access with provide factory method getInstance
  3. Single element Enums

Considerations ####

Supplemental reading (for the diligent ones that follow shownotes) ####

Contact us: ##