What\'s the easiest and/or shortest way possible to get the names of enum elements as an array of Strings?
What I mean by this is that if, for example,
I did a bit test on @Bohemian's solution. The performance is better when using naive loop instead.
public static > String[] getEnumNames(Class inEnumClass){
T [] values = inEnumClass.getEnumConstants();
int len = values.length;
String[] names = new String[len];
for(int i=0;i> e) {
return Arrays.stream(e.getEnumConstants()).map(Enum::name).toArray(String[]::new);
}