//Eliminate path that are long while (iterator.hasNext()) { BoardState boardstate = (BoardState) iterator.next(); LinkedList path = (LinkedList) boardstate.path; Puzzle puzzle = (Puzzle) path.getLast(); int levelCount = boardstate.getLevel(puzzle); ListIterator iterator2 = searchQueue.listIterator(); while (iterator2.hasNext()) { BoardState boardstate2 = (BoardState) iterator2.next(); LinkedList path2 = (LinkedList) boardstate2.path; Puzzle puzzle2 = (Puzzle) path2.getLast(); int levelCount2 = boardstate2.getLevel(puzzle2); if (puzzle.equals(puzzle2)) { if (levelCount >= levelCount2) { ...