I would like to have enumerator in Java having other enum as attribute.
public enum Direction {
Up(Down),
Down(Up),
Left(Right),
Right(Left);
private Direction opposite;
Direction(Direction opposite){
this.opposite = opposite;
}
}
So I have different Direction, and for each I want to know the opposite. It is working fine for Down and Right, but I can't initialize Up because Down is not known yet (same fort Left).
How can I edit enum variables after initialisation ?