Package org.forgerock.http.util
Class CaseInsensitiveMap<V>
- Type Parameters:
V
- The type of the case insensitive map.
An implementation of a map whose keys are case-insensitive strings. All operations match
keys in a case-insensitive manner. The original cases of keys are retained, so the
keySet()
method for example returns the original keys.
Note: The behavior of this class is undefined when wrapping a map that has keys that would result in duplicate case-insensitive keys.
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.forgerock.util.MapDecorator
map
-
Constructor Summary
ConstructorDescriptionConstructs a new empty case-insensitive map.CaseInsensitiveMap
(Map<String, V> map) Wraps an existing map with a new case insensitive map. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Removes all of the mappings from the map.boolean
containsKey
(Object key) Returnstrue
if this map contains a mapping for the specified key.Returns the value to which the specified key is mapped, ornull
if the map contains no mapping for the key.Associates the specified value with the specified key in the map.void
Copies all of the mappings from the specified map to the map.Removes the mapping for a key from the map if it is present.void
sync()
Synchronizes the keys of this case insensitive map and those of the map it is wrapping.Methods inherited from class org.forgerock.util.MapDecorator
containsValue, entrySet, equals, hashCode, isEmpty, keySet, size, values
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
CaseInsensitiveMap
public CaseInsensitiveMap()Constructs a new empty case-insensitive map. The backing map is a newHashMap
with default initial capacity and load factor. -
CaseInsensitiveMap
Wraps an existing map with a new case insensitive map.- Parameters:
map
- the map to wrap with a new case insensitive map.
-
-
Method Details
-
sync
public void sync()Synchronizes the keys of this case insensitive map and those of the map it is wrapping. This is necessary if the underlying map is modified directly and this map needs to be resynchronized. -
clear
public void clear()Description copied from class:MapDecorator
Removes all of the mappings from the map. -
containsKey
Description copied from class:MapDecorator
Returnstrue
if this map contains a mapping for the specified key.- Specified by:
containsKey
in interfaceMap<String,
V> - Overrides:
containsKey
in classMapDecorator<String,
V> - Parameters:
key
- the key whose presence in this map is to be tested.- Returns:
true
if this map contains a mapping for the specified key.
-
put
Description copied from class:MapDecorator
Associates the specified value with the specified key in the map. -
putAll
Description copied from class:MapDecorator
Copies all of the mappings from the specified map to the map. -
get
Description copied from class:MapDecorator
Returns the value to which the specified key is mapped, ornull
if the map contains no mapping for the key. -
remove
Description copied from class:MapDecorator
Removes the mapping for a key from the map if it is present.
-