I\'m trying to find a way to iterate through an enum\'s values while using generics. Not sure how to do this or if it is possible.
The following code illustrates
I did it like this
protected List enumToList(Class extends Enum>> e) { Enum>[] enums = e.getEnumConstants(); return Arrays.asList(enums).stream() .map(name -> name.toString()) .collect(Collectors.toList()); }