|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap<K,V>
edu.umd.cloud9.io.HashMapWritable<K,V>
K - type of the keyV - type of the valuepublic class HashMapWritable<K extends Writable,V extends 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, use either
VectorInt or VectorFloat for 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.MapWritable isn't.
For a comparison of efficiency, see BenchmarkHashMapWritable.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
| Constructor Summary | |
|---|---|
HashMapWritable()
Creates a HashMapWritable object. |
|
HashMapWritable(HashMap<K,V> map)
Creates a HashMapWritable object from a regular HashMap. |
|
| Method Summary | |
|---|---|
void |
readFields(DataInput in)
Deserializes the array. |
void |
write(DataOutput out)
Serializes this array. |
| 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 |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public HashMapWritable()
public HashMapWritable(HashMap<K,V> map)
| Method Detail |
|---|
public void readFields(DataInput in)
throws IOException
readFields in interface Writablein - source for raw byte representation
IOException
public void write(DataOutput out)
throws IOException
write in interface Writableout - where to write the raw byte representation
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||