Package net.ontopia.utils
Class CollectionMap<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,Collection<V>>
-
- net.ontopia.utils.CollectionMap<K,V>
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<K,Collection<V>>
public class CollectionMap<K,V> extends HashMap<K,Collection<V>>
INTERNAL: A map which stores entries containing Collection values. Any object can be used as key. The add(key,value) and remove(key,value) makes sure that the Collection values are updated correctly.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.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
drop_empty
-
Constructor Summary
Constructors Constructor Description CollectionMap()
CollectionMap(boolean drop_empty)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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)
-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, replace, replace, replaceAll, size, values
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
-
-
-
Method Detail
-
createCollection
protected Collection<V> createCollection()
-
-