public class HeaderMap extends Object implements Map<String,String>
A key-value pair in this Map corresponds to a name-value pair of a MIME header. Because MIME header names are case-insensitive, this Map treats keys as case-insensitive too. Note that this violates the general contracts of Map.
The implementation of this class is optimized for well-known headers (see Headers
).
For methods xGet(key)
, xContainsKey(key)
,
xPut(key,value)
, xRemove(key)
,
`key` must be a constant value defined in Headers
.
For example: `map.xGet(Headers.Host);`
Constructor and Description |
---|
HeaderMap()
Create an empty HeaderMap instance.
|
HeaderMap(Map<String,String> m)
Create a HeaderMap instance, populated by `m`.
|
Instance Methods | |
---|---|
void |
freeze()
Freeze this map so that it cannot be modified anymore.
|
int |
size() |
boolean |
isEmpty() |
boolean |
containsValue(Object value) |
void |
forEach(BiConsumer<? super String,? super String> action) |
void |
clear() |
Set<String> |
keySet() |
Collection<String> |
values() |
Set<Map.Entry<String,String>> |
entrySet() |
void |
putAll(Map<? extends String,? extends String> m) |
String |
toString() |
String |
get(Object key) |
boolean |
containsKey(Object key) |
String |
remove(Object key) |
String |
put(String key,
String value) |
String |
xGet(Object key) |
boolean |
xContainsKey(Object key) |
String |
xRemove(Object key) |
String |
xPut(String key,
String value) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
public void freeze()
After this method is called, any mutating method like put(key,value) will throw UnsupportedOperationException.
public boolean containsValue(Object value)
containsValue
in interface Map<String,String>
public void forEach(BiConsumer<? super String,? super String> action)
public boolean containsKey(Object key)
containsKey
in interface Map<String,String>
public String put(String key, String value) throws IllegalArgumentException
put
in interface Map<String,String>
IllegalArgumentException
public boolean xContainsKey(Object key)
key
- must be a constant value defined in Headers