How do I sort enum members alphabetically in Java?
I have an enum class like the following: public enum Letter { OMEGA_LETTER("Omega"), GAMMA_LETTER("Gamma"), BETA_LETTER("Beta"), ALPHA_LETTER("Alpha"), private final String description; Letter() { description = toString(); } Letter(String description) { this.description = description; } public String getDescription() { return description; } } Later down my code I basically iterate over the Letter enum and print its members out to the console: for (Letter letter : Letter.values()) { System.out.println(letter.getDescription()); } I thought that the values() method would give me an ordered view