在切线问题上,对邻居使用EnumMap可能更好:
Map<Dir, Cell> neighbours = Collections.synchronizedMap(new EnumMap<Dir, Cell>(Dir.class));neighbours.put(Dir.North, new Cell());for (Map.Entry<Dir, Cell> neighbour : neighbours.entrySet()) { if (neighbour.isVisited()) { ... }}etc..顺便说一句:按惯例,枚举实例应全部为大写,
enum Dir { NORTH, EAST, SOUTH, WEST}


