edu.vub.util
Class MultiMap
java.lang.Object
edu.vub.util.MultiMap
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Map, java.io.Serializable
- public class MultiMap
- extends java.lang.Object
- implements java.util.Map, java.io.Serializable, java.lang.Cloneable
- Author:
- smostinc
A simple Map allowing one key to be associated with a Set of values.
- See Also:
- Serialized Form
Method Summary |
void |
clear()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Set |
entrySet()
|
boolean |
equals(java.lang.Object toBeCompared)
|
java.lang.Object |
get(java.lang.Object key)
|
int |
hashCode()
|
boolean |
isEmpty()
|
java.util.Set |
keySet()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
void |
putAll(java.util.Map toMerge)
|
void |
putAll(MultiMap toMerge)
Special case of putAll for merging MultiMaps |
void |
putValues(java.lang.Object key,
java.util.Collection values)
Puts multivalued entries for one key |
java.lang.Object |
remove(java.lang.Object key)
Returns a Set of the values that were associated
with this key. |
boolean |
removeValue(java.lang.Object key,
java.lang.Object value)
Removes a single value associated with a key |
private void |
replaceValue(java.lang.Object key,
java.lang.Object oldValue,
java.lang.Object newValue)
|
int |
size()
|
java.util.Collection |
values()
Returns a Set of Sets |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
internal_
java.util.Map internal_
MultiMap
public MultiMap()
clear
public void clear()
- Specified by:
clear
in interface java.util.Map
containsKey
public boolean containsKey(java.lang.Object key)
- Specified by:
containsKey
in interface java.util.Map
containsValue
public boolean containsValue(java.lang.Object value)
- Specified by:
containsValue
in interface java.util.Map
entrySet
public java.util.Set entrySet()
- Specified by:
entrySet
in interface java.util.Map
equals
public boolean equals(java.lang.Object toBeCompared)
- Specified by:
equals
in interface java.util.Map
get
public java.lang.Object get(java.lang.Object key)
- Specified by:
get
in interface java.util.Map
- Returns:
- a Set of values matching the key, or null if no entry is found
hashCode
public int hashCode()
- Specified by:
hashCode
in interface java.util.Map
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface java.util.Map
keySet
public java.util.Set keySet()
- Specified by:
keySet
in interface java.util.Map
put
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
- Specified by:
put
in interface java.util.Map
putValues
public void putValues(java.lang.Object key,
java.util.Collection values)
- Puts multivalued entries for one key
putAll
public void putAll(java.util.Map toMerge)
- Specified by:
putAll
in interface java.util.Map
putAll
public void putAll(MultiMap toMerge)
- Special case of putAll for merging MultiMaps
remove
public java.lang.Object remove(java.lang.Object key)
- Returns a Set of the values that were associated
with this key.
- Specified by:
remove
in interface java.util.Map
- See Also:
Map.remove(java.lang.Object)
removeValue
public boolean removeValue(java.lang.Object key,
java.lang.Object value)
- Removes a single value associated with a key
size
public int size()
- Specified by:
size
in interface java.util.Map
values
public java.util.Collection values()
- Returns a Set of Sets
- Specified by:
values
in interface java.util.Map
- See Also:
Map.values()
replaceValue
private void replaceValue(java.lang.Object key,
java.lang.Object oldValue,
java.lang.Object newValue)