key - the type used for the keylistObject - the type used for individual elements of each vector in the mappublic class ListMap<key,listObject>
extends java.util.HashMap<key,java.util.List<listObject>>
| Constructor and Description |
|---|
ListMap()
null constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendUnique(key key,
java.util.List<listObject> vVal)
append a map, ensuring uniqueness
|
void |
appendUnique(ListMap<key,listObject> map)
append a VectorMap, ensuring uniqueness
|
void |
fillInvertedMap(java.util.Map<listObject,key> map)
fill this with the values in map by switching key and value
|
java.util.List<listObject> |
getAllValues()
get all values as one big vector, multiple entries are retained (see
ContainerUtil.unify()) |
int |
getIndex(key key,
listObject singleObject)
get the index of singleObject in the vector of key
|
java.util.Map<listObject,key> |
getInvertedMap()
get an inverted map that uses all entries a s keys and vice versa
note that the behavior is undefined in case of multiple identical values |
listObject |
getOne(java.lang.Object key,
int i)
get the value for key
|
boolean |
isUnique()
Getter for bUnique attribute.
|
void |
putOne(key key,
listObject val)
put the value for key, ensuring uniqueness
|
void |
removeOne(key key,
listObject val)
remove the value for key,also remove key if the vector is empty
|
void |
setOne(key key,
listObject newObj,
int pos)
insert the value for keyat position pos
|
void |
setOne(key key,
listObject newObj,
listObject oldObj)
replace the value for key, add if oldObj==null or is not there
|
void |
setUnique(boolean bUnique)
Setter for bUnique attribute.
|
int |
size(key key)
get the size of the vector for key
|
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuespublic void fillInvertedMap(java.util.Map<listObject,key> map)
map - public listObject getOne(java.lang.Object key, int i)
key - the search keyi - the index in the vecor matching key; if <0 count from the back of the vectorpublic int getIndex(key key, listObject singleObject)
key - the key of the vectorsingleObject - the object to searchpublic int size(key key)
key - the key of the vectorpublic void putOne(key key, listObject val)
key - the key of the vectorval - the vector elementpublic void appendUnique(key key, java.util.List<listObject> vVal)
key - the key of the vectorvVal - the vector of elementspublic void appendUnique(ListMap<key,listObject> map)
map - the map to addpublic java.util.List<listObject> getAllValues()
ContainerUtil.unify())public java.util.Map<listObject,key> getInvertedMap()
public void removeOne(key key, listObject val)
key - the key of the vectorval - the vector elementpublic void setOne(key key, listObject newObj, listObject oldObj)
key - the key of the vectornewObj - the new object to setoldObj - the old object to replacepublic void setOne(key key, listObject newObj, int pos)
key - the key of the vectornewObj - the new object to setpos - the index in the vector, may be <0 to count from the endjava.lang.IllegalArgumentException - if pos is negative and abs(pos)>size()public boolean isUnique()
public void setUnique(boolean bUnique)
bUnique - the bUnique to set