I have enumeration like this:
public enum Configuration { XML(1), XSLT(10), TXT(100), HTML(2), DB(20); private final int id; pri
Another approach is to use a constant initialized on top of the values() method.
public enum Colors { BLUE, GREEN, FUCHSIA; public static int length = Colors.values().length; }
This way you have an automatically updated constant and still avoid that "values()" overhead.