classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [really patch] Re: HashMap putAll/putAllInternal bug


From: Stuart Ballard
Subject: Re: [really patch] Re: HashMap putAll/putAllInternal bug
Date: Mon, 27 Oct 2003 11:35:53 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20031010 Debian/1.4-6

Stuart Ballard wrote:
If nobody speaks up, may I suggest that the consensus is "reluctantly apply it" - and in that case, could someone do so?

Nobody spoke up, so could someone apply the patch (attached)?

Thanks,
Stuart.

--
Stuart Ballard, Senior Web Developer
FASTNET - Web Solutions
(215) 283-2300, ext. 126
www.fast.net
Index: HashMap.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/HashMap.java,v
retrieving revision 1.24
diff -u -r1.24 HashMap.java
--- HashMap.java        1 Aug 2003 03:31:32 -0000       1.24
+++ HashMap.java        25 Sep 2003 18:16:52 -0000
@@ -381,8 +381,7 @@
   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 @@
   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);
Index: Hashtable.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/Hashtable.java,v
retrieving revision 1.28
diff -u -r1.28 Hashtable.java
--- Hashtable.java      7 May 2002 05:13:05 -0000       1.28
+++ Hashtable.java      25 Sep 2003 18:16:52 -0000
@@ -510,7 +510,7 @@
   {
     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 @@
   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);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]