|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractMap
de.bb.util.MultiMap
public class MultiMap
This class is used to maintain key value pairs, sorted by key.
All keys must be usable by the specified Comparator object, or if no Comparator is used, by the Objects compareTo function.
This implementation allows duplicate keys.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
java.util.Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
MultiMap()
Creates a MultiMap object without a Comparator. |
|
MultiMap(java.util.Comparator comp_)
Creates a MultiMap object, using the specified Comparator. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears this Map so that it contains no objects. |
java.util.Comparator |
comparator()
Return the used Comparator object, if any. |
protected int |
compare(java.lang.Object a,
java.lang.Object b)
|
boolean |
containsKey(java.lang.Object key)
Returns true if this map contains a mapping for the specified key. |
java.util.Set |
entrySet()
Return a Set for this Map's entries. |
java.lang.Object |
firstKey()
Return the key of the sorted first entry in this Map. |
protected void |
fixAdd(de.bb.util.MapBase.Leaf i)
Rebalance the tree on add. |
java.lang.Object |
get(java.lang.Object key)
Get the element for the specified value |
java.util.SortedMap |
headMap(java.lang.Object to)
Create a sub map view of this map. |
boolean |
isEmpty()
Tests if this Map has no components. |
java.lang.Object |
lastKey()
Return the key of the sorted last entry in this Map. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Insert a given object into the tree using the specified key. |
java.lang.Object |
remove(java.lang.Object key)
Removes the key holding the specified value from this Map. |
java.lang.Object |
remove(java.lang.Object key,
java.lang.Object value)
Removes the key holding the specified value from this Map. |
int |
size()
Returns the number of components in this Map. |
java.util.SortedMap |
subMap(java.lang.Object from,
java.lang.Object to)
Create a sub map view of this map. |
java.util.SortedMap |
tailMap(java.lang.Object from)
Create a sub map view of this map. |
java.lang.String |
toString()
displays the members with toString(). |
| Methods inherited from class java.util.AbstractMap |
|---|
clone, containsValue, equals, hashCode, keySet, putAll, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.SortedMap |
|---|
keySet, values |
| Methods inherited from interface java.util.Map |
|---|
containsValue, equals, hashCode, putAll |
| Constructor Detail |
|---|
public MultiMap(java.util.Comparator comp_)
comp_ - a Comparator object.public MultiMap()
| Method Detail |
|---|
public java.lang.Object remove(java.lang.Object key,
java.lang.Object value)
key - the key that needs to be removed.value - the value at the key that needs to be removed.
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
put in interface java.util.Mapput in class java.util.AbstractMapkey - the keyvalue - the inserted value
public void clear()
clear in interface java.util.Mapclear in class java.util.AbstractMappublic int size()
size in interface java.util.Mapsize in class java.util.AbstractMappublic final boolean isEmpty()
isEmpty in interface java.util.MapisEmpty in class java.util.AbstractMapprotected final void fixAdd(de.bb.util.MapBase.Leaf i)
i - public final java.lang.Object get(java.lang.Object key)
get in interface java.util.Mapget in class java.util.AbstractMapkey - the key for the element to search
public java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mapremove in class java.util.AbstractMapkey - the key that needs to be removed.
protected final int compare(java.lang.Object a,
java.lang.Object b)
public boolean containsKey(java.lang.Object key)
containsKey in interface java.util.MapcontainsKey in class java.util.AbstractMapkey - key whose presence in this map is to be tested.
java.lang.NullPointerException - if the key is null and this map
does not not permit null keys.public java.util.Set entrySet()
entrySet in interface java.util.MapentrySet in interface java.util.SortedMapentrySet in class java.util.AbstractMappublic java.util.Comparator comparator()
comparator in interface java.util.SortedMappublic java.lang.Object firstKey()
firstKey in interface java.util.SortedMappublic java.lang.Object lastKey()
lastKey in interface java.util.SortedMap
public java.util.SortedMap subMap(java.lang.Object from,
java.lang.Object to)
subMap in interface java.util.SortedMapfrom - first key of the sub mapto - first key behind the last key.
public java.util.SortedMap tailMap(java.lang.Object from)
tailMap in interface java.util.SortedMapfrom - first key of the sub map
public java.util.SortedMap headMap(java.lang.Object to)
headMap in interface java.util.SortedMapto - first key behind the last key.
public java.lang.String toString()
toString in class java.util.AbstractMap
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||