diff --git a/src/java/com/threerings/presents/dobj/DSet.java b/src/java/com/threerings/presents/dobj/DSet.java index 66cb1451e..35473b02d 100644 --- a/src/java/com/threerings/presents/dobj/DSet.java +++ b/src/java/com/threerings/presents/dobj/DSet.java @@ -1,5 +1,5 @@ // -// $Id: DSet.java,v 1.22 2002/10/27 18:49:51 mdb Exp $ +// $Id: DSet.java,v 1.23 2002/12/13 02:07:27 mdb Exp $ package com.threerings.presents.dobj; @@ -146,6 +146,23 @@ 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. + */ + public Object toArray (Object[] array) + { + if (array == null) { + array = new Object[size()]; + } + System.arraycopy(_entries, 0, array, 0, array.length); + return array; + } + /** * Adds the specified entry to the set. This should not be called * directly, instead the associated addTo{Set}() method