Robert

41%
Flag icon
The Enum specification has this to say about ordinal: “Most programmers will have no use for this method. It is designed for use by general-purpose enum-based data structures such as EnumSet and EnumMap.” Unless you are writing code with this character, you are best off avoiding the ordinal method entirely.
Robert
I think it's worth being more precise: ordinal is unsafe to use if order might ever change, and if the value might every be saved and used between changes (e.g., don't use as the value to save in the database).
Effective Java
Rate this book
Clear rating
Open Preview