--- jsr166/src/main/java/util/AbstractMap.java 2005/06/20 18:02:22 1.13 +++ jsr166/src/main/java/util/AbstractMap.java 2005/06/21 07:43:09 1.14 @@ -388,7 +388,13 @@ public abstract class AbstractMap i // Comparison and hashing /** - * {@inheritDoc} + * Compares the specified object with this map for equality. Returns + * true if the given object is also a map and the two maps + * represent the same mappings. More formally, two maps m1 and + * m2 represent the same mappings if + * m1.entrySet().equals(m2.entrySet()). This ensures that the + * equals method works properly across different implementations + * of the Map interface. * *

This implementation first checks if the specified object is this map; * if so it returns true. Then, it checks if the specified @@ -398,6 +404,9 @@ public abstract class AbstractMap i * contains each mapping that this map contains. If the specified map * fails to contain such a mapping, false is returned. If the * iteration completes, true is returned. + * + * @param o object to be compared for equality with this map + * @return true if the specified object is equal to this map */ public boolean equals(Object o) { if (o == this) @@ -433,14 +442,19 @@ public abstract class AbstractMap i } /** - * {@inheritDoc} + * Returns the hash code value for this map. The hash code of a map is + * defined to be the sum of the hash codes of each entry in the map's + * entrySet() view. This ensures that m1.equals(m2) + * implies that m1.hashCode()==m2.hashCode() for any two maps + * m1 and m2, as required by the general contract of + * {@link Object#hashCode}. * *

This implementation iterates over entrySet(), calling - * hashCode() on each element (entry) in the set, and - * adding up the results. + * {@link Map.Entry#hashCode hashCode()} on each element (entry) in the + * set, and adding up the results. * + * @return the hash code value for this map * @see Map.Entry#hashCode() - * @see Object#hashCode() * @see Object#equals(Object) * @see Set#equals(Object) */