Expose that HashMap constructor on StreamableHashMap, too.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5756 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Dave Hoover
2009-04-29 18:59:10 +00:00
parent f6a689cd47
commit c8dd3f1901
@@ -31,8 +31,8 @@ import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable; import com.threerings.io.Streamable;
/** /**
* A {@link HashMap} extension that can be streamed. The keys and values * A {@link HashMap} extension that can be streamed. The keys and values in the map must also be
* in the map must also be of streamable types. * of streamable types.
* *
* @see Streamable * @see Streamable
* @param <K> the type of key stored in this map. * @param <K> the type of key stored in this map.
@@ -42,7 +42,7 @@ public class StreamableHashMap<K, V> extends HashMap<K, V>
implements Streamable implements Streamable
{ {
/** /**
* Creates an empty StreamableHashMap * Creates an empty StreamableHashMap.
*/ */
public static <K, V> StreamableHashMap<K, V> newMap () public static <K, V> StreamableHashMap<K, V> newMap ()
{ {
@@ -50,8 +50,15 @@ public class StreamableHashMap<K, V> extends HashMap<K, V>
} }
/** /**
* Constructs an empty hash map with the specified number of hash * Creates StreamableHashMap populated with the same values as the provided Map.
* buckets. */
public static <K, V> StreamableHashMap<K, V> newMap (Map<? extends K, ? extends V> map)
{
return new StreamableHashMap<K, V>(map);
}
/**
* Constructs an empty hash map with the specified number of hash buckets.
*/ */
public StreamableHashMap (int buckets, float loadFactor) public StreamableHashMap (int buckets, float loadFactor)
{ {
@@ -59,14 +66,22 @@ public class StreamableHashMap<K, V> extends HashMap<K, V>
} }
/** /**
* Constructs an empty hash map with the default number of hash * Constructs an empty hash map with the default number of hash buckets.
* buckets.
*/ */
public StreamableHashMap () public StreamableHashMap ()
{ {
super(); super();
} }
/**
* Constructs a hash map with the default number of hash buckets, populated with the same
* values as the provided Map.
*/
public StreamableHashMap (Map<? extends K, ? extends V> map)
{
super(map);
}
/** /**
* Writes our custom streamable fields. * Writes our custom streamable fields.
*/ */