-
Type:
Bug
-
Resolution: Duplicate
-
Priority:
P4
-
None
-
Affects Version/s: 1.1.6
-
Component/s: client-libs
-
x86
-
windows_nt
Name: bk70084 Date: 06/18/98
Dimension does not define a hashCode() method, so it cannot be used as a key in a
HashTable. The Dimension.hashCode() method needs to be implemented in the
1.1.x and 1.2 releases.
import java.awt.*;
import java.util.*;
public class Test
{
static public void main(String args[]) {
Hashtable dims2 = new Hashtable();
dims2.put(new Dimension(7,7), "7, 7");
System.out.println("dims2.get(new Dimension(7,7))->" +
dims2.get(new Dimension(7,7)));
System.out.println();
for (int i=0; i<10; i++)
System.out.println("hashCode=" + new Dimension(7,7).hashCode());
}
}
(Review ID: 30520)
======================================================================
- duplicates
-
JDK-4157612 Many classes violate Object.hashCode contract
-
- Resolved
-