Author: toad
Date: 2007-07-18 12:10:36 +0000 (Wed, 18 Jul 2007)
New Revision: 14172
Modified:
trunk/freenet/src/freenet/support/LRUQueue.java
Log:
Fix ArrayStoreException, delete obsolete comment. toArrayOrdered(Object[]) now
behaves consistently with the usual API for toArray(Object[]).
Modified: trunk/freenet/src/freenet/support/LRUQueue.java
===================================================================
--- trunk/freenet/src/freenet/support/LRUQueue.java 2007-07-18 08:21:39 UTC
(rev 14171)
+++ trunk/freenet/src/freenet/support/LRUQueue.java 2007-07-18 12:10:36 UTC
(rev 14172)
@@ -124,11 +124,10 @@
}
/**
- * Warning, this will not reallocate unlike the toArray(Object[]) on
java class library functions.
- * FIXME fix that.
- * @param array The array to fill in
+ * @param array The array to fill in. If it is too small a new array of
the same type will be allocated.
*/
public synchronized Object[] toArrayOrdered(Object[] array) {
+ array = toArray(array);
int x = 0;
for(Enumeration e =
list.reverseElements();e.hasMoreElements();) {
array[x++] = e.nextElement();