diff options
author | Mark Wielaard <mark@klomp.org> | 2002-04-08 00:23:28 +0000 |
---|---|---|
committer | Mark Wielaard <mark@gcc.gnu.org> | 2002-04-08 00:23:28 +0000 |
commit | ecc233757914fea665eb8eb64e900fbe3ab0e739 (patch) | |
tree | bd9368d5195846571079721a7d3efbb116ae168b /libjava/java/util | |
parent | 298f6e4bdc5bd819f817d76aecc8799cb596d933 (diff) | |
download | gcc-ecc233757914fea665eb8eb64e900fbe3ab0e739.zip gcc-ecc233757914fea665eb8eb64e900fbe3ab0e739.tar.gz gcc-ecc233757914fea665eb8eb64e900fbe3ab0e739.tar.bz2 |
AbstractMap.java (putAll): Use entrySet size.
* java/util/AbstractMap.java (putAll): Use entrySet size.
(toString): Explicitly use getKey() and getValue().
From-SVN: r52008
Diffstat (limited to 'libjava/java/util')
-rw-r--r-- | libjava/java/util/AbstractMap.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libjava/java/util/AbstractMap.java b/libjava/java/util/AbstractMap.java index 393d3c7..555d055 100644 --- a/libjava/java/util/AbstractMap.java +++ b/libjava/java/util/AbstractMap.java @@ -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(", "); } |