public class LinkedCaseInsensitiveMap<V>
extends java.util.LinkedHashMap<java.lang.String,V>
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.
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.String,java.lang.String> |
caseInsensitiveKeys |
private java.util.Locale |
locale |
| Constructor and Description |
|---|
LinkedCaseInsensitiveMap()
Create a new LinkedCaseInsensitiveMap for the default Locale.
|
LinkedCaseInsensitiveMap(int initialCapacity)
Create a new LinkedCaseInsensitiveMap that wraps a <code>LinkedHashMap</code>
with the given initial capacity and stores lower-case keys according
to the default Locale.
|
LinkedCaseInsensitiveMap(int initialCapacity,
java.util.Locale locale)
Create a new LinkedCaseInsensitiveMap that wraps a <code>LinkedHashMap</code>
with the given initial capacity and stores lower-case keys according
to the given Locale.
|
LinkedCaseInsensitiveMap(java.util.Locale locale)
Create a new LinkedCaseInsensitiveMap that stores lower-case keys
according to the given Locale.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
protected java.lang.String |
convertKey(java.lang.String key)
Convert the given key to a case-insensitive key.
|
V |
get(java.lang.Object key) |
V |
put(java.lang.String key,
V value) |
void |
putAll(java.util.Map<? extends java.lang.String,? extends V> map) |
V |
remove(java.lang.Object key) |
containsValue, forEach, removeEldestEntry, replaceAllclone, compute, computeIfAbsent, computeIfPresent, entrySet, getOrDefault, isEmpty, keySet, merge, putIfAbsent, remove, replace, replace, size, valuesprivate final java.util.Map<java.lang.String,java.lang.String> caseInsensitiveKeys
private final java.util.Locale locale
public LinkedCaseInsensitiveMap()
String.toLowerCase()public LinkedCaseInsensitiveMap(java.util.Locale locale)
locale - the Locale to use for lower-case conversionString.toLowerCase(java.util.Locale)public LinkedCaseInsensitiveMap(int initialCapacity)
initialCapacity - the initial capacityString.toLowerCase()public LinkedCaseInsensitiveMap(int initialCapacity,
java.util.Locale locale)
initialCapacity - the initial capacitylocale - the Locale to use for lower-case conversionString.toLowerCase(java.util.Locale)public void putAll(java.util.Map<? extends java.lang.String,? extends V> map)
public boolean containsKey(java.lang.Object key)
public V get(java.lang.Object key)
public V remove(java.lang.Object key)
public void clear()
protected java.lang.String convertKey(java.lang.String key)
The default implementation converts the key to lower-case according to this Map's Locale.
key - the user-specified keyString.toLowerCase(java.util.Locale)