toolbox.dao
Class IgnoreKeyCaseMap

Package class diagram package IgnoreKeyCaseMap
java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap
          extended by toolbox.dao.IgnoreKeyCaseMap
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map

public class IgnoreKeyCaseMap
extends java.util.HashMap

Conveniece class to retrieve values from a HashMap using case insensitive keys.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
IgnoreKeyCaseMap()
          Default constructor
IgnoreKeyCaseMap(int capacity)
          Construct a new Map with the given capacity.
IgnoreKeyCaseMap(java.util.Map m)
          Construct a new map with the mappings of the given map.
 
Method Summary
 boolean containsKey(java.lang.Object key)
          Returns true if this map contains a mapping for the specified key ignoring the key case.
 java.lang.Object get(java.lang.Object key)
          Return a value from this map ignoring the key case.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Associates the specified value with the specified key in this map ignoring the key case.
 java.lang.Object remove(java.lang.Object key)
          Removes the mapping for this key from this map if it is present ignoring the key case.
 
Methods inherited from class java.util.HashMap
clear, clone, containsValue, entrySet, isEmpty, keySet, putAll, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

IgnoreKeyCaseMap

public IgnoreKeyCaseMap()
Default constructor


IgnoreKeyCaseMap

public IgnoreKeyCaseMap(int capacity)
Construct a new Map with the given capacity.

Parameters:
capacity - Initial Map capacity

IgnoreKeyCaseMap

public IgnoreKeyCaseMap(java.util.Map m)
Construct a new map with the mappings of the given map.

Parameters:
m - Map whose mappings must be placed in this map.
Method Detail

get

public java.lang.Object get(java.lang.Object key)
Return a value from this map ignoring the key case.

Specified by:
get in interface java.util.Map
Overrides:
get in class java.util.HashMap
Parameters:
key - Object containing key.
Returns:
Object containing value or null if no value exists.

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Associates the specified value with the specified key in this map ignoring the key case.

Specified by:
put in interface java.util.Map
Overrides:
put in class java.util.HashMap
Parameters:
key - String containing key to associate value with.
value - Object containing value.
Returns:
Object previous value associated with key or null.

remove

public java.lang.Object remove(java.lang.Object key)
Removes the mapping for this key from this map if it is present ignoring the key case.

Specified by:
remove in interface java.util.Map
Overrides:
remove in class java.util.HashMap
Parameters:
key - Key whose mapping will be removed.
Returns:
Previous value associated with key.

containsKey

public boolean containsKey(java.lang.Object key)
Returns true if this map contains a mapping for the specified key ignoring the key case.

Specified by:
containsKey in interface java.util.Map
Overrides:
containsKey in class java.util.HashMap
Parameters:
key - key whose presence in this map is to be tested.
Returns:
boolean indicating the existence of the key in this map.