|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.TreeMap<X,java.util.Set<Y>>
org.knowceans.map.TreeMultiMap<X,Y>
public class TreeMultiMap<X,Y>
Implementation of the IMultiMap interface backed by a TreeMap. Maps a key to a Set of values and orders by the key's Comparator.
In relational terms, this class implements a m:n relation, but without reverse lookup.
| 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 | |
|---|---|
TreeMultiMap()
|
|
TreeMultiMap(java.util.Comparator<? super X> c)
|
|
TreeMultiMap(java.util.Map<X,java.util.Set<Y>> m)
|
|
TreeMultiMap(java.util.Map<X,java.util.Set<Y>> m,
java.util.Comparator<? super X> c)
|
|
| Method Summary | |
|---|---|
void |
add(X key,
Y value)
add a value to the set of values for a key. |
static void |
main(java.lang.String[] args)
|
java.util.Set<Y> |
put(X key,
java.util.Set<Y> value)
put a complete Set of values to a key. |
void |
remove(X key,
Y value)
remove one value out of the set of values for one key. |
| Methods inherited from class java.util.TreeMap |
|---|
ceilingEntry, ceilingKey, clear, clone, comparator, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, putAll, remove, size, subMap, subMap, tailMap, tailMap, values |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, isEmpty, toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, values |
| Constructor Detail |
|---|
public TreeMultiMap()
public TreeMultiMap(java.util.Comparator<? super X> c)
public TreeMultiMap(java.util.Map<X,java.util.Set<Y>> m)
public TreeMultiMap(java.util.Map<X,java.util.Set<Y>> m,
java.util.Comparator<? super X> c)
| Method Detail |
|---|
public static void main(java.lang.String[] args)
public void add(X key,
Y value)
add in interface IMultiMap<X,Y>key - The key of the new entry.value - The value of the new entry.
public java.util.Set<Y> put(X key,
java.util.Set<Y> value)
add(X, Y), we must ensure that only
Sets ever get put into this map. Using JSR14, this would not be a
problem.
put in interface java.util.Map<X,java.util.Set<Y>>put in class java.util.TreeMap<X,java.util.Set<Y>>
public void remove(X key,
Y value)
remove in interface IMultiMap<X,Y>key - The key of the new entry.value - The value of the new entry.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||