|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.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.Map
public void clear()
clear
in interface java.util.Map
public java.lang.Object clone()
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
public java.util.Set entrySet()
entrySet
in interface java.util.Map
public java.util.Map.Entry lowerEntry(java.lang.Object key)
NavigableMap
lowerEntry
in interface NavigableMap
key
- the key
public java.lang.Object lowerKey(java.lang.Object key)
NavigableMap
lowerKey
in interface NavigableMap
key
- the key
public java.util.Map.Entry floorEntry(java.lang.Object key)
NavigableMap
floorEntry
in interface NavigableMap
key
- the key
public java.lang.Object floorKey(java.lang.Object key)
NavigableMap
floorKey
in interface NavigableMap
key
- the key
public java.util.Map.Entry ceilingEntry(java.lang.Object key)
NavigableMap
ceilingEntry
in interface NavigableMap
key
- the key
public java.lang.Object ceilingKey(java.lang.Object key)
NavigableMap
ceilingKey
in interface NavigableMap
key
- the key
public java.util.Map.Entry higherEntry(java.lang.Object key)
NavigableMap
higherEntry
in interface NavigableMap
key
- the key
public java.lang.Object higherKey(java.lang.Object key)
NavigableMap
higherKey
in interface NavigableMap
key
- the key
public java.util.Map.Entry firstEntry()
NavigableMap
firstEntry
in interface NavigableMap
public java.util.Map.Entry lastEntry()
NavigableMap
lastEntry
in interface NavigableMap
public java.util.Map.Entry pollFirstEntry()
NavigableMap
pollFirstEntry
in interface NavigableMap
public java.util.Map.Entry pollLastEntry()
NavigableMap
pollLastEntry
in interface NavigableMap
public NavigableMap descendingMap()
NavigableMap
The returned map has an ordering equivalent to
Collections.reverseOrder
(comparator()).
The expression returns a
view of essentially equivalent to .
descendingMap
in interface NavigableMap
public NavigableSet descendingKeySet()
NavigableMap
NavigableSet
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)
NavigableMap
Equivalent to .
subMap
in interface NavigableMap
public java.util.SortedMap headMap(java.lang.Object toKey)
NavigableMap
Equivalent to .
headMap
in interface NavigableMap
public java.util.SortedMap tailMap(java.lang.Object fromKey)
NavigableMap
Equivalent to .
tailMap
in interface NavigableMap
public NavigableMap subMap(java.lang.Object fromKey, boolean fromInclusive, java.lang.Object toKey, boolean toInclusive)
NavigableMap
The 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 NavigableMap
fromKey
- 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)
NavigableMap
The returned map will throw an on an attempt to insert a key outside its range.
headMap
in interface NavigableMap
toKey
- 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)
NavigableMap
The returned map will throw an on an attempt to insert a key outside its range.
tailMap
in interface NavigableMap
fromKey
- 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.SortedMap
public java.lang.Object firstKey()
firstKey
in interface java.util.SortedMap
public java.lang.Object lastKey()
lastKey
in interface java.util.SortedMap
public boolean isEmpty()
isEmpty
in interface java.util.Map
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
public void putAll(java.util.Map map)
putAll
in interface java.util.Map
public java.util.Set keySet()
AbstractMap
keySet
in interface java.util.Map
keySet
in class AbstractMap
public NavigableSet navigableKeySet()
NavigableMap
NavigableSet
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 |