private class TreeMap.SubMap extends AbstractMap<K,V> implements java.util.SortedMap<K,V>, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
private class |
TreeMap.SubMap.EntrySetView |
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Field and Description |
---|---|
private java.util.Set<java.util.Map.Entry<K,V>> |
entrySet |
private K |
fromKey |
private boolean |
fromStart
fromKey is significant only if fromStart is false.
|
private static long |
serialVersionUID |
private boolean |
toEnd
fromKey is significant only if fromStart is false.
|
private K |
toKey |
keySet, values
Constructor and Description |
---|
SubMap(boolean fromStart,
K fromKey,
boolean toEnd,
K toKey) |
SubMap(K key,
boolean headMap) |
SubMap(K fromKey,
K toKey) |
Modifier and Type | Method and Description |
---|---|
java.util.Comparator<? super K> |
comparator() |
boolean |
containsKey(java.lang.Object key)
Returns true if this map contains a mapping for the specified
key.
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
Returns a set view of the mappings contained in this map.
|
K |
firstKey() |
V |
get(java.lang.Object key)
Returns the value to which this map maps the specified key.
|
java.util.SortedMap<K,V> |
headMap(K toKey) |
private boolean |
inRange(K key) |
private boolean |
inRange2(K key) |
boolean |
isEmpty()
Returns true if this map contains no key-value mappings.
|
K |
lastKey() |
V |
put(K key,
V value)
Associates the specified value with the specified key in this map
(optional operation).
|
java.util.SortedMap<K,V> |
subMap(K fromKey,
K toKey) |
java.util.SortedMap<K,V> |
tailMap(K fromKey) |
clear, clone, containsValue, equals, hashCode, keySet, putAll, remove, size, toString, values
private static final long serialVersionUID
private boolean fromStart
private boolean toEnd
private K fromKey
private K toKey
SubMap(K key, boolean headMap)
public boolean isEmpty()
AbstractMap
This implementation returns size() == 0.
public boolean containsKey(java.lang.Object key)
AbstractMap
This implementation iterates over entrySet() searching for an entry with the specified key. If such an entry is found, true is returned. If the iteration terminates without finding such an entry, false is returned. Note that this implementation requires linear time in the size of the map; many implementations will override this method.
containsKey
in interface java.util.Map<K,V>
containsKey
in class AbstractMap<K,V>
key
- key whose presence in this map is to be tested.public V get(java.lang.Object key)
AbstractMap
This implementation iterates over entrySet() searching for an entry with the specified key. If such an entry is found, the entry's value is returned. If the iteration terminates without finding such an entry, null is returned. Note that this implementation requires linear time in the size of the map; many implementations will override this method.
get
in interface java.util.Map<K,V>
get
in class AbstractMap<K,V>
key
- key whose associated value is to be returned.AbstractMap.containsKey(Object)
public V put(K key, V value)
AbstractMap
This implementation always throws an UnsupportedOperationException.
put
in interface java.util.Map<K,V>
put
in class AbstractMap<K,V>
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.public java.util.Comparator<? super K> comparator()
public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
AbstractMap
private boolean inRange(K key)
private boolean inRange2(K key)