public class AliasMap<K,V,A> extends HashMap<K,V>
getValueAlias(java.lang.Object[]) ou supprimer les valeurs qui
ont un ensemble d'Alias en commun via la methode removeValue(A...)
Si la cle ne vous importe que peu, vous pouvez par exemple utiliser
UUID.randomUUID() pour generer une cle unique.AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.collections.map.MultiValueMap |
aliases
key: alias, value: key
|
protected org.apache.commons.collections.map.MultiValueMap |
keys
key: key, value: alias
|
| Constructor and Description |
|---|
AliasMap() |
| Modifier and Type | Method and Description |
|---|---|
Collection<A> |
getAlias(K key)
Retourne la liste d'alias associee avec une cle
|
Collection<K> |
getKeyAlias(A... alias)
Retoure les cles en commun de tous les alias.
|
Collection<V> |
getValueAlias(A... alias)
Retoure les valeurs en commun de tous les alias.
|
V |
put(K key,
V value,
A alias1,
A... alias)
Ajoute une valeur dans la map avec un ensemble d'alias associe
|
protected void |
putAlias(K key,
A alias1,
A... alias)
Ajoute des alias a une cle
|
V |
remove(Object key)
Retire une cle ainsi que tous ses alias
|
void |
removeAlias(A... alias)
Supprime des alias quelque soit leur cle
|
Collection<V> |
removeValue(A... alias)
Supprime toutes les valeurs et leur cle associe aux alias
|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, size, valuesequals, hashCode, toStringprotected org.apache.commons.collections.map.MultiValueMap aliases
protected org.apache.commons.collections.map.MultiValueMap keys
public V put(K key, V value, A alias1, A... alias)
key - identifiant unique pour cette valeurvalue - la valeuralias - les alias de la valeurprotected void putAlias(K key, A alias1, A... alias)
key - alias1 - alias - public Collection<K> getKeyAlias(A... alias)
K1: a, b, c K2: b, c, d K3: c, d, e getKeyAlias(a, b, c) retourne [K1] getKeyAlias(b, c) retourne [K1, K2] getKeyAlias(c) retourne [K1, K2, K3] getKeyAlias(d) retourne [K2, K3] getKeyAlias(z) retourne []
alias - public Collection<V> getValueAlias(A... alias)
V1: a, b, c V2: b, c, d V3: c, d, e getKeyAlias(a, b, c) retourne [V1] getKeyAlias(b, c) retourne [V1, V2] getKeyAlias(c) retourne [V1, V2, V3] getKeyAlias(d) retourne [V2, V3] getKeyAlias(z) retourne []
alias - public Collection<A> getAlias(K key)
K1: a, b, c K2: b, c, d K3: c, d, e getAlias(K1) retourne [a, b, c] getAlias(k3) retourne [c, d, e] getKeyAlias(k9) retourne []
key - public V remove(Object key)
K1: a, b, c K2: b, c, d K3: c, d, e remove(K1) il reste K2: [b, c, d], K3: [c, d, e]
public Collection<V> removeValue(A... alias)
K1: a, b, c K2: b, c, d K3: c, d, e removeValue(b, c) il reste K3: [c, d, e]
alias - public void removeAlias(A... alias)
K1: a, b, c K2: b, c, d K3: c, d, e removeAlias(a, b) alors K1: [c], k2: [c, d], k3: [c, d, e] removeAlias(c) alors K1: [a, b], k2: [b, d], k3: [d, e] getKeyAlias(z) alors rien ne change car cette alias n'existe pas
alias - Copyright © 2004–2013 CodeLutin. All rights reserved.