tl.lin.data.map
Class HashMapWritable<K extends org.apache.hadoop.io.Writable,V extends org.apache.hadoop.io.Writable>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
tl.lin.data.map.HashMapWritable<K,V>
- Type Parameters:
K - type of the keyV - type of the value
- All Implemented Interfaces:
- Serializable, Cloneable, Map<K,V>, org.apache.hadoop.io.Writable
public class HashMapWritable<K extends org.apache.hadoop.io.Writable,V extends org.apache.hadoop.io.Writable>
- extends HashMap<K,V>
- implements org.apache.hadoop.io.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.
- 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 org.apache.hadoop.io.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 org.apache.hadoop.io.Writable
- Parameters:
out - where to write the raw byte representation
- Throws:
IOException
Copyright © 2013. All Rights Reserved.