|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jvnet.hk2.component.MultiMap<K,V>
public class MultiMap<K,V>
Map from a key to multiple values. Order is significant among values, and null values are allowed, although null keys are not.
| Constructor Summary | |
|---|---|
|
MultiMap()
Creates an empty multi-map with default concurrency controls |
protected |
MultiMap(java.util.Map<K,java.util.List<V>> store,
boolean concurrencyControls)
Creates a multi-map backed by the given store. |
|
MultiMap(MultiMap<K,V> base)
Copy constructor. |
| Method Summary | ||
|---|---|---|
void |
add(K k,
V v)
Adds one more key-value pair. |
|
MultiMap<K,V> |
clone()
Creates a copy of the map that contains the exact same key and value set. |
|
boolean |
contains(K k1,
V k2)
Checks if the map contains the given key(s), also extending the search to including the sub collection. |
|
boolean |
containsKey(K k)
Checks if the map contains the given key. |
|
static
|
emptyMap()
Gets the singleton read-only empty multi-map. |
|
java.util.Set<java.util.Map.Entry<K,java.util.List<V>>> |
entrySet()
Lists up all entries. |
|
java.util.List<V> |
get(K k)
Returns the elements indexed by the provided key |
|
V |
getOne(K k)
Gets the first value if any, or null. |
|
java.util.Set<K> |
keySet()
|
|
protected java.util.List<V> |
newList(java.util.Collection<? extends V> initialVals)
Creates an optionally populated list to be used as an entry in the map. |
|
java.util.List<V> |
remove(K key)
Removes an key value from the map |
|
boolean |
remove(K key,
V entry)
Removes an key value pair from the map |
|
void |
set(K k,
java.util.Collection<? extends V> v)
Replaces all the existing values associated with the key by the given value. |
|
void |
set(K k,
V v)
Replaces all the existing values associated with the key by the given single value. |
|
int |
size()
Returns the size of the map |
|
java.lang.String |
toCommaSeparatedString()
|
|
java.lang.String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MultiMap()
protected MultiMap(java.util.Map<K,java.util.List<V>> store,
boolean concurrencyControls)
store - map to copypublic MultiMap(MultiMap<K,V> base)
base - map to copy| Method Detail |
|---|
public final java.lang.String toString()
toString in class java.lang.Objectprotected java.util.List<V> newList(java.util.Collection<? extends V> initialVals)
initialVal -
public java.util.Set<K> keySet()
public final void add(K k,
V v)
k - key to store the entry underv - value to store in the k's values.
public void set(K k,
java.util.Collection<? extends V> v)
k - key for the valuesv - Can be null or empty.
public void set(K k,
V v)
k - key for the valuesv - singleton value for k key
This is short for set(k,Collections.singleton(v))
public final java.util.List<V> get(K k)
k - key for the values
public boolean containsKey(K k)
k - key to test
public boolean contains(K k1,
V k2)
k1 - key from top collectionk2 - key (value) from inner collection
public java.util.List<V> remove(K key)
key - key to be removed
public boolean remove(K key,
V entry)
key - key to be removedentry - the entry to be removed from the key'ed list
public final V getOne(K k)
This is useful when you know the given key only has one value and you'd like to get to that value.
k - key for the values
public java.util.Set<java.util.Map.Entry<K,java.util.List<V>>> entrySet()
Set of Map.Entry of entriespublic java.lang.String toCommaSeparatedString()
public MultiMap<K,V> clone()
clone in class java.lang.Objectpublic int size()
public static <K,V> MultiMap<K,V> emptyMap()
Collections.emptyMap()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||