You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by xl...@apache.org on 2007/05/24 13:33:44 UTC
svn commit: r541271 -
/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/WeakHashMap.java
Author: xli
Date: Thu May 24 04:33:43 2007
New Revision: 541271
URL: http://svn.apache.org/viewvc?view=rev&rev=541271
Log:
HARMONY-3883 : reverted ([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=541271&r1=541270&r2=541271
==============================================================================
--- 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 24 04:33:43 2007
@@ -178,29 +178,6 @@
throw new ConcurrentModificationException();
}
}
-
- /**
- * Adds next element to the given collection.
- *
- * @param coll Collection to add next element to
- *
- * @return true if next element exists and was added, false otherwise
- */
- private boolean addNext(Collection<R> coll) {
- if (expectedModCount == modCount) {
- if (hasNext()) {
- currentEntry = nextEntry;
- nextEntry = currentEntry.next;
- R result = type.get(currentEntry);
- // free the key
- nextKey = null;
- coll.add(result);
- return true;
- }
- return false;
- }
- throw new ConcurrentModificationException();
- }
}
/**
@@ -410,18 +387,20 @@
@Override
public Object[] toArray() {
Collection<K> coll = new ArrayList<K>(size());
- HashIterator<K> iter = (HashIterator<K>) iterator();
- while(iter.addNext(coll));
+ 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());
- HashIterator<K> iter = (HashIterator<K>) iterator();
- while(iter.addNext(coll));
+ for (Iterator<K> iter = iterator(); iter.hasNext();) {
+ coll.add(iter.next());
+ }
return coll.toArray(contents);
}
};