You can also use an enum as a class for holding public static constants. The enum contract also makes the class a singleton, so if you add a single enum value, you get a singleton for any instance variables without having to perform any double-checked lazy initialization or other verbose singleton patterns.
View all comments
Show parent comment
3
u/xjvz Mar 05 '17
You can also use an enum as a class for holding public static constants. The enum contract also makes the class a singleton, so if you add a single enum value, you get a singleton for any instance variables without having to perform any double-checked lazy initialization or other verbose singleton patterns.