|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap
java.util.TreeMap
edu.neu.ccs.quick.QuickTreeMap
QuickTreeMap extends TreeMap by
adding two constructors 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. Valid use of these symmetric methods requires that keys and values be comparable.
All constructors of the original TreeMap class
are provided as well.
The only inherited methods that are overridden are those that
will throw an exception on null arguments. In this
class, such methods will handle null in a sensible
fashion.
| Nested Class Summary |
| Nested classes inherited from class java.util.TreeMap |
|
| Nested classes inherited from class java.util.AbstractMap |
|
| Field Summary |
| Fields inherited from class java.util.TreeMap |
|
| Fields inherited from class java.util.AbstractMap |
|
| Constructor Summary | |
QuickTreeMap()
A constructor that delegates to class TreeMap. |
|
QuickTreeMap(Comparator c)
A constructor that delegates to class TreeMap. |
|
QuickTreeMap(Comparator c,
Object[][] pairs)
Constructor that sets the Comparator and then adds the
given 2-dimensional array of key-value pairs one-by-one to the tree map. |
|
QuickTreeMap(Map m)
A constructor that delegates to class TreeMap. |
|
QuickTreeMap(Object[][] pairs)
Constructor that adds the given 2-dimensional array of key-value pairs one-by-one to the tree map. |
|
QuickTreeMap(SortedMap m)
A constructor that delegates to class TreeMap. |
|
| Method Summary | |
boolean |
containsKey(Object key)
Returns true if the map contains the key. |
Object |
get(Object key)
Returns the value to which the map maps the specified key. |
SortedMap |
headMap(Object key)
Returns a view of the portion of this map whose keys are strictly less than the key. |
Object |
put(Object key,
Object value)
Associates the specified value with the specified key in this map. |
void |
putPairs(Object[][] pairs)
Method that adds the given 2-dimensional array of key-value pairs one-by-one to the tree map. |
void |
putPairsSymmetric(Object[][] pairs)
Method that adds the given 2-dimensional array of key-value pairs one-by-one symmetrically to the tree map. |
void |
putSymmetric(Object key,
Object value)
Method that adds the key-value pair symmetrically to the tree map, that is, the key maps to the value and the value maps to the key. |
Object |
remove(Object key)
Removes the mapping for this key from this map if present. |
void |
removeKeys(Object[] keys)
Method that removes the given array of keys one-by-one from the tree map. |
void |
setPairs(Object[][] pairs)
Method that first clears this tree map of any existing pairs and then adds the given array of pairs one-by-one to the tree map. |
void |
setPairsSymmetric(Object[][] pairs)
Method that first clears this tree map of any existing pairs and then adds the given array of pairs one-by-one symmetrically to the tree map. |
SortedMap |
subMap(Object lower,
Object upper)
Returns a view of the portion of this map whose keys are greater than or equal to lower and strictly less than upper. |
SortedMap |
tailMap(Object key)
Returns a view of the portion of this map whose keys are greater than or equal to the key. |
| Methods inherited from class java.util.TreeMap |
clear, clone, comparator, containsValue, entrySet, firstKey, keySet, lastKey, putAll, size, values |
| Methods inherited from class java.util.AbstractMap |
equals, hashCode, isEmpty, toString |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
equals, hashCode, isEmpty |
| Constructor Detail |
public QuickTreeMap()
TreeMap.
public QuickTreeMap(Comparator c)
TreeMap.
public QuickTreeMap(Map m)
TreeMap.
public QuickTreeMap(SortedMap m)
TreeMap.
public QuickTreeMap(Object[][] pairs)
Constructor that adds the given 2-dimensional array of key-value pairs one-by-one to the tree map.
pairs - the array of pairs to add to this tree mapQuickTreeMap(Comparator, Object[][]),
putPairs(Object[][])
public QuickTreeMap(Comparator c,
Object[][] pairs)
Constructor that sets the Comparator and then adds the
given 2-dimensional array of key-value pairs one-by-one to the tree map.
c - the comparatorpairs - the array of pairs to add to this tree mapQuickTreeMap(Object[][]),
putPairs(Object[][])| Method Detail |
public Object put(Object key,
Object value)
Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced.
If the key is null, then simply returns
null.
key - the key associated with the specified valuevalue - the value to be associated with the specified key
TreeMap.put(Object, Object)public Object get(Object key)
Returns the value to which the map maps the specified key.
Returns null if the map contains no mapping for
the key. A return value of null does not
necessarily indicate that the map contains no mapping for the
key. It is also possible that the map explicitly maps the key
to null. The containsKey operation
may be used to distinguish these two cases.
If the key is null, then simply returns
null.
key - the key whose associated value is to be returned
TreeMap.get(Object)public Object remove(Object key)
Removes the mapping for this key from this map if present.
If the key is null, then simply returns
null.
key - the key whose mapping should be removed
TreeMap.remove(Object)public boolean containsKey(Object key)
Returns true if the map contains the key.
If the key is null, then simply returns
false.
key - the key whose presence in the map is to be tested
TreeMap.containsKey(Object)public SortedMap headMap(Object key)
Returns a view of the portion of this map whose keys are strictly less than the key. The returned sorted map is backed by this map, so changes in the returned sorted map are reflected in this map, and vice-versa.
The sorted map returned by this method will throw an
IllegalArgumentException if the user attempts to insert a
key greater than or equal to the given key.
If key is null, then simply returns null.
key - the strict upper bound for the keys in the returned map
TreeMap.headMap(Object)public SortedMap tailMap(Object key)
Returns a view of the portion of this map whose keys are greater than or equal to the key. The returned sorted map is backed by this map, so changes in the returned sorted map are reflected in this map, and vice-versa.
The sorted map returned by this method will throw an
IllegalArgumentException if the user attempts to insert a
key less than the given element.
If key is null, then simply returns null.
key - the lower bound for the keys in the returned map
TreeMap.tailMap(Object)
public SortedMap subMap(Object lower,
Object upper)
Returns a view of the portion of this map whose keys are greater than or equal to lower and strictly less than upper. The returned sorted map is backed by this map, so changes in the returned sorted map are reflected in this map, and vice-versa.
The sorted map returned by this method will throw an
IllegalArgumentException if the user attempts to insert
a key less than lower or greater than or equal to upper.
If either lower or upper is null, then simply returns
null.
lower - the lower bound for the keys in the returned mapupper - the strict upper bound for the keys in the returned map
TreeMap.subMap(Object, Object)public void putPairs(Object[][] pairs)
Method that adds the given 2-dimensional array of key-value pairs one-by-one to the tree map.
If pairs is null, then does nothing.
Ignores any subarray pairs[i] that is null
or not of length 2.
Ignores key-value pairs in which the key is null.
pairs - the array of pairs to add to this tree mapQuickTreeMap(Object[][]),
QuickTreeMap(Comparator, Object[][]),
setPairs(Object[][]),
removeKeys(Object[]),
putSymmetric(Object, Object),
putPairsSymmetric(Object[][]),
setPairsSymmetric(Object[][])public void setPairs(Object[][] pairs)
Method that first clears this tree map of any existing pairs and then adds the given array of pairs one-by-one to the tree 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.
Ignores key-value pairs in which the key is null.
pairs - the array of pairs to add to this tree 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 tree map.
If keys is null, then does nothing.
Ignores key items that are null.
keys - the array of keys to remove from this tree 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 tree map, that is, the key maps to the value and the value maps to the key.
Does nothing if either the key or the value is null.
Valid use of this method requires that keys and values be comparable.
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 tree map.
If pairs is null, then does nothing.
Ignores any subarray pairs[i] that is null
or not of length 2.
Ignores key-value pairs in which either item is null.
Valid use of this method requires that keys and values be comparable.
pairs - the array of pairs to add symmetrically to this tree mapputPairs(Object[][]),
setPairs(Object[][]),
removeKeys(Object[]),
putSymmetric(Object, Object),
setPairsSymmetric(Object[][])public void setPairsSymmetric(Object[][] pairs)
Method that first clears this tree map of any existing pairs and then adds the given array of pairs one-by-one symmetrically to the tree 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.
Ignores key-value pairs in which either item is null.
Valid use of this method requires that keys and values be comparable.
pairs - the array of pairs to add symmetrically to this tree 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 | |||||||||