I have a generic class with enum type as generic, and I want to iterate through all elements in the enum. Hope the following example (not working) will make more clear what I want. What is the correct syntax?
public class GenericClass<T extends Enum<T>>{
T myEnum;
public void doSomething(){
for(T element : myEnum.values()){// <-- values() not available
....
}
}
}
I would use the class this way
GenericClass<OtherClass.MyEnumType> manager;
manager.doSomething();