Is there a way to write a generic loop to iterate over an arbitrary Enum? For example:
public static void putItemsInListBox(Enum enum, ListBox listbox){
for(Enum e : enum.values(){
listBox.addItem(e.toString(), String.valueOf(e.ordinal());
}
}
You can not do the above, because the Enum class does not have a method called values() like the implemented Enum classes. The above for loop works fine for a class that is defined as an enum.