public class IgnoreCaseMap<V>
extends java.util.AbstractMap<K,V>
implements java.io.Serializable, java.lang.Cloneable
Map decorator that makes the mappings in the backing map
case insensitive
(this is implemented by converting all keys to uppercase),
if the keys used are Strings. If the keys
used are not Strings, it wil work as a normal
java.util.Map.
Map,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<K,java.util.Map.Entry<K,V>> |
entries |
protected int |
modCount |
| Constructor and Description |
|---|
IgnoreCaseMap()
Constructs a new empty
Map. |
IgnoreCaseMap(java.util.Map<java.lang.String,? extends V> pMap)
Constructs a new
Map with the same key-value mappings as the
given Map. |
IgnoreCaseMap(java.util.Map pBacking,
java.util.Map<java.lang.String,? extends V> pContents)
Constructs a new
Map with the same key-value mappings as the
given Map. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
protected java.lang.Object |
clone()
Returns a shallow copy of this
AbstractMap instance: the keys
and values themselves are not cloned. |
boolean |
containsKey(java.lang.Object pKey)
Tests if the specified object is a key in this map.
|
boolean |
containsValue(java.lang.Object pValue)
Returns
true if this map maps one or more keys to the
specified pValue. |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
V |
get(java.lang.Object pKey)
Returns the value to which the specified key is mapped in this
map.
|
protected void |
init()
Default implementation, does nothing.
|
boolean |
isEmpty() |
java.util.Set<K> |
keySet() |
protected java.util.Iterator<java.util.Map.Entry<java.lang.String,V>> |
newEntryIterator() |
protected java.util.Iterator<java.lang.String> |
newKeyIterator() |
protected java.util.Iterator<V> |
newValueIterator() |
V |
put(java.lang.String pKey,
V pValue)
Maps the specified key to the specified value in this map.
|
V |
remove(java.lang.Object pKey)
Removes the key (and its corresponding value) from this map.
|
protected java.util.Map.Entry<K,V> |
removeEntry(java.util.Map.Entry<K,V> pEntry)
Removes the given entry from the Map.
|
int |
size() |
protected static java.lang.Object |
toUpper(java.lang.Object pObject)
Converts the parameter to uppercase, if it's a String.
|
java.util.Collection<V> |
values() |
protected java.util.Map<K,java.util.Map.Entry<K,V>> entries
protected transient volatile int modCount
public IgnoreCaseMap()
Map.
The backing map will be a HashMappublic IgnoreCaseMap(java.util.Map<java.lang.String,? extends V> pMap)
Map with the same key-value mappings as the
given Map.
The backing map will be a HashMap
NOTE: As the keys in the given map parameter will be converted to
uppercase (if they are strings), any duplicate key/value pair where
key instanceof String && key.equalsIgnoreCase(otherKey)
is true, will be lost.pMap - the map whose mappings are to be placed in this map.public IgnoreCaseMap(java.util.Map pBacking,
java.util.Map<java.lang.String,? extends V> pContents)
Map with the same key-value mappings as the
given Map.
NOTE: The backing map is structuraly cahnged, and it should NOT be
accessed directly, after the wrapped map is created.
NOTE: As the keys in the given map parameter will be converted to
uppercase (if they are strings), any duplicate key/value pair where
key instanceof String && key.equalsIgnoreCase(otherKey)
is true, will be lost.pBacking - the backing map of this map. Must be either empty, or
the same map as pContents.pContents - the map whose mappings are to be placed in this map.
May be nulljava.lang.IllegalArgumentException - if pBacking is nulljava.lang.IllegalArgumentException - if pBacking differs from
pContent and is not empty.public V put(java.lang.String pKey, V pValue)
put in interface java.util.Map<java.lang.String,V>pKey - the map key.pValue - the value.public V get(java.lang.Object pKey)
get in interface java.util.Map<java.lang.String,V>pKey - a key in the mappublic V remove(java.lang.Object pKey)
remove in interface java.util.Map<java.lang.String,V>pKey - the key that needs to be removed.public boolean containsKey(java.lang.Object pKey)
containsKey in interface java.util.Map<java.lang.String,V>pKey - possible key.protected static java.lang.Object toUpper(java.lang.Object pObject)
protected java.util.Iterator<java.util.Map.Entry<java.lang.String,V>> newEntryIterator()
protected java.util.Iterator<java.lang.String> newKeyIterator()
protected java.util.Iterator<V> newValueIterator()
protected void init()
public int size()
size in interface java.util.Map<K,V>size in class java.util.AbstractMap<K,V>public void clear()
clear in interface java.util.Map<K,V>clear in class java.util.AbstractMap<K,V>public boolean isEmpty()
isEmpty in interface java.util.Map<K,V>isEmpty in class java.util.AbstractMap<K,V>public boolean containsValue(java.lang.Object pValue)
true if this map maps one or more keys to the
specified pValue. More formally, returns true if and only if
this map contains at least one mapping to a pValue v such that
(pValue==null ? v==null : pValue.equals(v)).
This implementation requires time linear in the map size for this
operation.containsValue in interface java.util.Map<K,V>containsValue in class java.util.AbstractMap<K,V>pValue - pValue whose presence in this map is to be tested.true if this map maps one or more keys to the
specified pValue.public java.util.Collection<V> values()
values in interface java.util.Map<K,V>values in class java.util.AbstractMap<K,V>public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
entrySet in interface java.util.Map<K,V>entrySet in class java.util.AbstractMap<K,V>public java.util.Set<K> keySet()
keySet in interface java.util.Map<K,V>keySet in class java.util.AbstractMap<K,V>protected java.lang.Object clone()
throws java.lang.CloneNotSupportedException
AbstractMap instance: the keys
and values themselves are not cloned.clone in class java.util.AbstractMap<K,V>java.lang.CloneNotSupportedExceptionprotected java.util.Map.Entry<K,V> removeEntry(java.util.Map.Entry<K,V> pEntry)
pEntry - the entry to be removednull if nothing was removed.Copyright © 2018. All Rights Reserved.