public class CaseInsensitiveHashMap extends org.apache.commons.collections.map.AbstractHashedMap implements Serializable
Map
.
As entries are added to the map, keys hash values are lowercase hash codes of the key. the
Real key case is preserved.
The keySet()
method returns all keys in their original case
Note that CaseInsensitiveMap is not synchronized and is not thread-safe.
If you wish to use this map from multiple threads concurrently, you must use
appropriate synchronization. The simplest approach is to wrap this map
using Collections.synchronizedMap(Map)
. This class may throw
exceptions when accessed by concurrent threads without synchronization.org.apache.commons.collections.map.AbstractHashedMap.EntrySet, org.apache.commons.collections.map.AbstractHashedMap.EntrySetIterator, org.apache.commons.collections.map.AbstractHashedMap.HashEntry, org.apache.commons.collections.map.AbstractHashedMap.HashIterator, org.apache.commons.collections.map.AbstractHashedMap.HashMapIterator, org.apache.commons.collections.map.AbstractHashedMap.KeySet, org.apache.commons.collections.map.AbstractHashedMap.KeySetIterator, org.apache.commons.collections.map.AbstractHashedMap.Values, org.apache.commons.collections.map.AbstractHashedMap.ValuesIterator
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
data, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_THRESHOLD, entrySet, GETKEY_INVALID, GETVALUE_INVALID, keySet, loadFactor, MAXIMUM_CAPACITY, modCount, NO_NEXT_ENTRY, NO_PREVIOUS_ENTRY, NULL, REMOVE_INVALID, SETVALUE_INVALID, size, threshold, values
Constructor and Description |
---|
CaseInsensitiveHashMap()
Constructs a new empty map with default size and load factor.
|
CaseInsensitiveHashMap(int initialCapacity)
Constructs a new, empty map with the specified initial capacity.
|
CaseInsensitiveHashMap(int initialCapacity,
float loadFactor)
Constructs a new, empty map with the specified initial capacity and
load factor.
|
CaseInsensitiveHashMap(Map map)
Constructor copying elements from another map.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Clones the map without cloning the keys or values.
|
protected int |
hash(Object key)
Creates a hash value from the lower case value of the key.
|
protected boolean |
isEqualKey(Object key1,
Object key2)
Overloads the default behaviour to compare the keys without case sensitivity
|
addEntry, addMapping, calculateNewCapacity, calculateThreshold, checkCapacity, clear, 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, values
public CaseInsensitiveHashMap()
public CaseInsensitiveHashMap(int initialCapacity) throws IllegalArgumentException
initialCapacity
- the initial capacityIllegalArgumentException
- if the initial capacity is less than onepublic CaseInsensitiveHashMap(int initialCapacity, float loadFactor) throws IllegalArgumentException
initialCapacity
- the initial capacityloadFactor
- the load factorIllegalArgumentException
- if the initial capacity is less than oneIllegalArgumentException
- if the load factor is less than zeropublic CaseInsensitiveHashMap(Map map)
map
- the map to copyNullPointerException
- if the map is nullprotected int hash(Object key)
hash
in class org.apache.commons.collections.map.AbstractHashedMap
key
- the key value to hashprotected boolean isEqualKey(Object key1, Object key2)
isEqualKey
in class org.apache.commons.collections.map.AbstractHashedMap
key1
- the first keykey2
- the key to compare againstpublic Object clone()
clone
in class org.apache.commons.collections.map.AbstractHashedMap
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.