クラス Cell をキーとして HashMap を使用しようとしています。ただし、アイテムを HashMap に配置した後、そのアイテムで contains を呼び出すと、false が返されます。
public static void main(String args[]) {
HashMap<Cell, String> map = new HashMap<Cell, String>();
map.put(new Cell(0,0), "Bob");
System.out.println(map.containsKey(new Cell(0,0)));
System.out.println(new Cell(0,0).equals(new Cell(0,0)));
}
Map docs containsKey uses .equals() によると、これは false と true を出力しますが、true と true を出力する必要があります。私は何を間違っていますか?