diff options
author | Mark Wielaard <mark@klomp.org> | 2002-04-08 00:20:00 +0000 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2002-04-08 00:20:00 +0000 |
commit | 832f0a71368aed37e39bdc9d32ad1b2fcaa75294 (patch) | |
tree | b13374e22766dba21bc1232d96c58d4a3a189267 /java | |
parent | acf73556d8909dccde27248cf39e0cbc9654fad7 (diff) | |
download | classpath-832f0a71368aed37e39bdc9d32ad1b2fcaa75294.tar.gz |
* java/util/AbstractMap.java (putAll): Use entrySet size.
(toString): Explicitly use getKey() and getValue().
Diffstat (limited to 'java')
-rw-r--r-- | java/util/AbstractMap.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/java/util/AbstractMap.java b/java/util/AbstractMap.java index 28974afbf..4978ee59a 100644 --- a/java/util/AbstractMap.java +++ b/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(", "); } |