@Override public int hashCode() { if (data instanceof Tile) { Tile tile = (Tile) data; int result = tile.getPos().getX(); result = 31 * result + tile.getPos().getY(); return result; } else { return getId(); } }
public Node(Tile data) { Position pos = data.getPos(); this.id = pos.getX() * 31 + pos.getY(); this.data = (T) data; }