Class CaseInsensitiveMap<T>
- java.lang.Object
- 
- java.util.AbstractMap<K,V>
- 
- java.util.HashMap<java.lang.String,T>
- 
- com.saperion.common.lang.collection.CaseInsensitiveMap<T>
 
 
 
- 
- Type Parameters:
- T- the type of mapped values
 - All Implemented Interfaces:
- java.io.Serializable,- java.lang.Cloneable,- java.util.Map<java.lang.String,T>
 
 public class CaseInsensitiveMap<T> extends java.util.HashMap<java.lang.String,T>A CaseInsensitiveMapis a specializedHashMapwith case insensitive keys of typeString.All keys will be converted with String.toLowerCase(Locale)withLocale.ENGLISH.The keys are stored internally in lower case and all requests convert the specified key first and than compare it with the stored key as usual with Object.equals(Object).This implementation is not synchronized. If used by different threads concurrently, external synchronization is necessary. - Author:
- chm, agz
- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description CaseInsensitiveMap()Constructs an emptyCaseInsensitiveMapwith the default initial capacity (16) and the default load factor (0.75).CaseInsensitiveMap(int initialCapacity)Constructs an emptyCaseInsensitiveMapwith the specified initial capacity and the default load factor (0.75).CaseInsensitiveMap(int initialCapacity, float loadFactor)Constructs an emptyCaseInsensitiveMapwith the specified initial capacity and load factor.CaseInsensitiveMap(java.util.Map<? extends java.lang.String,? extends T> map)Constructs a newCaseInsensitiveMapwith the same mappings as the specifiedMap.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(java.lang.Object key)Tget(java.lang.Object key)TgetOrDefault(java.lang.Object key, T defaultValue)Tput(java.lang.String key, T value)voidputAll(java.util.Map<? extends java.lang.String,? extends T> m)Tremove(java.lang.Object key)- 
Methods inherited from class java.util.HashMapclear, clone, compute, computeIfAbsent, computeIfPresent, containsValue, entrySet, forEach, isEmpty, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, size, values
 
- 
 
- 
- 
- 
Constructor Detail- 
CaseInsensitiveMappublic CaseInsensitiveMap() Constructs an emptyCaseInsensitiveMapwith the default initial capacity (16) and the default load factor (0.75).
 - 
CaseInsensitiveMappublic CaseInsensitiveMap(int initialCapacity, float loadFactor)Constructs an emptyCaseInsensitiveMapwith the specified initial capacity and load factor.- Parameters:
- initialCapacity- the initial capacity
- loadFactor- the load factor
- Throws:
- java.lang.IllegalArgumentException- if the initial capacity is negative or the load factor is non-positive
 
 - 
CaseInsensitiveMappublic CaseInsensitiveMap(int initialCapacity) Constructs an emptyCaseInsensitiveMapwith the specified initial capacity and the default load factor (0.75).- Parameters:
- initialCapacity- the initial capacity.
- Throws:
- java.lang.IllegalArgumentException- if the initial capacity is negative.
 
 - 
CaseInsensitiveMappublic CaseInsensitiveMap(java.util.Map<? extends java.lang.String,? extends T> map) Constructs a newCaseInsensitiveMapwith the same mappings as the specifiedMap. TheCaseInsensitiveMapis created with default load factor (0.75) and an initial capacity sufficient to hold the mappings in the specifiedMap.- Parameters:
- map- the- Mapwhose mappings are to be placed in this map
- Throws:
- java.lang.NullPointerException- if the specified map is- null
 
 
- 
 - 
Method Detail- 
containsKeypublic boolean containsKey(java.lang.Object key) The key is interpreted case-insensitive.
 - 
getpublic T get(java.lang.Object key) The key is interpreted case-insensitive.
 - 
putpublic T put(java.lang.String key, T value) The key is converted to lower case before the mapping is stored.
 - 
removepublic T remove(java.lang.Object key) The key is interpreted case-insensitive.
 - 
putAllpublic void putAll(java.util.Map<? extends java.lang.String,? extends T> m) The keys in the given map are interpreted case-insensitive.
 
- 
 
-