Modifier and Type | Field and Description |
---|---|
static MultiMap.EmptyMultiMap |
instance
The canonical EmptyMultiMap.
|
Modifier | Constructor and Description |
---|---|
private |
EmptyMultiMap()
Creates an immutable, empty multimap.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(K key,
V value)
Precondition: the mapping key→value is not already in the map.
|
void |
addAll(K key,
java.util.Collection<? extends V> values) |
void |
addAll(java.util.Map<? extends K,? extends V> m) |
void |
addAll(MultiMap<K,V> mmap) |
void |
clear() |
boolean |
contains(K obj) |
java.util.Set<V> |
getValues(K key)
Returns the values that the given key maps to.
|
boolean |
isEmpty() |
java.util.Set<K> |
keySet()
Returns the set of keys in this map (the domain).
|
void |
put(K key,
java.util.Collection<? extends V> values)
Adds a key-values mapping to this multimap.
|
boolean |
remove(K key) |
boolean |
remove(K key,
V value)
Precondition: the mapping key→value is in the map.
|
int |
size()
Returns the size of this map: the number of mappings.
|
java.lang.String |
toString()
Returns a String representation of this map.
|
public static MultiMap.EmptyMultiMap instance
private EmptyMultiMap()
public void put(K key, java.util.Collection<? extends V> values)
MultiMap
public boolean add(K key, V value)
IMultiMap
public boolean remove(K key, V value)
IMultiMap
public java.util.Set<V> getValues(K key)
IMultiMap
public java.util.Set<K> keySet()
IMultiMap
public int size()
IMultiMap