diff --git a/src/java/com/threerings/util/StreamableHashMap.java b/src/java/com/threerings/util/StreamableHashMap.java index f964e52bf..edc2d871c 100644 --- a/src/java/com/threerings/util/StreamableHashMap.java +++ b/src/java/com/threerings/util/StreamableHashMap.java @@ -31,8 +31,8 @@ import com.threerings.io.ObjectOutputStream; import com.threerings.io.Streamable; /** - * A {@link HashMap} extension that can be streamed. The keys and values - * in the map must also be of streamable types. + * A {@link HashMap} extension that can be streamed. The keys and values in the map must also be + * of streamable types. * * @see Streamable * @param the type of key stored in this map. @@ -42,7 +42,7 @@ public class StreamableHashMap extends HashMap implements Streamable { /** - * Creates an empty StreamableHashMap + * Creates an empty StreamableHashMap. */ public static StreamableHashMap newMap () { @@ -50,8 +50,15 @@ public class StreamableHashMap extends HashMap } /** - * Constructs an empty hash map with the specified number of hash - * buckets. + * Creates StreamableHashMap populated with the same values as the provided Map. + */ + public static StreamableHashMap newMap (Map map) + { + return new StreamableHashMap(map); + } + + /** + * Constructs an empty hash map with the specified number of hash buckets. */ public StreamableHashMap (int buckets, float loadFactor) { @@ -59,14 +66,22 @@ public class StreamableHashMap extends HashMap } /** - * Constructs an empty hash map with the default number of hash - * buckets. + * Constructs an empty hash map with the default number of hash buckets. */ public StreamableHashMap () { super(); } + /** + * Constructs a hash map with the default number of hash buckets, populated with the same + * values as the provided Map. + */ + public StreamableHashMap (Map map) + { + super(map); + } + /** * Writes our custom streamable fields. */