How feasible is to do something like this? Consider Enum* a enum Enum* { /* ... */ }...
public static void main(String[] args) {
?[] types = new ?[] { Enum1, Enum2, Enum3 };
for(? type : types) {
for(Enum elem : type.values() { /* ... */ }
}
}
My main requirement is basically a bunch of String constants, each one grouped in a different type. Would I be better set with a bidimensional String array (String[][])? I'd like some more constrained values, rather than types[j] where j==1 is A, and j==2 is B.
I know I could play around with reflection, but I dare say it would turn out too complex and then, less readable.
Map<String, Set<String>> typeToConstantsto hold your String constants?String[][]but I was looking for something more statically-typed, to see if it's possible.