ComponentDropLocation (Direction direction) { String side = switch (direction) { case LEFT -> getAdjacentSide(myQuadrant, 0, -1); case UP -> getAdjacentSide(myQuadrant, -1, 0); case RIGHT -> getAdjacentSide(myQuadrant, 0, 1); case DOWN -> getAdjacentSide(myQuadrant, 1, 0); }; if (side != null) { return new MyDropLocation(myContainer, side); } return null; }