diff options
author | Eric Blake <ebb9@byu.net> | 2001-10-19 07:06:45 +0000 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2001-10-19 07:06:45 +0000 |
commit | cceec37eda03402d55ff31efd7677c0dbd0f77c3 (patch) | |
tree | f8250556f430f6faa922daee04a0d55cc8d80223 /java/util/AbstractMap.java | |
parent | 8a61bfc72352d331a1bbc397b2aac89d758a68ff (diff) | |
download | classpath-cceec37eda03402d55ff31efd7677c0dbd0f77c3.tar.gz |
2001-10-19 Eric Blake <ebb9@email.byu.edu>
* java/util/IdentityHashMap.java: Improve javadoc, fix member
visibility for less code generation.
(modCount): Add fail-safe iteration.
(entries): Cache the entry set.
(hash): Rename from getHash, and make it more powerful - common
code for iterating over the table is now in one location.
(entrySet): Add missing method hashCode, optimize methods contains
and remove.
(equals, putAll): Add missing (but useless) methods.
(hashCode): Add missing (and important) method.
(keySet): Add missing method hashCode.
(values): Add missing method remove.
(class IdentityIterator): Add fail-safe iteration, fix next to be
correctly parameterized.
(class IdentityEntry): Add a class for entrySet iteration.
* java/util/AbstractMap.java (hashCode): Optimize.
* java/util/Collections.java (SingletonSet): Fix visibility for
less code generation.
Diffstat (limited to 'java/util/AbstractMap.java')
-rw-r--r-- | java/util/AbstractMap.java | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/java/util/AbstractMap.java b/java/util/AbstractMap.java index 7a6e79cf2..a6627bb09 100644 --- a/java/util/AbstractMap.java +++ b/java/util/AbstractMap.java @@ -218,7 +218,8 @@ public abstract class AbstractMap implements Map /** * Returns the hash code for this map. As defined in Map, this is the sum - * of all hashcodes for each Map.Entry object in entrySet. + * of all hashcodes for each Map.Entry object in entrySet, or basically + * entrySet().hashCode(). * * @return the hash code * @see Map.Entry#hashCode() @@ -226,12 +227,7 @@ public abstract class AbstractMap implements Map */ public int hashCode() { - int hashcode = 0; - Iterator itr = entrySet().iterator(); - int pos = size(); - while (--pos >= 0) - hashcode += itr.next().hashCode(); - return hashcode; + return entrySet().hashCode(); } /** |