Package org.rcsb.cif.model
Class LinkedCaseInsensitiveMap<V>
java.lang.Object
org.rcsb.cif.model.LinkedCaseInsensitiveMap<V>
- Type Parameters:
V- the value type
- All Implemented Interfaces:
Serializable,Cloneable,Map<String,V>
public class LinkedCaseInsensitiveMap<V> extends Object implements Map<String,V>, Serializable, Cloneable
LinkedHashMap variant that stores String keys in a case-insensitive
manner, for example for key-based access in a results table.
Preserves the original order as well as the original casing of keys, while allowing for contains, get and remove calls with any case of key.
Does not support null keys.
Part of the spring-framework but really we need just this one class.
- Since:
- 3.0
- Author:
- Juergen Hoeller, Phillip Webb
- See Also:
- Serialized Form
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor Description LinkedCaseInsensitiveMap()Create a new LinkedCaseInsensitiveMap that stores case-insensitive keys according to the default Locale (by default in lower case).LinkedCaseInsensitiveMap(int initialCapacity)Create a new LinkedCaseInsensitiveMap that wraps aLinkedHashMapwith the given initial capacity and stores case-insensitive keys according to the default Locale (by default in lower case).LinkedCaseInsensitiveMap(int initialCapacity, Locale locale)Create a new LinkedCaseInsensitiveMap that wraps aLinkedHashMapwith the given initial capacity and stores case-insensitive keys according to the given Locale (by default in lower case).LinkedCaseInsensitiveMap(Locale locale)Create a new LinkedCaseInsensitiveMap that stores case-insensitive keys according to the given Locale (by default in lower case). -
Method Summary
Modifier and Type Method Description voidclear()VcomputeIfAbsent(String key, Function<? super String,? extends V> mappingFunction)booleancontainsKey(Object key)booleancontainsValue(Object value)Set<Map.Entry<String,V>>entrySet()booleanequals(Object o)Vget(Object key)LocalegetLocale()Return the locale used by thisLinkedCaseInsensitiveMap.VgetOrDefault(Object key, V defaultValue)inthashCode()booleanisEmpty()Set<String>keySet()Vput(String key, V value)voidputAll(Map<? extends String,? extends V> map)VputIfAbsent(String key, V value)Vremove(Object key)intsize()StringtoString()Collection<V>values()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfPresent, forEach, merge, remove, replace, replace, replaceAll
-
Constructor Details
-
LinkedCaseInsensitiveMap
public LinkedCaseInsensitiveMap()Create a new LinkedCaseInsensitiveMap that stores case-insensitive keys according to the default Locale (by default in lower case).- See Also:
convertKey(String)
-
LinkedCaseInsensitiveMap
Create a new LinkedCaseInsensitiveMap that stores case-insensitive keys according to the given Locale (by default in lower case).- Parameters:
locale- the Locale to use for case-insensitive key conversion- See Also:
convertKey(String)
-
LinkedCaseInsensitiveMap
public LinkedCaseInsensitiveMap(int initialCapacity)Create a new LinkedCaseInsensitiveMap that wraps aLinkedHashMapwith the given initial capacity and stores case-insensitive keys according to the default Locale (by default in lower case).- Parameters:
initialCapacity- the initial capacity- See Also:
convertKey(String)
-
LinkedCaseInsensitiveMap
Create a new LinkedCaseInsensitiveMap that wraps aLinkedHashMapwith the given initial capacity and stores case-insensitive keys according to the given Locale (by default in lower case).- Parameters:
initialCapacity- the initial capacitylocale- the Locale to use for case-insensitive key conversion- See Also:
convertKey(String)
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceMap<String,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<String,V>
-
get
-
getOrDefault
- Specified by:
getOrDefaultin interfaceMap<String,V>
-
put
-
putAll
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceMap<String,V>
-
computeIfAbsent
- Specified by:
computeIfAbsentin interfaceMap<String,V>
-
remove
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
equals
-
hashCode
public int hashCode() -
toString
-
getLocale
Return the locale used by thisLinkedCaseInsensitiveMap. Used for case-insensitive key conversion.- Returns:
- the locale used
- See Also:
LinkedCaseInsensitiveMap(Locale),convertKey(String)
-