What\'s the easiest and/or shortest way possible to get the names of enum elements as an array of Strings?
String
What I mean by this is that if, for example,
Very similar to the accepted answer, but since I learnt about EnumSet, I can't help but use it everywhere. So for a tiny bit more succinct (Java8) answer:
public static String[] getNames(Class extends Enum>> e) { return EnumSet.allOf(e).stream().map(Enum::name).toArray(String[]::new); }