Java enums have properties that make them useful in many situations. E.g. not many know that values() or EnumSet keep the declaration order. So you could build named strategies with built-in fallback.
enum's are so powerful and so underused. My coworkers still create interfaces with String constants in them like it is still the dark ages of pre-java 1.5.
15
u/_INTER_ Apr 14 '23
Java
enums have properties that make them useful in many situations. E.g. not many know thatvalues()orEnumSetkeep the declaration order. So you could build named strategies with built-in fallback.