diff options
author | gandalf <gandalf@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-23 15:19:26 +0000 |
---|---|---|
committer | gandalf <gandalf@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-23 15:19:26 +0000 |
commit | 5c7411981584e487ac41794feb98a66df9fd6fcb (patch) | |
tree | febe3d4d4c0c994db223fee8e819bde6582494c9 /libjava/classpath/java/util/HashMap.java | |
parent | 112dfe9f689af01c2dd00e0f153fc25d69095b6c (diff) | |
download | ppe42-gcc-5c7411981584e487ac41794feb98a66df9fd6fcb.tar.gz ppe42-gcc-5c7411981584e487ac41794feb98a66df9fd6fcb.zip |
Merge GNU Classpath 0.99 into libjava.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185741 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/util/HashMap.java')
-rw-r--r-- | libjava/classpath/java/util/HashMap.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libjava/classpath/java/util/HashMap.java b/libjava/classpath/java/util/HashMap.java index 55d81c620b1..f5194a24061 100644 --- a/libjava/classpath/java/util/HashMap.java +++ b/libjava/classpath/java/util/HashMap.java @@ -100,11 +100,10 @@ public class HashMap<K, V> extends AbstractMap<K, V> implements Map<K, V>, Cloneable, Serializable { /** - * Default number of buckets. This is the value the JDK 1.3 uses. Some - * early documentation specified this value as 101. That is incorrect. + * Default number of buckets; this is currently set to 16. * Package visible for use by HashSet. */ - static final int DEFAULT_CAPACITY = 11; + static final int DEFAULT_CAPACITY = 16; /** * The default load factor; this is explicitly specified by the spec. @@ -344,9 +343,12 @@ public class HashMap<K, V> extends AbstractMap<K, V> int idx = hash(key); HashEntry<K, V> e = buckets[idx]; + int hash1 = key == null ? 0 : key.hashCode(); while (e != null) { - if (equals(key, e.key)) + int hash2 = e.key == null ? 0 : e.key.hashCode(); + + if ((hash1 == hash2) && equals(key, e.key)) { e.access(); // Must call this for bookkeeping in LinkedHashMap. V r = e.value; |