diff --git a/core/src/main/java/com/threerings/presents/dobj/DSet.java b/core/src/main/java/com/threerings/presents/dobj/DSet.java index 3b8921768..7cea3f879 100644 --- a/core/src/main/java/com/threerings/presents/dobj/DSet.java +++ b/core/src/main/java/com/threerings/presents/dobj/DSet.java @@ -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 } /** - * 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 array 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 toArrayList () { + ArrayList list = new ArrayList(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 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) {