Hex field;
IHex field;
    private static void findAllUnused(IBoard board, int terrainType, HashSet alreadyUsed,            HashSet unUsed, IHex searchFrom, HashMap reverseHex) {        Hex field;        HashSet notYetUsed = new HashSet();                notYetUsed.add(searchFrom);        do {            Iterator iter = notYetUsed.iterator();            field = (Hex)iter.next();            if (field == null) {                continue;            }            for (int dir = 0; dir < 6; dir++) {                Point loc = (Point) reverseHex.get(field);                IHex newHex = board.getHexInDir(loc.x, loc.y, dir);                if ((newHex != null) &&                         (!alreadyUsed.contains(newHex)) &&                        (!notYetUsed.contains(newHex)) &&                        (!unUsed.contains(newHex))) {                    ((newHex.containsTerrain(terrainType)) ? notYetUsed : unUsed ).add(newHex);                }            }            notYetUsed.remove(field);            alreadyUsed.add(field);        } while (!notYetUsed.isEmpty());    }