I have an enum like the one below, but eclipse says that there are errors in the first definition of each opposite pair.
public enum Baz{
yin(yang), //Cannot reference a field before it is defined
yang(yin),
good(evil), //Cannot reference a field before it is defined
evil(good);
public final Baz opposite;
Baz(Baz opposite){
this.opposite = opposite;
}
}
What I want to accomplish is being able to use Baz.something.opposite
to get the opposite object of Baz.something
. Is there a possible workaround for this? Maybe an empty placeholder for yang
and bad
before yin
and good
are defined in this example?