Singletons, Enums and anonymous inner classes
As you may know, some people are declaring singletons with an Enum of 1 instance, because the JVM guarantees that there will always be a single instance with no concurrency problems to handle... Thus what about an Enum with multiple instances? Can we say something like an Enum is a kind of ordered set of singletons sharing a common interface? Why? public enum EnumPriceType { WITH_TAXES { @Override public float getPrice(float input) { return input*1.20f; } public String getFormattedPrice(float input) { return input*1.20f + " €"; } }, WITHOUT_TAXES { @Override public float getPrice(float input)