edu.umd.cloud9.io.map
Class HashMapWritable<K extends Writable,V extends Writable>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
edu.umd.cloud9.io.map.HashMapWritable<K,V>
- Type Parameters:
K - type of the keyV - type of the value
- All Implemented Interfaces:
- Serializable, Cloneable, Map<K,V>, Writable
public class HashMapWritable<K extends Writable,V extends Writable>
- extends HashMap<K,V>
- implements Writable
Writable extension of a Java HashMap. This generic class supports the use of
any type as either key or value. For a feature vector, HMapKIW,
HMapKFW, and a family of related classes provides a more efficient
implementation.
There are a number of key differences between this class and Hadoop's
MapWritable:
MapWritable is more flexible in that it supports
heterogeneous elements. In this class, all keys must be of the same type and
all values must be of the same type. This assumption allows a simpler
serialization protocol and thus is more efficient. Run main in
this class for a simple efficiency test.
- Author:
- Jimmy Lin, Tamer Elsayed
- See Also:
- Serialized Form
| Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
HashMapWritable
public HashMapWritable()
- Creates a HashMapWritable object.
HashMapWritable
public HashMapWritable(HashMap<K,V> map)
- Creates a HashMapWritable object from a regular HashMap.
readFields
public void readFields(DataInput in)
throws IOException
- Deserializes the array.
- Specified by:
readFields in interface Writable
- Parameters:
in - source for raw byte representation
- Throws:
IOException
write
public void write(DataOutput out)
throws IOException
- Serializes this array.
- Specified by:
write in interface Writable
- Parameters:
out - where to write the raw byte representation
- Throws:
IOException