public enum Direction {
UP,
RIGHT,
DOWN,
LEFT,
}
i have two enum variables (a and b), in one case i have to check, if b is the next of a
for example
if a=UP and b=RIGHT.
and also if a=left and b=UP.
mabe something like this:
if(Direction.valueOf(a+1)==Direction.valueOf(b))
but when a=LEFT it would be out of bounds like an array right ?
valueOf(). Just check theirordinal()with%