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
ConstructorsConstructorDescriptionConstructs 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 TypeMethodDescriptionvoidclear()Removes all of the mappings from the map.booleancontainsKey(Object key) Returnstrueif this map contains a mapping for the specified key.Returns the value to which the specified key is mapped, ornullif the map contains no mapping for the key.Associates the specified value with the specified key in the map.voidCopies all of the mappings from the specified map to the map.Removes the mapping for a key from the map if it is present.voidsync()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, valuesMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods 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 newHashMapwith 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:MapDecoratorRemoves all of the mappings from the map. -
containsKey
Description copied from class:MapDecoratorReturnstrueif this map contains a mapping for the specified key.- Specified by:
containsKeyin interfaceMap<String,V> - Overrides:
containsKeyin classMapDecorator<String,V> - Parameters:
key- the key whose presence in this map is to be tested.- Returns:
trueif this map contains a mapping for the specified key.
-
put
Description copied from class:MapDecoratorAssociates the specified value with the specified key in the map. -
putAll
Description copied from class:MapDecoratorCopies all of the mappings from the specified map to the map. -
get
Description copied from class:MapDecoratorReturns the value to which the specified key is mapped, ornullif the map contains no mapping for the key. -
remove
Description copied from class:MapDecoratorRemoves the mapping for a key from the map if it is present.
-