public class CollectionMap<K,V> extends HashMap<K,Collection<V>>
The maintained index must only contain values implementing the
Collection interface. The data structure looks like this:
{key: [value, value, ...], key: [value, ...]}
Empty entries are removed by default.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Field and Description |
---|---|
protected boolean |
drop_empty |
Constructor and Description |
---|
CollectionMap() |
CollectionMap(boolean drop_empty) |
Modifier and Type | Method and Description |
---|---|
void |
add(K key,
V value) |
protected Collection<V> |
createCollection() |
void |
move(V value,
K old_key,
K new_key) |
boolean |
remove(Object key,
Object value) |
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, replace, replace, replaceAll, size, values
equals, hashCode, toString
public CollectionMap()
public CollectionMap(boolean drop_empty)
protected Collection<V> createCollection()
public boolean remove(Object key, Object value)
remove
in interface Map<K,Collection<V>>
remove
in class HashMap<K,Collection<V>>