public class Headers<K,V> extends Dictionary<K,V> implements Map<K,V>
Constructor and Description |
---|
Headers(Dictionary<? extends K,? extends V> values)
Create a Headers dictionary from a Dictionary.
|
Headers(int initialCapacity)
Create an empty Headers dictionary.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Enumeration<V> |
elements()
Values.
|
Set<Map.Entry<K,V>> |
entrySet() |
V |
get(Object key)
Support case-insensitivity for keys.
|
boolean |
isEmpty()
Tests if this dictionary maps no keys to value.
|
Enumeration<K> |
keys()
Case-preserved keys.
|
Set<K> |
keySet() |
static Headers<String,String> |
parseManifest(InputStream in) |
V |
put(K key,
V value)
Always throws UnsupportedOperationException.
|
void |
putAll(Map<? extends K,? extends V> c) |
V |
remove(Object key)
Always throws UnsupportedOperationException.
|
V |
set(K key,
V value)
Set a header value.
|
V |
set(K key,
V value,
boolean replace)
Set a header value or optionally replace it if it already exists.
|
void |
setReadOnly() |
int |
size()
Returns the number of entries (distinct keys) in this dictionary.
|
String |
toString() |
Collection<V> |
values() |
public Headers(int initialCapacity)
initialCapacity
- The initial capacity of this Headers object.public Headers(Dictionary<? extends K,? extends V> values)
values
- The initial dictionary for this Headers object.IllegalArgumentException
- If a case-variant of the key is
in the dictionary parameter.public Enumeration<K> keys()
keys
in class Dictionary<K,V>
public Enumeration<V> elements()
elements
in class Dictionary<K,V>
public V set(K key, V value, boolean replace)
key
- Key name.value
- Value of the key or null to remove key.replace
- A value of true will allow a previous
value of the key to be replaced. A value of false
will cause an IllegalArgumentException to be thrown
if a previous value of the key exists.IllegalArgumentException
- If a case-variant of the key is
already present.public V set(K key, V value)
key
- Key name.value
- Value of the key or null to remove key.IllegalArgumentException
- If a case-variant of the key is
already present.public void setReadOnly()
public int size()
public boolean isEmpty()
public V put(K key, V value)
put
in interface Map<K,V>
put
in class Dictionary<K,V>
key
- header name.value
- header value.UnsupportedOperationException
public V remove(Object key)
remove
in interface Map<K,V>
remove
in class Dictionary<K,V>
key
- header name.UnsupportedOperationException
public static Headers<String,String> parseManifest(InputStream in) throws BundleException
BundleException
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
public boolean containsValue(Object value)
containsValue
in interface Map<K,V>
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.