Advantages of Java’s enum over the old “Typesafe Enum” pattern?
“cannot be subclassed” isn’t a restriction. It’s one of the big advantages: It ensures there there is always only ever exactly the set of values defined in the enum and no more! enum correctly handles serialization. You can do that with type-safe enums as well, but it’s often forgotten (or simply not known). This ensures … Read more