|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap
org.compass.core.util.backport.java.util.AbstractMap
org.compass.core.util.backport.java.util.TreeMap
public class TreeMap
Sorted map implementation based on a red-black tree and implementing all the methods from the NavigableMap interface.
| Nested Class Summary | |
|---|---|
(package private) class |
TreeMap.DescendingEntryIterator
|
(package private) class |
TreeMap.DescendingEntrySet
|
(package private) class |
TreeMap.DescendingKeyIterator
|
(package private) class |
TreeMap.DescendingKeySet
|
(package private) class |
TreeMap.DescendingValueIterator
|
static class |
TreeMap.Entry
|
(package private) class |
TreeMap.EntryIterator
|
(package private) class |
TreeMap.EntrySet
|
(package private) static class |
TreeMap.IOIterator
|
(package private) static class |
TreeMap.IteratorIOException
|
(package private) static class |
TreeMap.IteratorNoClassException
|
(package private) class |
TreeMap.KeyIterator
|
(package private) class |
TreeMap.KeySet
|
(package private) class |
TreeMap.SubDescendingEntryIterator
|
(package private) class |
TreeMap.SubEntryIterator
|
(package private) class |
TreeMap.ValueIterator
|
(package private) class |
TreeMap.ValueSet
|
| Nested classes/interfaces inherited from class org.compass.core.util.backport.java.util.AbstractMap |
|---|
AbstractMap.SimpleEntry, AbstractMap.SimpleImmutableEntry |
| Field Summary |
|---|
| Fields inherited from class org.compass.core.util.backport.java.util.AbstractMap |
|---|
keySet |
| Constructor Summary | |
|---|---|
TreeMap()
|
|
TreeMap(Comparator comparator)
|
|
TreeMap(Map map)
|
|
TreeMap(SortedMap map)
|
|
| Method Summary | |
|---|---|
(package private) void |
buildFromSorted(Iterator itr,
int size)
|
Map.Entry |
ceilingEntry(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. |
Object |
ceilingKey(Object key)
Returns the least key greater than or equal to the given key, or null if there is no such key. |
void |
clear()
|
Object |
clone()
|
(package private) static boolean |
colorOf(TreeMap.Entry p)
Return color of node p, or BLACK if p is null (In the CLR version, they use a special dummy `nil' node for such purposes, but that doesn't work well here, since it could lead to creating one such special node per real node.) |
Comparator |
comparator()
|
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object value)
|
Set |
descendingEntrySet()
Returns a Set view of the mappings contained in this map. |
Set |
descendingKeySet()
Returns a Set view of the keys contained in this map. |
Set |
entrySet()
|
Map.Entry |
firstEntry()
Returns a key-value mapping associated with the least key in this map, or null if the map is empty. |
Object |
firstKey()
|
Map.Entry |
floorEntry(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. |
Object |
floorKey(Object key)
Returns the greatest key less than or equal to the given key, or null if there is no such key. |
Object |
get(Object key)
|
SortedMap |
headMap(Object toKey)
|
Map.Entry |
higherEntry(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. |
Object |
higherKey(Object key)
Returns the least key strictly greater than the given key, or null if there is no such key. |
boolean |
isEmpty()
|
Map.Entry |
lastEntry()
Returns a key-value mapping associated with the greatest key in this map, or null if the map is empty. |
Object |
lastKey()
|
Map.Entry |
lowerEntry(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. |
Object |
lowerKey(Object key)
Returns the greatest key strictly less than the given key, or null if there is no such key. |
NavigableMap |
navigableHeadMap(Object toKey)
Returns a view of the portion of this map whose keys are strictly less than toKey. |
NavigableMap |
navigableSubMap(Object fromKey,
Object toKey)
Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive. |
NavigableMap |
navigableTailMap(Object fromKey)
Returns a view of the portion of this map whose keys are greater than or equal to fromKey. |
(package private) static TreeMap.Entry |
parentOf(TreeMap.Entry p)
return parent of node p, or null if p is null |
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. |
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. |
Object |
put(Object key,
Object value)
|
void |
putAll(Map map)
|
Object |
remove(Object key)
|
int |
size()
|
SortedMap |
subMap(Object fromKey,
Object toKey)
|
SortedMap |
tailMap(Object fromKey)
|
| Methods inherited from class org.compass.core.util.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(Comparator comparator)
public TreeMap(SortedMap map)
public TreeMap(Map map)
| Method Detail |
|---|
public int size()
size in interface Mapsize in class AbstractMappublic void clear()
clear in interface Mapclear in class AbstractMappublic Object clone()
clone in class AbstractMap
public Object put(Object key,
Object value)
put in interface Mapput in class AbstractMappublic Object get(Object key)
get in interface Mapget in class AbstractMappublic boolean containsKey(Object key)
containsKey in interface MapcontainsKey in class AbstractMappublic Set entrySet()
entrySet in interface MapentrySet in class AbstractMap
void buildFromSorted(Iterator itr,
int size)
static boolean colorOf(TreeMap.Entry p)
static TreeMap.Entry parentOf(TreeMap.Entry p)
public Map.Entry lowerEntry(Object key)
NavigableMap
lowerEntry in interface NavigableMapkey - the key
public Object lowerKey(Object key)
NavigableMap
lowerKey in interface NavigableMapkey - the key
public Map.Entry floorEntry(Object key)
NavigableMap
floorEntry in interface NavigableMapkey - the key
public Object floorKey(Object key)
NavigableMap
floorKey in interface NavigableMapkey - the key
public Map.Entry ceilingEntry(Object key)
NavigableMap
ceilingEntry in interface NavigableMapkey - the key
public Object ceilingKey(Object key)
NavigableMap
ceilingKey in interface NavigableMapkey - the key
public Map.Entry higherEntry(Object key)
NavigableMap
higherEntry in interface NavigableMapkey - the key
public Object higherKey(Object key)
NavigableMap
higherKey in interface NavigableMapkey - the key
public Map.Entry firstEntry()
NavigableMap
firstEntry in interface NavigableMappublic Map.Entry lastEntry()
NavigableMap
lastEntry in interface NavigableMappublic Map.Entry pollFirstEntry()
NavigableMap
pollFirstEntry in interface NavigableMappublic Map.Entry pollLastEntry()
NavigableMap
pollLastEntry in interface NavigableMappublic Set descendingKeySet()
NavigableMapSet 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 NavigableMappublic Set descendingEntrySet()
NavigableMapSet 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(Object fromKey,
Object toKey)
NavigableMapThe returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.
navigableSubMap in interface NavigableMapfromKey - low endpoint (inclusive) of the keys in the returned maptoKey - high endpoint (exclusive) of the keys in the returned map
public NavigableMap navigableHeadMap(Object toKey)
NavigableMapThe returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.
navigableHeadMap in interface NavigableMaptoKey - high endpoint (exclusive) of the keys in the returned map
public NavigableMap navigableTailMap(Object fromKey)
NavigableMapThe returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.
navigableTailMap in interface NavigableMapfromKey - low endpoint (inclusive) of the keys in the returned map
public Comparator comparator()
comparator in interface SortedMap
public SortedMap subMap(Object fromKey,
Object toKey)
subMap in interface SortedMappublic SortedMap headMap(Object toKey)
headMap in interface SortedMappublic SortedMap tailMap(Object fromKey)
tailMap in interface SortedMappublic Object firstKey()
firstKey in interface SortedMappublic Object lastKey()
lastKey in interface SortedMappublic boolean isEmpty()
isEmpty in interface MapisEmpty in class AbstractMappublic boolean containsValue(Object value)
containsValue in interface MapcontainsValue in class AbstractMappublic Object remove(Object key)
remove in interface Mapremove in class AbstractMappublic void putAll(Map map)
putAll in interface MapputAll in class AbstractMap
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||