|
|||||||||||
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 null 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 null 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)
|
java.util.Set |
descendingEntrySet()
Returns a Set view of the mappings contained in this map. |
java.util.Set |
descendingKeySet()
Returns a Set view of the keys 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 null 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 null 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 null if there is no such key. |
java.lang.Object |
get(java.lang.Object key)
|
java.util.SortedMap |
headMap(java.lang.Object toKey)
|
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 null 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 null if there is no such key. |
boolean |
isEmpty()
|
java.util.Map.Entry |
lastEntry()
Returns a key-value mapping associated with the greatest key in this map, or null 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 null 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 null if there is no such key. |
NavigableMap |
navigableHeadMap(java.lang.Object toKey)
Returns a view of the portion of this map whose keys are strictly less than toKey. |
NavigableMap |
navigableSubMap(java.lang.Object fromKey,
java.lang.Object toKey)
Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive. |
NavigableMap |
navigableTailMap(java.lang.Object fromKey)
Returns a view of the portion of this map whose keys are greater than or equal to fromKey. |
java.util.Map.Entry |
pollFirstEntry()
Removes and returns a key-value mapping associated with the least key in this map, or null 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 null 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()
|
java.util.SortedMap |
subMap(java.lang.Object fromKey,
java.lang.Object toKey)
|
java.util.SortedMap |
tailMap(java.lang.Object fromKey)
|
Methods inherited from class edu.emory.mathcs.backport.java.util.AbstractMap |
---|
keySet |
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, keySet, 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 java.util.Set descendingKeySet()
NavigableMap
Set
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 remove operation), the results of
the iteration are undefined. The set supports element removal,
which removes the corresponding mapping from the map, via the
Iterator.remove, Set.remove,
removeAll, retainAll, and clear
operations. It does not support the add or addAll
operations.
descendingKeySet
in interface NavigableMap
public java.util.Set descendingEntrySet()
NavigableMap
Set
view of the mappings contained in this map.
The set's iterator returns the entries in descending key 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 remove operation, or through the
setValue operation on a map entry returned by the
iterator) the results of the iteration are undefined. The set
supports element removal, which removes the corresponding
mapping from the map, via the Iterator.remove,
Set.remove, removeAll, retainAll and
clear operations. It does not support the
add or addAll operations.
descendingEntrySet
in interface NavigableMap
public NavigableMap navigableSubMap(java.lang.Object fromKey, java.lang.Object toKey)
NavigableMap
The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.
navigableSubMap
in interface NavigableMap
fromKey
- low endpoint (inclusive) of the keys in the returned maptoKey
- high endpoint (exclusive) of the keys in the returned map
public NavigableMap navigableHeadMap(java.lang.Object toKey)
NavigableMap
The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.
navigableHeadMap
in interface NavigableMap
toKey
- high endpoint (exclusive) of the keys in the returned map
public NavigableMap navigableTailMap(java.lang.Object fromKey)
NavigableMap
The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.
navigableTailMap
in interface NavigableMap
fromKey
- low endpoint (inclusive) of the keys in the returned map
public java.util.Comparator comparator()
comparator
in interface java.util.SortedMap
public java.util.SortedMap subMap(java.lang.Object fromKey, java.lang.Object toKey)
subMap
in interface java.util.SortedMap
public java.util.SortedMap headMap(java.lang.Object toKey)
headMap
in interface java.util.SortedMap
public java.util.SortedMap tailMap(java.lang.Object fromKey)
tailMap
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
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |