how can this inner enum code be improved ?
- by mafalda
I have this construct
public class Constants{
enum SystemA implements Marker{
ConstOne(1), ConstTwo(2), ConstThree(3);
SystemA(int i)
{
number =i;
}
int number;
}
enum SystemB implements Marker{
ConstFour(4), ConstFive(5), ConstSix(6);
SystemB(int i)
{
number =i;
}
int number;
}
}
I have Marker so I can pass to method like this
method(Constants.SystemA) or method(Constants.SystemB)
What is the best way to list all the enum values ?
I also want to make sure that it is not duplicating the number in any of the enums