4 ms·
Java enums also have functions. If they didn't we would need to write separate helper classes. Can you give a reason why we should not have them?
by TacoSteemers 5y ago
Java enums also have functions.
If they didn't we would need to write separate helper classes.
Can you give a reason why we should not have them?
- kaba0 5y agoJava enums are essentially an in-built singleton pattern where only the given entries can exist. They are not necessarily analogous with sum types, even though rust sort of washes the two together.