Package io.github.connellite.collections
Class CaseInsensitiveHashMap<V>
- Type Parameters:
V- value type
- All Implemented Interfaces:
Serializable,Cloneable,Map<String,V>
HashMap with String keys compared case-insensitively. The key set and entries
expose the currently stored spelling (last successful put wins for that logical key).
Like HashMap, allows a single null key; it is not folded by case and is omitted
from the internal case-folding index. For speed and stable behavior, the default locale used to
fold case is Locale.ROOT (override via CaseInsensitiveHashMap(Locale)).
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
ConstructorsConstructorDescriptionCaseInsensitiveHashMap(int initialCapacity) CaseInsensitiveHashMap(int initialCapacity, float loadFactor) CaseInsensitiveHashMap(int initialCapacity, float loadFactor, Locale locale) CaseInsensitiveHashMap(int initialCapacity, Locale locale) CaseInsensitiveHashMap(Locale locale) CaseInsensitiveHashMap(Map<? extends String, ? extends V> m) CaseInsensitiveHashMap(Map<? extends String, ? extends V> m, Locale locale) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()clone()computeIfAbsent(String key, Function<? super String, ? extends V> mappingFunction) computeIfPresent(String key, BiFunction<? super String, ? super V, ? extends V> remappingFunction) booleancontainsKey(Object key) protected StringconvertKey(String key) Maps a user key to the form stored incaseInsensitiveKeys(default: lower case via this map's locale).entrySet()booleanvoidforEach(BiConsumer<? super String, ? super V> action) getOrDefault(Object key, V defaultValue) inthashCode()keySet()voidputIfAbsent(String key, V value) booleanbooleanvalues()Methods inherited from class java.util.HashMap
containsValue, isEmpty, replaceAll, sizeMethods inherited from class java.util.AbstractMap
toString
-
Constructor Details
-
CaseInsensitiveHashMap
public CaseInsensitiveHashMap() -
CaseInsensitiveHashMap
public CaseInsensitiveHashMap(int initialCapacity) -
CaseInsensitiveHashMap
public CaseInsensitiveHashMap(int initialCapacity, float loadFactor) -
CaseInsensitiveHashMap
- Parameters:
locale- locale forString.toLowerCase(Locale); ifnull,Locale.ROOTis used
-
CaseInsensitiveHashMap
-
CaseInsensitiveHashMap
-
CaseInsensitiveHashMap
-
CaseInsensitiveHashMap
-
-
Method Details
-
convertKey
Maps a user key to the form stored incaseInsensitiveKeys(default: lower case via this map's locale). -
containsKey
- Specified by:
containsKeyin interfaceMap<String,V> - Overrides:
containsKeyin classHashMap<String,V>
-
get
-
getOrDefault
- Specified by:
getOrDefaultin interfaceMap<String,V> - Overrides:
getOrDefaultin classHashMap<String,V>
-
put
-
putAll
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceMap<String,V> - Overrides:
putIfAbsentin classHashMap<String,V>
-
computeIfAbsent
- Specified by:
computeIfAbsentin interfaceMap<String,V> - Overrides:
computeIfAbsentin classHashMap<String,V>
-
computeIfPresent
public V computeIfPresent(String key, BiFunction<? super String, ? super V, ? extends V> remappingFunction) - Specified by:
computeIfPresentin interfaceMap<String,V> - Overrides:
computeIfPresentin classHashMap<String,V>
-
compute
-
merge
-
remove
-
remove
-
replace
-
replace
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
forEach
-
clone
-
equals
-
hashCode
public int hashCode()
-