|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.ws.rs.core.AbstractMultivaluedMap<K,V>
K - the type of keys maintained by this map.V - the type of mapped values.public abstract class AbstractMultivaluedMap<K,V>
Abstract skeleton implementation of a MultivaluedMap that is backed
by a [key, multi-value] store represented as a Map<K, List<V>>.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Field Summary | |
|---|---|
protected Map<K,List<V>> |
store
Backing store for the [key, multi-value] pairs. |
| Constructor Summary | |
|---|---|
AbstractMultivaluedMap(Map<K,List<V>> store)
Initialize the backing store in the abstract parent multivalued map implementation. |
|
| Method Summary | |
|---|---|
void |
add(K key,
V value)
Add a value to the current list of values for the supplied key. |
void |
addAll(K key,
List<V> valueList)
Add all the values from the supplied value list to the current list of values for the supplied key. |
void |
addAll(K key,
V... newValues)
Add multiple values to the current list of values for the supplied key. |
void |
addFirst(K key,
V value)
Add a value to the first position in the current list of values for the supplied key. |
protected void |
addFirstNull(List<V> values)
Define the behavior for adding a null values to the first position
in the value list. |
protected void |
addNull(List<V> values)
Define the behavior for adding a null values to the value list. |
void |
clear()
|
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object value)
|
Set<Map.Entry<K,List<V>>> |
entrySet()
|
boolean |
equals(Object o)
This implementation delegates the method call to to the the underlying [key, multi-value] store. |
boolean |
equalsIgnoreValueOrder(MultivaluedMap<K,V> omap)
Compare the specified map with this map for equality modulo the order of values for each key. |
List<V> |
get(Object key)
|
V |
getFirst(K key)
A shortcut to get the first value of the supplied key. |
protected List<V> |
getValues(K key)
Return a non-null list of values for a given key. |
int |
hashCode()
This implementation delegates the method call to to the the underlying [key, multi-value] store. |
boolean |
isEmpty()
|
Set<K> |
keySet()
|
List<V> |
put(K key,
List<V> value)
|
void |
putAll(Map<? extends K,? extends List<V>> m)
|
void |
putSingle(K key,
V value)
Set the value for the key to be a one item list consisting of the supplied value. |
List<V> |
remove(Object key)
|
int |
size()
|
String |
toString()
|
Collection<List<V>> |
values()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final Map<K,List<V>> store
| Constructor Detail |
|---|
public AbstractMultivaluedMap(Map<K,List<V>> store)
store - the backing Map to be used as a [key, multi-value]
store.| Method Detail |
|---|
public final void putSingle(K key,
V value)
null values; A supplied value
of null is ignored and not added to the purged value list.
As a result of such operation, empty value list would be registered for
the supplied key. Overriding implementations may modify this behavior by
redefining the addNull(java.util.List) method.
putSingle in interface MultivaluedMap<K,V>key - the keyvalue - the single value of the key. If the value is null it
will be ignored.protected void addNull(List<V> values)
null values to the value list.
Default implementation is a no-op, i.e. the null values are ignored.
Overriding implementations may modify this behavior by providing their
own definitions of this method.
values - value list where the null value addition is being
requested.protected void addFirstNull(List<V> values)
null values to the first position
in the value list.
Default implementation is a no-op, i.e. the null values are ignored.
Overriding implementations may modify this behavior by providing their
own definitions of this method.
values - value list where the null value addition is being
requested.
public final void add(K key,
V value)
null values; A supplied value
of null is ignored and not added to the value list. Overriding
implementations may modify this behavior by redefining the
addNull(java.util.List) method.
add in interface MultivaluedMap<K,V>key - the keyvalue - the value to be added.
public final void addAll(K key,
V... newValues)
NullPointerException if the supplied array of values
is null.
NOTE: This implementation ignores null values; Any of the supplied values
of null is ignored and not added to the value list. Overriding
implementations may modify this behavior by redefining the
addNull(java.util.List) method.
addAll in interface MultivaluedMap<K,V>key - the key.newValues - the values to be added.
NullPointerException - if the supplied array of new values is null.
public final void addAll(K key,
List<V> valueList)
NullPointerException if the
supplied array of values is null.
NOTE: This implementation ignores null values; Any null value
in the supplied value list is ignored and not added to the value list. Overriding
implementations may modify this behavior by redefining the
addNull(java.util.List) method.
addAll in interface MultivaluedMap<K,V>key - the key.valueList - the list of values to be added.
NullPointerException - if the supplied value list is null.public final V getFirst(K key)
MultivaluedMap
getFirst in interface MultivaluedMap<K,V>key - the key
public final void addFirst(K key,
V value)
null values; A supplied value
of null is ignored and not added to the purged value list. Overriding
implementations may modify this behavior by redefining the
addFirstNull(java.util.List) method.
addFirst in interface MultivaluedMap<K,V>key - the keyvalue - the value to be added.protected final List<V> getValues(K key)
List
instance is created, registered within the map to hold the values of
the key and returned from the method.
key - the key.
null.public String toString()
toString in class Objectpublic int hashCode()
hashCode in interface Map<K,List<V>>hashCode in class Objectpublic boolean equals(Object o)
equals in interface Map<K,List<V>>equals in class Objecttrue if the specified object is equal to the underlying
[key, multi-value] store, false otherwise.public Collection<List<V>> values()
values in interface Map<K,List<V>>public int size()
size in interface Map<K,List<V>>public List<V> remove(Object key)
remove in interface Map<K,List<V>>public void putAll(Map<? extends K,? extends List<V>> m)
putAll in interface Map<K,List<V>>
public List<V> put(K key,
List<V> value)
put in interface Map<K,List<V>>public Set<K> keySet()
keySet in interface Map<K,List<V>>public boolean isEmpty()
isEmpty in interface Map<K,List<V>>public List<V> get(Object key)
get in interface Map<K,List<V>>public Set<Map.Entry<K,List<V>>> entrySet()
entrySet in interface Map<K,List<V>>public boolean containsValue(Object value)
containsValue in interface Map<K,List<V>>public boolean containsKey(Object key)
containsKey in interface Map<K,List<V>>public void clear()
clear in interface Map<K,List<V>>public boolean equalsIgnoreValueOrder(MultivaluedMap<K,V> omap)
MultivaluedMap
equalsIgnoreValueOrder in interface MultivaluedMap<K,V>omap - map to be compared to this one.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||