K - type of the keyV - type of the valuepublic 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.AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
HashMapWritable()
Creates a HashMapWritable object.
|
HashMapWritable(HashMap<K,V> map)
Creates a HashMapWritable object from a regular HashMap.
|
| Modifier and Type | Method and Description |
|---|---|
void |
readFields(DataInput in)
Deserializes the array.
|
void |
write(DataOutput out)
Serializes this array.
|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, valuesequals, hashCode, toStringpublic void readFields(DataInput in) throws IOException
readFields in interface org.apache.hadoop.io.Writablein - source for raw byte representationIOExceptionpublic void write(DataOutput out) throws IOException
write in interface org.apache.hadoop.io.Writableout - where to write the raw byte representationIOExceptionCopyright © 2014. All rights reserved.