|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.util.MultiMap<K,V>
public class MultiMap<K,V>
Map which contains more than one value per key.
You can either use a MultiMap
as a regular map, or you can
use the additional methods putMulti(K, V)
and getMulti(K)
. Values
are returned in the order in which they were added.
TODO jvs 21-Jul-2007: unit test for this class
Nested Class Summary | |
---|---|
private class |
MultiMap.EntryIter
Implementation for entryIterMulti(). |
private static class |
MultiMap.ValueList<V>
Holder class, ensures that user's values are never interpreted as multiple values. |
Field Summary | |
---|---|
private Map<K,Object> |
map
|
Constructor Summary | |
---|---|
MultiMap()
|
Method Summary | |
---|---|
void |
clear()
|
boolean |
containsKey(K key)
|
MultiMap.EntryIter |
entryIterMulti()
Like entrySet().iterator(), but returns one Map.Entry per value rather than one per key. |
private Object |
get(K key)
|
List<V> |
getMulti(K key)
Returns a list of values for a given key; returns an empty list if not found. |
private Object |
put(K key,
V value)
|
void |
putMulti(K key,
V value)
Adds a value for this key. |
Object |
remove(K key)
|
boolean |
removeMulti(K key,
V value)
Removes a value for this key. |
int |
size()
Returns the number of keys in this MultiMap. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final Map<K,Object> map
Constructor Detail |
---|
public MultiMap()
Method Detail |
---|
public int size()
private Object get(K key)
private Object put(K key, V value)
public List<V> getMulti(K key)
public void putMulti(K key, V value)
public boolean removeMulti(K key, V value)
public MultiMap.EntryIter entryIterMulti()
public Object remove(K key)
public boolean containsKey(K key)
public void clear()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |