aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/util/AbstractMap.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/util/AbstractMap.java')
-rw-r--r--libjava/java/util/AbstractMap.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/libjava/java/util/AbstractMap.java b/libjava/java/util/AbstractMap.java
index c4f9df0..7ce7305 100644
--- a/libjava/java/util/AbstractMap.java
+++ b/libjava/java/util/AbstractMap.java
@@ -227,15 +227,18 @@ public abstract class AbstractMap implements Map
{
Iterator entries = entrySet().iterator();
int size = size();
- String r = "{";
+ StringBuffer r = new StringBuffer("{");
for (int pos = 0; pos < size; pos++)
{
- r += entries.next();
+ // 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());
if (pos < size - 1)
- r += ", ";
+ r.append(", ");
}
- r += "}";
- return r;
+ r.append("}");
+ return r.toString();
}
public Collection values()