Factory methods for StreamableArrayList and StreamableHashSet

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6125 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Dave Hoover
2010-08-11 18:09:11 +00:00
parent 0bce227a40
commit 1108d3c0db
3 changed files with 18 additions and 3 deletions
@@ -58,7 +58,7 @@ public class CompoundEvent extends DEvent
_omgr = omgr; _omgr = omgr;
_target = target; _target = target;
_events = new StreamableArrayList<DEvent>(); _events = StreamableArrayList.newList();
} }
/** /**
@@ -39,6 +39,14 @@ import com.threerings.io.Streamable;
public class StreamableArrayList<E> extends ArrayList<E> public class StreamableArrayList<E> extends ArrayList<E>
implements Streamable implements Streamable
{ {
/**
* Creates an empty StreamableArrayList.
*/
public static <E> StreamableArrayList<E> newList ()
{
return new StreamableArrayList<E>();
}
/** /**
* Writes our custom streamable fields. * Writes our custom streamable fields.
*/ */
@@ -40,8 +40,15 @@ public class StreamableHashSet<E> extends HashSet<E>
implements Streamable implements Streamable
{ {
/** /**
* Constructs an empty hash set with the specified number of hash * Creates an empty StreamableHashSet with the default number of hash buckets.
* buckets. */
public static <E> StreamableHashSet<E> newSet ()
{
return new StreamableHashSet<E>();
}
/**
* Constructs an empty hash set with the specified number of hash buckets.
*/ */
public StreamableHashSet (int buckets, float loadFactor) public StreamableHashSet (int buckets, float loadFactor)
{ {