Class Headers
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given value to the entry of the specified key.voidAdds the given values to the entry of the specified key.voidAdds all the entries of the given map to this.voidclear()booleanConvenience method for checking whether or not a named header contains a specific value.booleancontainsIgnoreCase(String key, String value) Convenience method for checking whether or not a named header contains a specific value, regardless of case.booleancontainsKey(Object key) booleancontainsValue(Object value) entries()Returns an unmodifiable list of all key-value pairs of this.entrySet()booleanConvenience method for retrieving the first value of a named header field.inthashCode()booleanisEmpty()booleanConvenience method for checking whether a named header field is true.keySet()Convenience method to callput(String, List)with a singleton list that contains the specified value.voidbooleanRemoves the given value from the entry of the specified key.intsize()toString()values()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
Headers
public Headers()
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceMap<String,List<String>>
-
containsValue
- Specified by:
containsValuein interfaceMap<String,List<String>>
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
toString
-
equals
-
hashCode
public int hashCode() -
contains
Convenience method for checking whether or not a named header contains a specific value. If the named header is not set, or if the given value is not contained within that header's value list, this method returns false.
NOTE: This method is case-SENSITIVE.
- Parameters:
key- The key whose values to search in.value- The values to search for.- Returns:
- True if the given value was found in the named header.
- See Also:
-
containsIgnoreCase
Convenience method for checking whether or not a named header contains a specific value, regardless of case. If the named header is not set, or if the given value is not contained within that header's value list, this method returns false.
NOTE: This method is case-INSENSITIVE.
- Parameters:
key- The key whose values to search in.value- The values to search for, ignoring case.- Returns:
- True if the given value was found in the named header.
- See Also:
-
add
Adds the given value to the entry of the specified key. If no entry exists for the given key, a new one is created containing only the given value.
- Parameters:
key- The key with which the specified value is to be associated.value- The value to be added to the list associated with the specified key.
-
add
Adds the given values to the entry of the specified key. If no entry exists for the given key, a new one is created containing only the given values.
- Parameters:
key- The key with which the specified value is to be associated.values- The values to be added to the list associated with the specified key.
-
addAll
Adds all the entries of the given map to this. This is the same as calling
add(String, List)for each entry invalues.- Parameters:
values- The values to be added to this.
-
put
Convenience method to call
put(String, List)with a singleton list that contains the specified value.- Parameters:
key- The key of the entry to put.value- The value to put.- Returns:
- The previous value associated with
key, ornullif there was no mapping forkey.
-
remove
Removes the given value from the entry of the specified key.- Parameters:
key- the key of the entry to remove fromvalue- the value to remove from the entry- Returns:
- true if the value was removed
-
getFirst
Convenience method for retrieving the first value of a named header field. If the header is not set, or if the value list is empty, this method returns null.- Parameters:
key- the key whose first value to return.- Returns:
- the first value of the named header, or null.
-
isTrue
Convenience method for checking whether a named header field is true. To satisfy this, the header field needs to have at least 1 entry, and Boolean.valueOf() of all its values must parse as true.- Parameters:
key- the key whose values to parse as a boolean- Returns:
- the boolean value of the named header
-
entries
Returns an unmodifiable list of all key-value pairs of this. This provides a flattened view on the content of this map.- Returns:
- the collection of entries
-