|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweiss.util.TreeMap<KeyType,ValueType>
public class TreeMap<KeyType,ValueType>
Balanced search tree implementation of the Map.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface weiss.util.Map |
---|
Map.Entry<KeyType,ValueType> |
Constructor Summary | |
---|---|
TreeMap()
Construct an empty TreeMap with default comparator. |
|
TreeMap(Comparator<? super KeyType> comparator)
Construct a TreeMap using comparator. |
|
TreeMap(Map<KeyType,ValueType> other)
Construct a TreeMap with same key/value pairs and comparator as another map.. |
Method Summary | |
---|---|
void |
clear()
Removes all key value pairs from the map. |
protected Set<Map.Entry<KeyType,ValueType>> |
clonePairSet(Set<Map.Entry<KeyType,ValueType>> pairSet)
|
Comparator<? super KeyType> |
comparator()
Gets the comparator; returns null if default. |
boolean |
containsKey(KeyType key)
Tests if this map contains a given key. |
Set<Map.Entry<KeyType,ValueType>> |
entrySet()
Return a set of Map.Entry objects corresponding to the key/value pairs in the map. |
ValueType |
get(KeyType key)
Returns the value in the map associated with the key. |
protected Set<Map.Entry<KeyType,ValueType>> |
getSet()
Return a reference to the underlying set. |
boolean |
isEmpty()
Tests if this map is empty. |
Set<KeyType> |
keySet()
Returns the keys in the map. |
protected Set<KeyType> |
makeEmptyKeySet()
|
protected Map.Entry<KeyType,ValueType> |
makePair(KeyType key,
ValueType value)
|
ValueType |
put(KeyType key,
ValueType value)
Adds the key value pair to the map, overriding the original value if the key was already present. |
ValueType |
remove(KeyType key)
Remove the key and its value from the map. |
int |
size()
Returns the number of keys in this map. |
java.lang.String |
toString()
|
Collection<ValueType> |
values()
Returns the values in the map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TreeMap()
public TreeMap(Comparator<? super KeyType> comparator)
comparator
- the comparator.public TreeMap(Map<KeyType,ValueType> other)
other
- the other map.Method Detail |
---|
public Comparator<? super KeyType> comparator()
protected Map.Entry<KeyType,ValueType> makePair(KeyType key, ValueType value)
protected Set<KeyType> makeEmptyKeySet()
protected Set<Map.Entry<KeyType,ValueType>> clonePairSet(Set<Map.Entry<KeyType,ValueType>> pairSet)
public int size()
size
in interface Map<KeyType,ValueType>
public boolean isEmpty()
isEmpty
in interface Map<KeyType,ValueType>
public boolean containsKey(KeyType key)
containsKey
in interface Map<KeyType,ValueType>
key
- the key to search for.
public ValueType get(KeyType key)
get
in interface Map<KeyType,ValueType>
key
- the key to search for.
public ValueType put(KeyType key, ValueType value)
put
in interface Map<KeyType,ValueType>
key
- the key to insert.value
- the value to insert.
public ValueType remove(KeyType key)
remove
in interface Map<KeyType,ValueType>
key
- the key to remove.
public void clear()
clear
in interface Map<KeyType,ValueType>
public Set<KeyType> keySet()
keySet
in interface Map<KeyType,ValueType>
public Collection<ValueType> values()
values
in interface Map<KeyType,ValueType>
public Set<Map.Entry<KeyType,ValueType>> entrySet()
entrySet
in interface Map<KeyType,ValueType>
protected Set<Map.Entry<KeyType,ValueType>> getSet()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |