key - the type used for the keyvectorObject - the type used for individual elements of each vector in the mappublic class VectorMap<key,vectorObject> extends HashMap<key,Vector<vectorObject>>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
VectorMap()
null constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendUnique(key key,
Vector<vectorObject> vVal)
append a map, ensuring uniqueness
|
void |
appendUnique(VectorMap<key,vectorObject> map)
append a VectorMap, ensuring uniqueness
|
void |
fillInvertedMap(Map<vectorObject,key> map)
fill this with the values in map by switching key and value
|
Vector<vectorObject> |
getAllValues()
get all values as one big vector, multiple entries are retained (see
ContainerUtil.unify()) |
int |
getIndex(key key,
vectorObject singleObject)
get the index of singleObject in the vector of key
|
Map<vectorObject,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 |
vectorObject |
getOne(Object key,
int i)
get the value for key
|
boolean |
isUnique()
Getter for bUnique attribute.
|
void |
putOne(key key,
vectorObject val)
put the value for key, ensuring uniqueness
|
void |
removeOne(key key,
vectorObject val)
remove the value for key,also remove key if the vector is empty
|
void |
setOne(key key,
vectorObject newObj,
int pos)
insert the value for keyat position pos
|
void |
setOne(key key,
vectorObject newObj,
vectorObject 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, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, valuesequals, hashCode, toStringpublic void fillInvertedMap(Map<vectorObject,key> map)
map - public vectorObject getOne(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, vectorObject 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, vectorObject val)
key - the key of the vectorval - the vector elementpublic void appendUnique(key key, Vector<vectorObject> vVal)
key - the key of the vectorvVal - the vector of elementspublic void appendUnique(VectorMap<key,vectorObject> map)
map - the map to addpublic Vector<vectorObject> getAllValues()
ContainerUtil.unify())public Map<vectorObject,key> getInvertedMap()
public void removeOne(key key, vectorObject val)
key - the key of the vectorval - the vector elementpublic void setOne(key key, vectorObject newObj, vectorObject oldObj)
key - the key of the vectornewObj - the new object to setoldObj - the old object to replacepublic void setOne(key key, vectorObject 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 endIllegalArgumentException - if pos is negative and abs(pos)>size()public boolean isUnique()
public void setUnique(boolean bUnique)
bUnique - the bUnique to setCopyright © 2015. All rights reserved.