public class SortedTableMap<K,V> extends AbstractSortedMap<K,V>
AbstractMap.MapEntry<K,V>| Constructor and Description |
|---|
SortedTableMap()
Constructs an empty map using the natural ordering of keys.
|
SortedTableMap(Comparator<K> comp)
Constructs an empty map using the given comparator to order keys.
|
| Modifier and Type | Method and Description |
|---|---|
Entry<K,V> |
ceilingEntry(K key)
Returns the entry with least key greater than or equal to given key
(or null if no such key exists).
|
Iterable<Entry<K,V>> |
entrySet()
Returns an iterable collection of all key-value entries of the map.
|
Entry<K,V> |
firstEntry()
Returns the entry having the least key (or null if map is empty).
|
Entry<K,V> |
floorEntry(K key)
Returns the entry with greatest key less than or equal to given key
(or null if no such key exists).
|
V |
get(K key)
Returns the value associated with the specified key, or null if no such entry exists.
|
Entry<K,V> |
higherEntry(K key)
Returns the entry with least key strictly greater than given key
(or null if no such key exists).
|
Entry<K,V> |
lastEntry()
Returns the entry having the greatest key (or null if map is empty).
|
Entry<K,V> |
lowerEntry(K key)
Returns the entry with greatest key strictly less than given key
(or null if no such key exists).
|
V |
put(K key,
V value)
Associates the given value with the given key.
|
V |
remove(K key)
Removes the entry with the specified key, if present, and returns
its associated value.
|
int |
size()
Returns the number of entries in the map.
|
Iterable<Entry<K,V>> |
subMap(K fromKey,
K toKey)
Returns an iterable containing all keys in the range from
fromKey inclusive to toKey exclusive. |
checkKey, compare, compare, compare, compareisEmpty, keySet, valuespublic SortedTableMap()
public SortedTableMap(Comparator<K> comp)
comp - comparator defining the order of keys in the mappublic int size()
public V get(K key) throws IllegalArgumentException
key - the key whose associated value is to be returnedIllegalArgumentExceptionpublic V put(K key, V value) throws IllegalArgumentException
key - key with which the specified value is to be associatedvalue - value to be associated with the specified keyIllegalArgumentExceptionpublic V remove(K key) throws IllegalArgumentException
key - the key whose entry is to be removed from the mapIllegalArgumentExceptionpublic Entry<K,V> firstEntry()
public Entry<K,V> lastEntry()
public Entry<K,V> ceilingEntry(K key) throws IllegalArgumentException
IllegalArgumentException - if the key is not compatible with the mappublic Entry<K,V> floorEntry(K key) throws IllegalArgumentException
IllegalArgumentException - if the key is not compatible with the mappublic Entry<K,V> lowerEntry(K key) throws IllegalArgumentException
IllegalArgumentException - if the key is not compatible with the mappublic Entry<K,V> higherEntry(K key) throws IllegalArgumentException
IllegalArgumentException - if the key is not compatible with the mappublic Iterable<Entry<K,V>> entrySet()
public Iterable<Entry<K,V>> subMap(K fromKey, K toKey) throws IllegalArgumentException
fromKey inclusive to toKey exclusive.IllegalArgumentException - if fromKey or toKey is not compatible with the map