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
).
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 |
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) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, 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 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