TreeMap (Java Platform SE 7 ) (original) (raw)
Modifier and Type
Method and Description
[Map.Entry](../../java/util/Map.Entry.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap"),[V](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[ceilingEntry](../../java/util/TreeMap.html#ceilingEntry%28K%29)**([K](../../java/util/TreeMap.html "type parameter in TreeMap") 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.
[K](../../java/util/TreeMap.html "type parameter in TreeMap")
**[ceilingKey](../../java/util/TreeMap.html#ceilingKey%28K%29)**([K](../../java/util/TreeMap.html "type parameter in TreeMap") key)
Returns the least key greater than or equal to the given key, or null
if there is no such key.
void
**[clear](../../java/util/TreeMap.html#clear%28%29)**()
Removes all of the mappings from this map.
[Object](../../java/lang/Object.html "class in java.lang")
**[clone](../../java/util/TreeMap.html#clone%28%29)**()
Returns a shallow copy of this TreeMap
instance.
[Comparator](../../java/util/Comparator.html "interface in java.util")<? super [K](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[comparator](../../java/util/TreeMap.html#comparator%28%29)**()
Returns the comparator used to order the keys in this map, ornull
if this map uses the natural ordering of its keys.
boolean
**[containsKey](../../java/util/TreeMap.html#containsKey%28java.lang.Object%29)**([Object](../../java/lang/Object.html "class in java.lang") key)
Returns true
if this map contains a mapping for the specified key.
boolean
**[containsValue](../../java/util/TreeMap.html#containsValue%28java.lang.Object%29)**([Object](../../java/lang/Object.html "class in java.lang") value)
Returns true
if this map maps one or more keys to the specified value.
[NavigableSet](../../java/util/NavigableSet.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[descendingKeySet](../../java/util/TreeMap.html#descendingKeySet%28%29)**()
Returns a reverse order NavigableSet view of the keys contained in this map.
[NavigableMap](../../java/util/NavigableMap.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap"),[V](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[descendingMap](../../java/util/TreeMap.html#descendingMap%28%29)**()
Returns a reverse order view of the mappings contained in this map.
[Set](../../java/util/Set.html "interface in java.util")<[Map.Entry](../../java/util/Map.Entry.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap"),[V](../../java/util/TreeMap.html "type parameter in TreeMap")>>
**[entrySet](../../java/util/TreeMap.html#entrySet%28%29)**()
Returns a Set view of the mappings contained in this map.
[Map.Entry](../../java/util/Map.Entry.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap"),[V](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[firstEntry](../../java/util/TreeMap.html#firstEntry%28%29)**()
Returns a key-value mapping associated with the least key in this map, or null
if the map is empty.
[K](../../java/util/TreeMap.html "type parameter in TreeMap")
**[firstKey](../../java/util/TreeMap.html#firstKey%28%29)**()
Returns the first (lowest) key currently in this map.
[Map.Entry](../../java/util/Map.Entry.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap"),[V](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[floorEntry](../../java/util/TreeMap.html#floorEntry%28K%29)**([K](../../java/util/TreeMap.html "type parameter in TreeMap") 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.
[K](../../java/util/TreeMap.html "type parameter in TreeMap")
**[floorKey](../../java/util/TreeMap.html#floorKey%28K%29)**([K](../../java/util/TreeMap.html "type parameter in TreeMap") key)
Returns the greatest key less than or equal to the given key, or null
if there is no such key.
[V](../../java/util/TreeMap.html "type parameter in TreeMap")
**[get](../../java/util/TreeMap.html#get%28java.lang.Object%29)**([Object](../../java/lang/Object.html "class in java.lang") key)
Returns the value to which the specified key is mapped, or null
if this map contains no mapping for the key.
[SortedMap](../../java/util/SortedMap.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap"),[V](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[headMap](../../java/util/TreeMap.html#headMap%28K%29)**([K](../../java/util/TreeMap.html "type parameter in TreeMap") toKey)
Returns a view of the portion of this map whose keys are strictly less than toKey
.
[NavigableMap](../../java/util/NavigableMap.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap"),[V](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[headMap](../../java/util/TreeMap.html#headMap%28K,%20boolean%29)**([K](../../java/util/TreeMap.html "type parameter in TreeMap") toKey, boolean inclusive)
Returns a view of the portion of this map whose keys are less than (or equal to, if inclusive
is true) toKey
.
[Map.Entry](../../java/util/Map.Entry.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap"),[V](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[higherEntry](../../java/util/TreeMap.html#higherEntry%28K%29)**([K](../../java/util/TreeMap.html "type parameter in TreeMap") 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.
[K](../../java/util/TreeMap.html "type parameter in TreeMap")
**[higherKey](../../java/util/TreeMap.html#higherKey%28K%29)**([K](../../java/util/TreeMap.html "type parameter in TreeMap") key)
Returns the least key strictly greater than the given key, ornull
if there is no such key.
[Set](../../java/util/Set.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[keySet](../../java/util/TreeMap.html#keySet%28%29)**()
Returns a Set view of the keys contained in this map.
[Map.Entry](../../java/util/Map.Entry.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap"),[V](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[lastEntry](../../java/util/TreeMap.html#lastEntry%28%29)**()
Returns a key-value mapping associated with the greatest key in this map, or null
if the map is empty.
[K](../../java/util/TreeMap.html "type parameter in TreeMap")
**[lastKey](../../java/util/TreeMap.html#lastKey%28%29)**()
Returns the last (highest) key currently in this map.
[Map.Entry](../../java/util/Map.Entry.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap"),[V](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[lowerEntry](../../java/util/TreeMap.html#lowerEntry%28K%29)**([K](../../java/util/TreeMap.html "type parameter in TreeMap") 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.
[K](../../java/util/TreeMap.html "type parameter in TreeMap")
**[lowerKey](../../java/util/TreeMap.html#lowerKey%28K%29)**([K](../../java/util/TreeMap.html "type parameter in TreeMap") key)
Returns the greatest key strictly less than the given key, ornull
if there is no such key.
[NavigableSet](../../java/util/NavigableSet.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[navigableKeySet](../../java/util/TreeMap.html#navigableKeySet%28%29)**()
Returns a NavigableSet view of the keys contained in this map.
[Map.Entry](../../java/util/Map.Entry.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap"),[V](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[pollFirstEntry](../../java/util/TreeMap.html#pollFirstEntry%28%29)**()
Removes and returns a key-value mapping associated with the least key in this map, or null
if the map is empty.
[Map.Entry](../../java/util/Map.Entry.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap"),[V](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[pollLastEntry](../../java/util/TreeMap.html#pollLastEntry%28%29)**()
Removes and returns a key-value mapping associated with the greatest key in this map, or null
if the map is empty.
[V](../../java/util/TreeMap.html "type parameter in TreeMap")
**[put](../../java/util/TreeMap.html#put%28K,%20V%29)**([K](../../java/util/TreeMap.html "type parameter in TreeMap") key,[V](../../java/util/TreeMap.html "type parameter in TreeMap") value)
Associates the specified value with the specified key in this map.
void
**[putAll](../../java/util/TreeMap.html#putAll%28java.util.Map%29)**([Map](../../java/util/Map.html "interface in java.util")<? extends [K](../../java/util/TreeMap.html "type parameter in TreeMap"),? extends [V](../../java/util/TreeMap.html "type parameter in TreeMap")> map)
Copies all of the mappings from the specified map to this map.
[V](../../java/util/TreeMap.html "type parameter in TreeMap")
**[remove](../../java/util/TreeMap.html#remove%28java.lang.Object%29)**([Object](../../java/lang/Object.html "class in java.lang") key)
Removes the mapping for this key from this TreeMap if present.
int
**[size](../../java/util/TreeMap.html#size%28%29)**()
Returns the number of key-value mappings in this map.
[NavigableMap](../../java/util/NavigableMap.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap"),[V](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[subMap](../../java/util/TreeMap.html#subMap%28K,%20boolean,%20K,%20boolean%29)**([K](../../java/util/TreeMap.html "type parameter in TreeMap") fromKey, boolean fromInclusive,[K](../../java/util/TreeMap.html "type parameter in TreeMap") toKey, boolean toInclusive)
Returns a view of the portion of this map whose keys range fromfromKey
to toKey
.
[SortedMap](../../java/util/SortedMap.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap"),[V](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[subMap](../../java/util/TreeMap.html#subMap%28K,%20K%29)**([K](../../java/util/TreeMap.html "type parameter in TreeMap") fromKey,[K](../../java/util/TreeMap.html "type parameter in TreeMap") toKey)
Returns a view of the portion of this map whose keys range fromfromKey
, inclusive, to toKey
, exclusive.
[SortedMap](../../java/util/SortedMap.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap"),[V](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[tailMap](../../java/util/TreeMap.html#tailMap%28K%29)**([K](../../java/util/TreeMap.html "type parameter in TreeMap") fromKey)
Returns a view of the portion of this map whose keys are greater than or equal to fromKey
.
[NavigableMap](../../java/util/NavigableMap.html "interface in java.util")<[K](../../java/util/TreeMap.html "type parameter in TreeMap"),[V](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[tailMap](../../java/util/TreeMap.html#tailMap%28K,%20boolean%29)**([K](../../java/util/TreeMap.html "type parameter in TreeMap") fromKey, boolean inclusive)
Returns a view of the portion of this map whose keys are greater than (or equal to, if inclusive
is true) fromKey
.
[Collection](../../java/util/Collection.html "interface in java.util")<[V](../../java/util/TreeMap.html "type parameter in TreeMap")>
**[values](../../java/util/TreeMap.html#values%28%29)**()
Returns a Collection view of the values contained in this map.