|
||||||||||
| 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 final 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. |
|
MultiMap(MultiMap<K,V> base)
Copy constructor. |
|
| Method Summary | ||
|---|---|---|
void |
add(K k,
V v)
Adds one more value. |
|
MultiMap<K,V> |
clone()
Creates a copy of the map that contains the exact same key and value set. |
|
boolean |
containsKey(K key)
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)
|
|
V |
getOne(K k)
Gets the first value if any, or null. |
|
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 wit hthe key by the given single value. |
|
int |
size()
Returns the size of the map |
|
java.lang.String |
toCommaSeparatedString()
Format the map as "key=value1,key=value2,...." |
|
java.lang.String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MultiMap()
public MultiMap(MultiMap<K,V> base)
| Method Detail |
|---|
public final java.lang.String toString()
toString in class java.lang.Object
public final void add(K k,
V v)
public void set(K k,
java.util.Collection<? extends V> v)
v - Can be null or empty.
public void set(K k,
V v)
This is short for set(k,Collections.singleton(v))
public final java.util.List<V> get(K k)
public boolean containsKey(K key)
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.
public java.util.Set<java.util.Map.Entry<K,java.util.List<V>>> entrySet()
public 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 | |||||||||