I want to take an existing enum and add more elements to it as follows:
enum A {a,b,c}
enum B extends A {d}
/*B is {a,b,c,d}*/
Is this po
Based on @Tom Hawtin - tackline answer we add switch support,
interface Day {
...
T valueOf();
}
public enum Weekday implements Day {
MON, TUE, WED, THU, FRI;
Weekday valueOf(){
return valueOf(name());
}
}
public enum WeekendDay implements Day {
SAT, SUN;
WeekendDay valueOf(){
return valueOf(name());
}
}
Day wds = Weekday.MON;
Day wends = WeekendDay.SUN;
switch(wds.valueOf()){
case MON:
case TUE:
case WED:
case THU:
case FRI:
}
switch(wends.valueOf()){
case SAT:
case SUN:
}