how can this inner enum code be improved ?
Posted
by
mafalda
on Stack Overflow
See other posts from Stack Overflow
or by mafalda
Published on 2011-01-17T23:51:30Z
Indexed on
2011/01/17
23:53 UTC
Read the original article
Hit count: 136
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
© Stack Overflow or respective owner