com.threerings.util
Class StreamableHashMap<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by com.threerings.util.StreamableHashMap<K,V>
Type Parameters:
K - the type of key stored in this map.
V - the type of value stored in this map.
All Implemented Interfaces:
Streamable, Serializable, Cloneable, Map<K,V>

@ReplacedBy(value="java.util.Map")
public class StreamableHashMap<K,V>
extends HashMap<K,V>
implements Streamable

A HashMap extension that can be streamed. The keys and values in the map must also be of streamable types.

See Also:
Streamable, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface com.threerings.io.Streamable
Streamable.Closure
 
Constructor Summary
StreamableHashMap()
          Constructs an empty hash map with the default number of hash buckets.
StreamableHashMap(int buckets, float loadFactor)
          Constructs an empty hash map with the specified number of hash buckets.
StreamableHashMap(Map<? extends K,? extends V> map)
          Constructs a hash map with the default number of hash buckets, populated with the same values as the provided Map.
 
Method Summary
static
<K,V> StreamableHashMap<K,V>
newMap()
          Creates an empty StreamableHashMap.
static
<K,V> StreamableHashMap<K,V>
newMap(Map<? extends K,? extends V> map)
          Creates StreamableHashMap populated with the same values as the provided Map.
 void readObject(ObjectInputStream in)
          Reads our custom streamable fields.
 void writeObject(ObjectOutputStream out)
          Writes our custom streamable fields.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

StreamableHashMap

public StreamableHashMap(int buckets,
                         float loadFactor)
Constructs an empty hash map with the specified number of hash buckets.


StreamableHashMap

public StreamableHashMap()
Constructs an empty hash map with the default number of hash buckets.


StreamableHashMap

public StreamableHashMap(Map<? extends K,? extends V> map)
Constructs a hash map with the default number of hash buckets, populated with the same values as the provided Map.

Method Detail

newMap

public static <K,V> StreamableHashMap<K,V> newMap()
Creates an empty StreamableHashMap.


newMap

public static <K,V> StreamableHashMap<K,V> newMap(Map<? extends K,? extends V> map)
Creates StreamableHashMap populated with the same values as the provided Map.


writeObject

public void writeObject(ObjectOutputStream out)
                 throws IOException
Writes our custom streamable fields.

Throws:
IOException

readObject

public void readObject(ObjectInputStream in)
                throws IOException,
                       ClassNotFoundException
Reads our custom streamable fields.

Throws:
IOException
ClassNotFoundException