|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap
edu.emory.mathcs.backport.java.util.AbstractMap
edu.emory.mathcs.backport.java.util.TreeMap
Sorted map implementation based on a red-black tree and implementing all the methods from the NavigableMap interface.
| Nested Class Summary | |
static class |
TreeMap.Entry
|
| Nested classes inherited from class edu.emory.mathcs.backport.java.util.AbstractMap |
AbstractMap.SimpleEntry, AbstractMap.SimpleImmutableEntry |
| Constructor Summary | |
TreeMap()
|
|
TreeMap(java.util.Comparator comparator)
|
|
TreeMap(java.util.Map map)
|
|
TreeMap(java.util.SortedMap map)
|
|
| Method Summary | |
java.util.Map.Entry |
ceilingEntry(java.lang.Object key)
Returns a key-value mapping associated with the least key greater than or equal to the given key, or if there is no such key. |
java.lang.Object |
ceilingKey(java.lang.Object key)
Returns the least key greater than or equal to the given key, or if there is no such key. |
void |
clear()
|
java.lang.Object |
clone()
|
java.util.Comparator |
comparator()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
NavigableSet |
descendingKeySet()
Returns a reverse order NavigableSet view of the keys contained in this map. |
NavigableMap |
descendingMap()
Returns a reverse order view of the mappings contained in this map. |
java.util.Set |
entrySet()
|
java.util.Map.Entry |
firstEntry()
Returns a key-value mapping associated with the least key in this map, or if the map is empty. |
java.lang.Object |
firstKey()
|
java.util.Map.Entry |
floorEntry(java.lang.Object key)
Returns a key-value mapping associated with the greatest key less than or equal to the given key, or if there is no such key. |
java.lang.Object |
floorKey(java.lang.Object key)
Returns the greatest key less than or equal to the given key, or if there is no such key. |
java.lang.Object |
get(java.lang.Object key)
|
java.util.SortedMap |
headMap(java.lang.Object toKey)
Equivalent to . |
NavigableMap |
headMap(java.lang.Object toKey,
boolean toInclusive)
Returns a view of the portion of this map whose keys are less than (or equal to, if is true) . |
java.util.Map.Entry |
higherEntry(java.lang.Object key)
Returns a key-value mapping associated with the least key strictly greater than the given key, or if there is no such key. |
java.lang.Object |
higherKey(java.lang.Object key)
Returns the least key strictly greater than the given key, or if there is no such key. |
boolean |
isEmpty()
|
java.util.Set |
keySet()
|
java.util.Map.Entry |
lastEntry()
Returns a key-value mapping associated with the greatest key in this map, or if the map is empty. |
java.lang.Object |
lastKey()
|
java.util.Map.Entry |
lowerEntry(java.lang.Object key)
Returns a key-value mapping associated with the greatest key strictly less than the given key, or if there is no such key. |
java.lang.Object |
lowerKey(java.lang.Object key)
Returns the greatest key strictly less than the given key, or if there is no such key. |
NavigableSet |
navigableKeySet()
Returns a NavigableSet view of the keys contained in this map. |
java.util.Map.Entry |
pollFirstEntry()
Removes and returns a key-value mapping associated with the least key in this map, or if the map is empty. |
java.util.Map.Entry |
pollLastEntry()
Removes and returns a key-value mapping associated with the greatest key in this map, or if the map is empty. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
void |
putAll(java.util.Map map)
|
java.lang.Object |
remove(java.lang.Object key)
|
int |
size()
|
NavigableMap |
subMap(java.lang.Object fromKey,
boolean fromInclusive,
java.lang.Object toKey,
boolean toInclusive)
Returns a view of the portion of this map whose keys range from to . |
java.util.SortedMap |
subMap(java.lang.Object fromKey,
java.lang.Object toKey)
Equivalent to . |
java.util.SortedMap |
tailMap(java.lang.Object fromKey)
Equivalent to . |
NavigableMap |
tailMap(java.lang.Object fromKey,
boolean fromInclusive)
Returns a view of the portion of this map whose keys are greater than (or equal to, if is true) . |
| Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString, values |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
equals, hashCode, values |
| Constructor Detail |
public TreeMap()
public TreeMap(java.util.Comparator comparator)
public TreeMap(java.util.SortedMap map)
public TreeMap(java.util.Map map)
| Method Detail |
public int size()
size in interface java.util.Mappublic void clear()
clear in interface java.util.Mappublic java.lang.Object clone()
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
put in interface java.util.Mappublic java.lang.Object get(java.lang.Object key)
get in interface java.util.Mappublic boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Mappublic java.util.Set entrySet()
entrySet in interface java.util.Mappublic java.util.Map.Entry lowerEntry(java.lang.Object key)
NavigableMap
lowerEntry in interface NavigableMapkey - the key
public java.lang.Object lowerKey(java.lang.Object key)
NavigableMap
lowerKey in interface NavigableMapkey - the key
public java.util.Map.Entry floorEntry(java.lang.Object key)
NavigableMap
floorEntry in interface NavigableMapkey - the key
public java.lang.Object floorKey(java.lang.Object key)
NavigableMap
floorKey in interface NavigableMapkey - the key
public java.util.Map.Entry ceilingEntry(java.lang.Object key)
NavigableMap
ceilingEntry in interface NavigableMapkey - the key
public java.lang.Object ceilingKey(java.lang.Object key)
NavigableMap
ceilingKey in interface NavigableMapkey - the key
public java.util.Map.Entry higherEntry(java.lang.Object key)
NavigableMap
higherEntry in interface NavigableMapkey - the key
public java.lang.Object higherKey(java.lang.Object key)
NavigableMap
higherKey in interface NavigableMapkey - the key
public java.util.Map.Entry firstEntry()
NavigableMap
firstEntry in interface NavigableMappublic java.util.Map.Entry lastEntry()
NavigableMap
lastEntry in interface NavigableMappublic java.util.Map.Entry pollFirstEntry()
NavigableMap
pollFirstEntry in interface NavigableMappublic java.util.Map.Entry pollLastEntry()
NavigableMap
pollLastEntry in interface NavigableMappublic NavigableMap descendingMap()
NavigableMapThe returned map has an ordering equivalent to
Collections.reverseOrder(comparator()).
The expression returns a
view of essentially equivalent to .
descendingMap in interface NavigableMappublic NavigableSet descendingKeySet()
NavigableMapNavigableSet view of the keys contained in this map.
The set's iterator returns the keys in descending order.
The set is backed by the map, so changes to the map are reflected in
the set, and vice-versa. If the map is modified while an iteration
over the set is in progress (except through the iterator's own operation), the results of the iteration are undefined. The
set supports element removal, which removes the corresponding mapping
from the map, via the , ,
, , and operations.
It does not support the or operations.
descendingKeySet in interface NavigableMap
public java.util.SortedMap subMap(java.lang.Object fromKey,
java.lang.Object toKey)
NavigableMapEquivalent to .
subMap in interface NavigableMappublic java.util.SortedMap headMap(java.lang.Object toKey)
NavigableMapEquivalent to .
headMap in interface NavigableMappublic java.util.SortedMap tailMap(java.lang.Object fromKey)
NavigableMapEquivalent to .
tailMap in interface NavigableMap
public NavigableMap subMap(java.lang.Object fromKey,
boolean fromInclusive,
java.lang.Object toKey,
boolean toInclusive)
NavigableMapThe returned map will throw an on an attempt to insert a key outside of its range, or to construct a submap either of whose endpoints lie outside its range.
subMap in interface NavigableMapfromKey - low endpoint of the keys in the returned mapfromInclusive - if the low endpoint
is to be included in the returned viewtoKey - high endpoint of the keys in the returned maptoInclusive - if the high endpoint
is to be included in the returned view
public NavigableMap headMap(java.lang.Object toKey,
boolean toInclusive)
NavigableMapThe returned map will throw an on an attempt to insert a key outside its range.
headMap in interface NavigableMaptoKey - high endpoint of the keys in the returned maptoInclusive - if the high endpoint
is to be included in the returned view
public NavigableMap tailMap(java.lang.Object fromKey,
boolean fromInclusive)
NavigableMapThe returned map will throw an on an attempt to insert a key outside its range.
tailMap in interface NavigableMapfromKey - low endpoint of the keys in the returned mapfromInclusive - if the low endpoint
is to be included in the returned view
public java.util.Comparator comparator()
comparator in interface java.util.SortedMappublic java.lang.Object firstKey()
firstKey in interface java.util.SortedMappublic java.lang.Object lastKey()
lastKey in interface java.util.SortedMappublic boolean isEmpty()
isEmpty in interface java.util.Mappublic boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Mappublic java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mappublic void putAll(java.util.Map map)
putAll in interface java.util.Mappublic java.util.Set keySet()
AbstractMap
keySet in interface java.util.MapkeySet in class AbstractMappublic NavigableSet navigableKeySet()
NavigableMapNavigableSet view of the keys contained in this map.
The set's iterator returns the keys in ascending order.
The set is backed by the map, so changes to the map are reflected in
the set, and vice-versa. If the map is modified while an iteration
over the set is in progress (except through the iterator's own operation), the results of the iteration are undefined. The
set supports element removal, which removes the corresponding mapping
from the map, via the , ,
, , and operations.
It does not support the or operations.
navigableKeySet in interface NavigableMap
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||