I have an enum class with the cardinal directions(North, East, South, West):
public enum Direction {
NORTH,
EAST,
SOUTH,
WEST;
}
Is there a way to be able to use multiple names for the same thing? For example something like this:
public enum Direction {
NORTH or N,
EAST or E,
SOUTH or S,
WEST or W;
}
In practice what I want is to be able and sign to a variable either N or NORTH and have the two operations be exactly the same.
Example:
Direction direction1=new Direction.NORTH;
Direction direction2=new Direction.N;
//direction1==direction2