opposite static method

int opposite(
  1. int position
)

Returns LEFT if the position is RIGHT, RIGHT if the position is LEFT, or the position otherwise.

Implementation

static int opposite(int position) {
  if (position == LEFT) return RIGHT;
  if (position == RIGHT) return LEFT;
  return position;
}