From ecc233757914fea665eb8eb64e900fbe3ab0e739 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 8 Apr 2002 00:23:28 +0000 Subject: AbstractMap.java (putAll): Use entrySet size. * java/util/AbstractMap.java (putAll): Use entrySet size. (toString): Explicitly use getKey() and getValue(). From-SVN: r52008 --- libjava/java/util/AbstractMap.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libjava/java/util/AbstractMap.java') 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(", "); } -- cgit v1.1