Package com.ning.http.client
Class FluentCaseInsensitiveStringsMap
java.lang.Object
com.ning.http.client.FluentCaseInsensitiveStringsMap
public class FluentCaseInsensitiveStringsMap
extends Object
implements Map<String,List<String>>, Iterable<Map.Entry<String,List<String>>>
An implementation of a
String -> List<String> map that adds a fluent interface, i.e. methods that
return this instance. This class differs from FluentStringsMap in that keys are treated in an
case-insensitive matter, i.e. case of the key doesn't matter when retrieving values or changing the map.
However, the map preserves the key case (of the first insert or replace) and returns the keys in their
original case in the appropriate methods (e.g. keySet()).-
Nested Class Summary
-
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionAdds the specified values and returns this object.add(String key, Collection<String> values) Adds the specified values and returns this object.Adds all key-values pairs from the given object to this object and returns this object.addAll(Map<String, Collection<String>> src) Adds all key-values pairs from the given map to this object and returns this object.voidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) Removes the values for the given key if present and returns this object.Removes the values for the given keys if present and returns this object.deleteAll(Collection<String> keys) Removes the values for the given keys if present and returns this object.entrySet()booleangetFirstValue(String key) Returns the value for the given key.getJoinedValue(String key, String delimiter) Returns the values for the given key joined into a single string using the given delimiter.inthashCode()booleanisEmpty()iterator()keySet()voidReplace the values for all keys from the given map that are also present in this object, with the values from the given map.replaceAll(Map<? extends String, ? extends Collection<String>> src) Replace the values for all keys from the given map that are also present in this object, with the values from the given map.replaceWith(String key, String... values) Replaces the values for the given key with the given values.replaceWith(String key, Collection<String> values) Replaces the values for the given key with the given values.intsize()toString()values()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
FluentCaseInsensitiveStringsMap
public FluentCaseInsensitiveStringsMap() -
FluentCaseInsensitiveStringsMap
-
FluentCaseInsensitiveStringsMap
-
-
Method Details
-
add
-
add
Adds the specified values and returns this object.- Parameters:
key- The keyvalues- The value(s); if the array is null then this method has no effect. Individual null values are turned into empty strings- Returns:
- This object
-
add
Adds the specified values and returns this object.- Parameters:
key- The keyvalues- The value(s); if null then this method has no effect. Use an empty collection to generate an empty value- Returns:
- This object
-
addAll
Adds all key-values pairs from the given object to this object and returns this object.- Parameters:
src- The source object- Returns:
- This object
-
addAll
Adds all key-values pairs from the given map to this object and returns this object.- Parameters:
src- The source map- Returns:
- This object
-
replaceWith
Replaces the values for the given key with the given values.- Parameters:
key- The keyvalues- The new values- Returns:
- This object
-
replaceWith
Replaces the values for the given key with the given values.- Parameters:
key- The keyvalues- The new values- Returns:
- This object
-
replaceAll
Replace the values for all keys from the given map that are also present in this object, with the values from the given map. All key-values from the given object that are not present in this object, will be added to it.- Parameters:
src- The source object- Returns:
- This object
-
replaceAll
public FluentCaseInsensitiveStringsMap replaceAll(Map<? extends String, ? extends Collection<String>> src) Replace the values for all keys from the given map that are also present in this object, with the values from the given map. All key-values from the given object that are not present in this object, will be added to it.- Parameters:
src- The source map- Returns:
- This object
-
put
-
putAll
-
delete
Removes the values for the given key if present and returns this object.- Parameters:
key- The key- Returns:
- This object
-
deleteAll
Removes the values for the given keys if present and returns this object.- Parameters:
keys- The keys- Returns:
- This object
-
deleteAll
Removes the values for the given keys if present and returns this object.- Parameters:
keys- The keys- Returns:
- This object
-
remove
-
clear
public void clear() -
iterator
-
keySet
-
entrySet
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceMap<String,List<String>>
-
containsValue
- Specified by:
containsValuein interfaceMap<String,List<String>>
-
getFirstValue
Returns the value for the given key. If there are multiple values for this key, then only the first one will be returned.- Parameters:
key- The key- Returns:
- The first value
-
getJoinedValue
Returns the values for the given key joined into a single string using the given delimiter.- Parameters:
key- The key- Returns:
- The value as a single string
-
get
-
values
-
equals
-
hashCode
public int hashCode() -
toString
-