]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
AbstractMap.java (putAll): Use entrySet size.
authorMark Wielaard <mark@klomp.org>
Mon, 8 Apr 2002 00:23:28 +0000 (00:23 +0000)
committerMark Wielaard <mark@gcc.gnu.org>
Mon, 8 Apr 2002 00:23:28 +0000 (00:23 +0000)
* java/util/AbstractMap.java (putAll): Use entrySet size.
(toString): Explicitly use getKey() and getValue().

From-SVN: r52008

libjava/ChangeLog
libjava/java/util/AbstractMap.java

index a06b98ac5d7750f524dfe64813cb3b2765defc73..6e7ea5d7548b9af319701a6154c034a77552bb01 100644 (file)
@@ -1,3 +1,8 @@
+2002-04-07  Mark Wielaard <mark@klomp.org>
+
+        * java/util/AbstractMap.java (putAll): Use entrySet size.
+        (toString): Explicitly use getKey() and getValue().
+
 2002-04-07  Mark Wielaard <mark@klomp.org>
 
        * java/util/Hashtable.java (contains): Remove NullPointer check.
index 393d3c7754dac41a0cae277340851b8809f89b28..555d055394d2410b30fe20accf87451abe9fa17d 100644 (file)
@@ -353,7 +353,7 @@ public abstract class AbstractMap implements Map
   public void putAll(Map m)
   {
     Iterator entries = m.entrySet().iterator();
-    int pos = size();
+    int pos = m.size();
     while (--pos >= 0)
       {
         Map.Entry entry = (Map.Entry) entries.next();
@@ -425,10 +425,10 @@ public abstract class AbstractMap implements Map
     StringBuffer r = new StringBuffer("{");
     for (int pos = size(); pos > 0; pos--)
       {
-        // Append the toString value of the entries rather than calling
-        // getKey/getValue. This is more efficient and it matches the JDK
-        // behaviour.
-        r.append(entries.next());
+        Map.Entry entry = (Map.Entry) entries.next();
+        r.append(entry.getKey());
+        r.append('=');
+        r.append(entry.getValue());
         if (pos > 1)
           r.append(", ");
       }