K - Type of the keysV - Type of the valuespublic class CaseInsensitiveHashMap<K,V>
extends org.apache.commons.collections4.map.AbstractHashedMap<K,V>
org.apache.commons.collections4.map.AbstractHashedMap.EntrySet<K,V>, org.apache.commons.collections4.map.AbstractHashedMap.EntrySetIterator<K,V>, org.apache.commons.collections4.map.AbstractHashedMap.HashEntry<K,V>, org.apache.commons.collections4.map.AbstractHashedMap.HashIterator<K,V>, org.apache.commons.collections4.map.AbstractHashedMap.HashMapIterator<K,V>, org.apache.commons.collections4.map.AbstractHashedMap.KeySet<K>, org.apache.commons.collections4.map.AbstractHashedMap.KeySetIterator<K>, org.apache.commons.collections4.map.AbstractHashedMap.Values<V>, org.apache.commons.collections4.map.AbstractHashedMap.ValuesIterator<V>| Modifier and Type | Field and Description |
|---|---|
private static int |
NULL_HASH
Represents the null value
|
private boolean |
rtrim
Flag to indicate if the comparisons should be done ignoring right spaces.
|
| Constructor and Description |
|---|
CaseInsensitiveHashMap()
Default constructor.
|
CaseInsensitiveHashMap(boolean rtrim)
Default constructor.
|
CaseInsensitiveHashMap(int initialCapacity)
Create the map with the supplied initial capacity and load factor of 0.75.
|
CaseInsensitiveHashMap(int initialCapacity,
float loadFactor)
Create the map with the supplied initial capacity and load factor.
|
CaseInsensitiveHashMap(int initialCapacity,
float loadFactor,
int threshold)
Create the map with the supplied initial capacity, load factor and threshold.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
hash(java.lang.Object key)
Hash the supplied key.
|
protected boolean |
isEqualKey(java.lang.Object key1,
java.lang.Object key2)
Compare two keys.
|
static void |
main(java.lang.String[] args)
Profiling test comparing the native hash-map which needs lower-case and
this implementation which does the case-insensitive look-up implicitly.
|
addEntry, addMapping, calculateNewCapacity, calculateThreshold, checkCapacity, clear, clone, containsKey, containsValue, convertKey, createEntry, createEntrySetIterator, createKeySetIterator, createValuesIterator, destroyEntry, doReadObject, doWriteObject, ensureCapacity, entryHashCode, entryKey, entryNext, entrySet, entryValue, equals, get, getEntry, hashCode, hashIndex, init, isEmpty, isEqualValue, keySet, mapIterator, put, putAll, remove, removeEntry, removeMapping, reuseEntry, size, toString, updateEntry, valuesprivate static final int NULL_HASH
private boolean rtrim
public CaseInsensitiveHashMap()
public CaseInsensitiveHashMap(boolean rtrim)
rtrim - true only if the comparisons should be done without trailing spaces.
The rtrim will be automatically applied to the stored keys and the look-up keys.public CaseInsensitiveHashMap(int initialCapacity,
float loadFactor,
int threshold)
initialCapacity - Initial capacity of the map.loadFactor - Load factor value.threshold - Threshold value/public CaseInsensitiveHashMap(int initialCapacity)
initialCapacity - Initial capacity of the map.public CaseInsensitiveHashMap(int initialCapacity,
float loadFactor)
initialCapacity - Initial capacity of the map.loadFactor - Load factor value.protected int hash(java.lang.Object key)
protected boolean isEqualKey(java.lang.Object key1,
java.lang.Object key2)
public static void main(java.lang.String[] args)
args - Not required.