Commit ecc23375 by Mark Wielaard Committed by Mark Wielaard

AbstractMap.java (putAll): Use entrySet size.

	* java/util/AbstractMap.java (putAll): Use entrySet size.
	(toString): Explicitly use getKey() and getValue().

From-SVN: r52008
parent 298f6e4b
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.
(containsValue): Add NullPointer check.
(remove): Always throw NullPointerException when key
......
......@@ -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(", ");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment