|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap
java.util.HashMap
edu.neu.ccs.quick.QuickHashMap
QuickHashMap extends HashMap by
adding one constructor and three methods putPairs,
setPairs, and removeKeys that handle
an array of Object at once.
In addition, symmetric methods are added that will hash both a key to its value and a value to its key.
All constructors of the original HashMap class
are provided as well.
No changes are made to the internal data structure or to any inherited methods.
| Nested Class Summary |
| Nested classes inherited from class java.util.HashMap |
|
| Nested classes inherited from class java.util.AbstractMap |
|
| Field Summary |
| Fields inherited from class java.util.HashMap |
|
| Fields inherited from class java.util.AbstractMap |
|
| Constructor Summary | |
QuickHashMap()
A constructor that delegates to class HashMap. |
|
QuickHashMap(int initialCapacity)
A constructor that delegates to class HashMap. |
|
QuickHashMap(int initialCapacity,
float loadFactor)
A constructor that delegates to class HashMap. |
|
QuickHashMap(Map m)
A constructor that delegates to class HashMap. |
|
QuickHashMap(Object[][] pairs)
Constructor that adds the given 2-dimensional array of key-value pairs one-by-one to the hash map. |
|
| Method Summary | |
void |
putPairs(Object[][] pairs)
Method that adds the given 2-dimensional array of key-value pairs one-by-one to the hash map. |
void |
putPairsSymmetric(Object[][] pairs)
Method that adds the given 2-dimensional array of key-value pairs one-by-one symmetrically to the hash map. |
void |
putSymmetric(Object key,
Object value)
Method that adds the key-value pair symmetrically to the hash map, that is, the key maps to the value and the value maps to the key. |
void |
removeKeys(Object[] keys)
Method that removes the given array of keys one-by-one from the hash map. |
void |
setPairs(Object[][] pairs)
Method that first clears this hash map of any existing pairs and then adds the given array of pairs one-by-one to the hash map. |
void |
setPairsSymmetric(Object[][] pairs)
Method that first clears this hash map of any existing pairs and then adds the given array of pairs one-by-one symmetrically to the hash map. |
| 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 |
public QuickHashMap()
HashMap.
public QuickHashMap(int initialCapacity)
HashMap.
public QuickHashMap(int initialCapacity,
float loadFactor)
HashMap.
public QuickHashMap(Map m)
HashMap.
public QuickHashMap(Object[][] pairs)
Constructor that adds the given 2-dimensional array of key-value pairs one-by-one to the hash map.
The capacity is set either to 10 or to 1.5 times the length of the
array pairs whichever is larger.
The load factor is set to the default of 0.75.
pairs - the array of pairs to add to this hash mapputPairs(Object[][])| Method Detail |
public void putPairs(Object[][] pairs)
Method that adds the given 2-dimensional array of key-value pairs one-by-one to the hash map.
If pairs is null, then does nothing.
Ignores any subarray pairs[i] that is null
or not of length 2.
pairs - the array of pairs to add to this hash mapQuickHashMap(Object[][]),
setPairs(Object[][]),
removeKeys(Object[]),
putSymmetric(Object, Object),
putPairsSymmetric(Object[][]),
setPairsSymmetric(Object[][])public void setPairs(Object[][] pairs)
Method that first clears this hash map of any existing pairs and then adds the given array of pairs one-by-one to the hash map.
If pairs is null, then this method
is equivalent to the inherited method clear.
Ignores any subarray pairs[i] that is null
or not of length 2.
pairs - the array of pairs to add to this hash map after clearanceputPairs(Object[][]),
removeKeys(Object[]),
putSymmetric(Object, Object),
putPairsSymmetric(Object[][]),
setPairsSymmetric(Object[][])public void removeKeys(Object[] keys)
Method that removes the given array of keys one-by-one from the hash map.
If keys is null, then does nothing.
keys - the array of keys to remove from this hash mapputPairs(Object[][]),
setPairs(Object[][]),
putSymmetric(Object, Object),
putPairsSymmetric(Object[][]),
setPairsSymmetric(Object[][])
public void putSymmetric(Object key,
Object value)
Method that adds the key-value pair symmetrically to the hash map, that is, the key maps to the value and the value maps to the key.
key - the key in the key-value pairvalue - the value in the key-value pairputPairs(Object[][]),
setPairs(Object[][]),
removeKeys(Object[]),
putPairsSymmetric(Object[][]),
setPairsSymmetric(Object[][])public void putPairsSymmetric(Object[][] pairs)
Method that adds the given 2-dimensional array of key-value pairs one-by-one symmetrically to the hash map.
If pairs is null, then does nothing.
Ignores any subarray pairs[i] that is null
or not of length 2.
pairs - the array of pairs to add symmetrically to this hash mapputPairs(Object[][]),
setPairs(Object[][]),
removeKeys(Object[]),
putSymmetric(Object, Object),
setPairsSymmetric(Object[][])public void setPairsSymmetric(Object[][] pairs)
Method that first clears this hash map of any existing pairs and then adds the given array of pairs one-by-one symmetrically to the hash map.
If pairs is null, then this method
is equivalent to the inherited method clear.
Ignores any subarray pairs[i] that is null
or not of length 2.
pairs - the array of pairs to add symmetrically to this hash map
after clearanceputPairs(Object[][]),
setPairs(Object[][]),
removeKeys(Object[]),
putSymmetric(Object, Object),
putPairsSymmetric(Object[][])
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||