void removeFriendsAndBorders(Piece piece, ArrayList<Point> points) { boolean up = piece.isUp(); for (Iterator<Point> it = points.iterator(); it.hasNext(); ) { Point point = it.next(); if (point != Poussin.PROMOTING && (point.x < 0 || point.y < 0 || point.x >= GRID_WIDTH || point.y >= GRID_HEIGHT)) { it.remove(); continue; } Piece pieceOnSquare = getPosition().getPiece(point.x, point.y); if (pieceOnSquare != null && pieceOnSquare.isUp() == up) it.remove(); } }