This piece of code generates unexpected output.
Hashtable<Pair, Integer> results = new Hashtable<Pair, Integer>();
results.put(new Pair(0, 1), 2);
System.out.println("[DBG] " + results.containsKey(new Pair(0, 1)));
The output is [DBG] false
. Why did Hashtable
fail to register this element? Does it have something to do with the way I try to pass a Pair
to the hashtable?