Added toArrayList().

If we're going to tell you to use an ArrayList instead of toArray(), let's make
that easy. This would be unnecessary if there was an ArrayList constructor that
took Iterable, but there isn't. And DSet is not a Collection.
This commit is contained in:
Michael Bayne
2014-01-22 13:38:14 -08:00
parent 3f589492f5
commit 71e52d355e
@@ -22,6 +22,7 @@
package com.threerings.presents.dobj;
import java.util.AbstractSet;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
@@ -280,14 +281,15 @@ public class DSet<E extends DSet.Entry>
}
/**
* Copies the elements of this distributed set into the supplied array. If the array is not
* large enough to hold all of the elements, as many as fit into the array will be copied. If
* the <code>array</code> argument is null, an object array of sufficient size to contain all
* of the elements of this set will be created and returned.
*
* @deprecated use {@link #clone} or add this to an ArrayList. Arrays are an untypesafe
* quagmire.
* Copies the elements of this distributed set into a newly created {@link ArrayList}.
*/
public ArrayList<E> toArrayList () {
ArrayList<E> list = new ArrayList<E>(size());
for (E elem : this) list.add(elem);
return list;
}
/** @deprecated use {@link #clone} or {@link #toArrayList}. */
@Deprecated
public E[] toArray (E[] array)
{
@@ -299,10 +301,7 @@ public class DSet<E extends DSet.Entry>
return array;
}
/**
* @deprecated use {@link #clone} or add this to an ArrayList. Arrays are an untypesafe
* quagmire.
*/
/** @deprecated use {@link #clone} or {@link #toArrayList}. */
@Deprecated
public Object[] toArray (Object[] array)
{