Index: ChangeLog =================================================================== RCS file: /cvsroot/classpath/classpath/ChangeLog,v retrieving revision 1.1744 diff -u -b -B -r1.1744 ChangeLog --- ChangeLog 31 Dec 2003 11:17:16 -0000 1.1744 +++ ChangeLog 4 Jan 2004 20:37:54 -0000 @@ -1,3 +1,13 @@ +2004-01-04 Michael Koch + + * java/util/HashMap.java (HashMap(Map)): As above. + (putAllInternal): As above. + * java/util/Hashtable.java (Hashtable(Map)): Use putAll, not + putAllInternal. + (putAllInternal): Correct comment. + (internalContainsValue): Removed. + (containsValue): Don't delegate to internalContainsValue. + 2003-12-31 Fernando Nasser * java/awt/Choice.java Index: java/util/HashMap.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/util/HashMap.java,v retrieving revision 1.25 diff -u -b -B -r1.25 HashMap.java --- java/util/HashMap.java 7 Nov 2003 09:51:44 -0000 1.25 +++ java/util/HashMap.java 4 Jan 2004 20:37:54 -0000 @@ -223,7 +223,7 @@ public HashMap(Map m) { this(Math.max(m.size() * 2, DEFAULT_CAPACITY), DEFAULT_LOAD_FACTOR); - putAllInternal(m); + putAll(m); } /** @@ -699,9 +699,9 @@ } /** - * A simplified, more efficient internal implementation of putAll(). The - * Map constructor and clone() should not call putAll or put, in order to - * be compatible with the JDK implementation with respect to subclasses. + * A simplified, more efficient internal implementation of putAll(). clone() + * should not call putAll or put, in order to be compatible with the JDK + * implementation with respect to subclasses. * * @param m the map to initialize this from */ Index: java/util/Hashtable.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/util/Hashtable.java,v retrieving revision 1.30 diff -u -b -B -r1.30 Hashtable.java --- java/util/Hashtable.java 28 Nov 2003 17:29:03 -0000 1.30 +++ java/util/Hashtable.java 4 Jan 2004 20:37:54 -0000 @@ -234,7 +234,7 @@ public Hashtable(Map m) { this(Math.max(m.size() * 2, DEFAULT_CAPACITY), DEFAULT_LOAD_FACTOR); - putAllInternal(m); + putAll(m); } /** @@ -333,11 +333,22 @@ */ public synchronized boolean contains(Object value) { - /* delegate to non-overridable worker method - * to avoid blowing up the stack, when called - * from overridden contains[Value]() method. - */ - return internalContainsValue(value); + for (int i = buckets.length - 1; i >= 0; i--) + { + HashEntry e = buckets[i]; + while (e != null) + { + if (value.equals(e.value)) + return true; + e = e.next; + } + } + + // Must throw on null argument even if the table is empty + if (value == null) + throw new NullPointerException(); + + return false; } /** @@ -354,44 +365,12 @@ */ public boolean containsValue(Object value) { - /* delegate to older method to make sure code overwriting it - * continues to work. - */ + // Delegate to older method to make sure code overriding it continues + // to work. return contains(value); } /** - * Returns true if this Hashtable contains a value o, such that - * o.equals(value). This is an internal worker method - * called by contains() and containsValue(). - * - * @param value the value to search for in this Hashtable - * @return true if at least one key maps to the value - * @see #contains(Object) - * @see #containsKey(Object) - * @throws NullPointerException if value is null - */ - private boolean internalContainsValue(Object value) - { - for (int i = buckets.length - 1; i >= 0; i--) - { - HashEntry e = buckets[i]; - while (e != null) - { - if (value.equals(e.value)) - return true; - e = e.next; - } - } - - // Must throw on null argument even if the table is empty - if (value == null) - throw new NullPointerException(); - - return false; - } - - /** * Returns true if the supplied object equals() a key * in this Hashtable. * @@ -873,9 +852,9 @@ } /** - * A simplified, more efficient internal implementation of putAll(). The - * Map constructor and clone() should not call putAll or put, in order to - * be compatible with the JDK implementation with respect to subclasses. + * A simplified, more efficient internal implementation of putAll(). clone() + * should not call putAll or put, in order to be compatible with the JDK + * implementation with respect to subclasses. * * @param m the map to initialize this from */