Commit 32ffbe92 by Stuart Ballard Committed by Michael Koch

HashMap.java (putAll): Use Iterator hasNext() method.

2003-11-26  Stuart Ballard <stuart.ballard@corp.fast.net>

	* java/util/HashMap.java (putAll): Use Iterator hasNext() method.
	(putAllInternal): Likewise.
	* java/util/Hashtable.java (putAll): Use Iterator hasNext() method.
	(putAllInternal): Likewise.

From-SVN: r73964
parent cb5599c7
2003-11-26 Stuart Ballard <stuart.ballard@corp.fast.net>
* java/util/HashMap.java (putAll): Use Iterator hasNext() method.
(putAllInternal): Likewise.
* java/util/Hashtable.java (putAll): Use Iterator hasNext() method.
(putAllInternal): Likewise.
2003-11-26 Michael Koch <konqueror@gmx.de>
* java/net/URLStreamHandler.java
......
......@@ -381,8 +381,7 @@ public class HashMap extends AbstractMap
public void putAll(Map m)
{
Iterator itr = m.entrySet().iterator();
int msize = m.size();
while (msize-- > 0)
while (itr.hasNext())
{
Map.Entry e = (Map.Entry) itr.next();
// Optimize in case the Entry is one of our own.
......@@ -709,10 +708,10 @@ public class HashMap extends AbstractMap
void putAllInternal(Map m)
{
Iterator itr = m.entrySet().iterator();
int msize = m.size();
size = msize;
while (msize-- > 0)
size = 0;
while (itr.hasNext())
{
size++;
Map.Entry e = (Map.Entry) itr.next();
Object key = e.getKey();
int idx = hash(key);
......
......@@ -510,7 +510,7 @@ public class Hashtable extends Dictionary
{
Iterator itr = m.entrySet().iterator();
for (int msize = m.size(); msize > 0; msize--)
while (itr.hasNext())
{
Map.Entry e = (Map.Entry) itr.next();
// Optimize in case the Entry is one of our own.
......@@ -859,11 +859,11 @@ public class Hashtable extends Dictionary
void putAllInternal(Map m)
{
Iterator itr = m.entrySet().iterator();
int msize = m.size();
this.size = msize;
size = 0;
for (; msize > 0; msize--)
while (itr.hasNext())
{
size++;
Map.Entry e = (Map.Entry) itr.next();
Object key = e.getKey();
int idx = hash(key);
......
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