harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x..@apache.org
Subject svn commit: r538930 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java
Date Thu, 17 May 2007 14:06:01 GMT
Author: xli
Date: Thu May 17 07:06:00 2007
New Revision: 538930

URL: http://svn.apache.org/viewvc?view=rev&rev=538930
Log:
HARMONY-3883 : [classlib]WeakHashMap.keySet().toArray() intermittently throws NoSuchElementException
in java.lang.ThreadTest of DRLVM kernel test. 

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java?view=diff&rev=538930&r1=538929&r2=538930
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java
Thu May 17 07:06:00 2007
@@ -383,6 +383,26 @@
                         }
                     });
                 }
+
+                @Override
+                public Object[] toArray() {
+                    Collection<K> coll = new ArrayList<K>(size());
+
+                    for (Iterator<K> iter = iterator(); iter.hasNext();) {
+                        coll.add(iter.next());
+                    }
+                    return coll.toArray();
+                }
+
+                @Override
+                public <T> T[] toArray(T[] contents) {
+                    Collection<K> coll = new ArrayList<K>(size());
+
+                    for (Iterator<K> iter = iterator(); iter.hasNext();) {
+                        coll.add(iter.next());
+                    }
+                    return coll.toArray(contents);
+                }
             };
         }
         return keySet;



Mime
View raw message