I'd need something like the following
enum EE {
A("anything"),
B("beta"),
...
Z("zulu"),
ALL,
;
EE(String s) {
this.s = s;
}
EE() {
String s = "";
for (EE ee : values()) { // PROBLEM HERE
if (ee != ALL) s += " " + ee.s;
}
this.s = s;
}
}
While creating ALL I'd like to access the other members of the enum. The above doesn't work because of values() returning null at this point. Using A, B, ..., Z explicitly doesn't compile. I understand perfectly why this chicken-egg problem happens, but am looking for a nice workaround.
And no, removing ALL from EE is not an option.