Code example for TreeSet

Methods: iterator, size

0
            return; 
        } 
        if(selectedPiece == -1) return;
         
        if(selectedRow != yCell || selectedColumn != xCell || !possibleSelectedMoves.hasNext()) {
            SortedSet<String> theMoves = new TreeSet<String>(getLegalMovesForCell(xCell, yCell));
            if(theMoves.size() == 0)
                return; 
            possibleSelectedMoves = theMoves.iterator();            
        } 
        selectedRow = yCell;
        selectedColumn = xCell;
         
        currentSelectedMove = possibleSelectedMoves.next();        
        submitWorkingMove(stringToMove(currentSelectedMove));
    } 
 
    // Cache all of the facts about cells that we compute, since they should not 
    // change unless the game state changes. 
    private Map<Integer, Set<String>> factsCache = new HashMap<Integer, Set<String>>();
    protected Set<String> getCachedFactsAboutCell(int xCell, int yCell) {