public class SearchTreeMap<K extends java.lang.Comparable<K>,V>
extends java.lang.Object
Constructor and Description |
---|
SearchTreeMap() |
Modifier and Type | Method and Description |
---|---|
V |
get(K k)
Find the value the key is mapped to
|
K |
getMax()
Return the maximum key value in the map
|
K |
getMin()
Return the minimum key value in the map
|
java.util.List<K> |
keyList()
Return list of keys in map in natural sorted order
|
java.util.Set<K> |
keySet()
Return a Set of all the keys in the map
|
void |
put(K k,
V v)
Update the mapping for the key
|
void |
remove(K k)
Remove any existing binding for a key
|
int |
size()
Return number of keys bound by this map
|
SearchTreeMap<K,V> |
subMap(K fromKey,
K toKey)
Return subset of TreeMap between the values fromKey-toKey.
|
java.lang.String |
toString()
Return a string representation of the tree
|
public V get(K k)
k
- -
Search keypublic void put(K k, V v)
k
- -
key valuev
- -
value the key should be bound topublic int size()
public void remove(K k)
k
- -
key to be removed from the mappublic java.util.Set<K> keySet()
public K getMin()
java.util.NoSuchElementException
- if the map is emptypublic K getMax()
java.util.NoSuchElementException
- if the map is emptypublic java.lang.String toString()
toString
in class java.lang.Object
public java.util.List<K> keyList()
public SearchTreeMap<K,V> subMap(K fromKey, K toKey)