From 7b97f872c8194bbeca7182873498421add86f0fd Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 18 Feb 2003 19:50:34 +0000 Subject: [PATCH] Allow initialization from an array of entries. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2285 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/presents/dobj/DSet.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/presents/dobj/DSet.java b/src/java/com/threerings/presents/dobj/DSet.java index 57d18611a..77b0ff4f6 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.25 2002/12/20 23:41:26 mdb Exp $ +// $Id: DSet.java,v 1.26 2003/02/18 19:50:34 mdb Exp $ package com.threerings.presents.dobj; @@ -65,6 +65,26 @@ public class DSet } } + /** + * Creates a distributed set and populates it with values from the + * supplied array. This should be done before the set is unleashed + * into the wild distributed object world because no associated entry + * added events will be generated. Additionally, this operation does + * not check for duplicates when adding entries, so one should be sure + * that the iterator contains only unique entries. + * + * @param source an array from which we will initially populate the + * set. + */ + public DSet (Entry[] source) + { + for (int ii = 0; ii < source.length; ii++) { + if (source[ii] != null) { + add(source[ii]); + } + } + } + /** * Constructs an empty distributed set. */