19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test
26 * @bug 4559052
27 * @summary Hashtable's hashCode method always returns zero(!)
28 * @author Josh Bloch
29 */
30
31 import java.util.*;
32
33 public class HashCode {
34 public static void main(String[] args) throws Exception {
35 Map m = new Hashtable();
36 if (m.hashCode() != 0)
37 throw new Exception("Empty Hashtable has nonzero hashCode.");
38
39 m.put("Joe", "Blow");
40 if (m.hashCode() != ("Joe".hashCode() ^ "Blow".hashCode()))
41 throw new Exception("Non-empty Hashtable has wrong hashCode.");
42 }
43 }
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test
26 * @bug 4559052
27 * @summary Hashtable's hashCode method always returns zero(!)
28 * @author Josh Bloch
29 */
30
31 import java.util.*;
32
33 public class HashCode {
34 public static void main(String[] args) throws Exception {
35 Map m = new Hashtable();
36 if (m.hashCode() != 0)
37 throw new Exception("Empty Hashtable has nonzero hashCode.");
38
39 }
40 }
|