public class MultiMap<K,V>
extends java.util.AbstractMap<K,V>
Modifier and Type | Field and Description |
---|---|
protected java.util.Comparator<K> |
comp |
Constructor and Description |
---|
MultiMap()
Creates a MultiMap object without a Comparator.
|
MultiMap(java.util.Comparator<K> comp_)
Creates a MultiMap object, using the specified Comparator.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears this Map so that it contains no objects.
|
java.util.Comparator<K> |
comparator()
Return the used Comparator object, if any.
|
protected int |
compare(K a,
K b) |
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()
Return a Set for this Map's entries.
|
K |
firstKey()
Return the key of the sorted first entry in this Map.
|
protected void |
fixAdd(de.bb.util.MapBase.Leaf<K,V> i)
Rebalance the tree on add.
|
V |
get(java.lang.Object key)
Get the element for the specified value
|
java.util.SortedMap<K,V> |
headMap(K to)
Create a sub map view of this map.
|
boolean |
isEmpty()
Tests if this Map has no components.
|
K |
lastKey()
Return the key of the sorted last entry in this Map.
|
V |
put(K key,
V value)
Insert a given object into the tree using the specified key.
|
V |
remove(K key,
V value)
Removes the key holding the specified value from this Map.
|
V |
remove(java.lang.Object key)
Removes the key holding the specified value from this Map.
|
int |
size()
Returns the number of components in this Map.
|
java.util.SortedMap<K,V> |
subMap(K from,
K to)
Create a sub map view of this map.
|
java.util.SortedMap<K,V> |
tailMap(K from)
Create a sub map view of this map.
|
java.lang.String |
toString()
displays the members with toString().
|
clone, containsValue, equals, hashCode, keySet, putAll, values
public MultiMap(java.util.Comparator<K> comp_)
comp_
- a Comparator object.public MultiMap()
public V remove(K key, V value)
key
- the key that needs to be removed.value
- the value at the key that needs to be removed.public void clear()
clear
in interface java.util.Map<K,V>
clear
in class java.util.AbstractMap<K,V>
public int size()
size
in interface java.util.Map<K,V>
size
in class java.util.AbstractMap<K,V>
public final boolean isEmpty()
isEmpty
in interface java.util.Map<K,V>
isEmpty
in class java.util.AbstractMap<K,V>
protected final void fixAdd(de.bb.util.MapBase.Leaf<K,V> i)
i
- public final V get(java.lang.Object key)
get
in interface java.util.Map<K,V>
get
in class java.util.AbstractMap<K,V>
key
- the key for the element to searchpublic V remove(java.lang.Object key)
remove
in interface java.util.Map<K,V>
remove
in class java.util.AbstractMap<K,V>
key
- the key that needs to be removed.protected final int compare(K a, K b)
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<K,V>
containsKey
in class java.util.AbstractMap<K,V>
key
- 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<java.util.Map.Entry<K,V>> entrySet()
entrySet
in interface java.util.Map<K,V>
entrySet
in interface java.util.SortedMap<K,V>
entrySet
in class java.util.AbstractMap<K,V>
public java.util.Comparator<K> comparator()
comparator
in interface java.util.SortedMap<K,V>
public K firstKey()
firstKey
in interface java.util.SortedMap<K,V>
public K lastKey()
lastKey
in interface java.util.SortedMap<K,V>
public java.util.SortedMap<K,V> subMap(K from, K to)
subMap
in interface java.util.SortedMap<K,V>
from
- first key of the sub mapto
- first key behind the last key.public java.util.SortedMap<K,V> tailMap(K from)
tailMap
in interface java.util.SortedMap<K,V>
from
- first key of the sub mappublic java.util.SortedMap<K,V> headMap(K to)
headMap
in interface java.util.SortedMap<K,V>
to
- first key behind the last key.public java.lang.String toString()
toString
in class java.util.AbstractMap<K,V>