org.apache.camel.util
Class CaseInsensitiveMap

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<String,Object>
          extended by org.apache.camel.util.CaseInsensitiveMap
All Implemented Interfaces:
Serializable, Cloneable, Map<String,Object>

public class CaseInsensitiveMap
extends HashMap<String,Object>

A map that uses case insensitive keys, but preserves the original keys in the keySet.

This map allows you to do lookup using case insensitive keys so you can retrieve the value without worrying about whether some transport protocol affects the keys such as Http and Mail protocols can do.

When copying from this map to a regular Map such as HashMap then the original keys are copied over and you get the old behavior back using a regular Map with case sensitive keys.

This map is not designed to be thread safe as concurrent access to it is not supposed to be performed by the Camel routing engine.

Version:
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
CaseInsensitiveMap()
           
CaseInsensitiveMap(int initialCapacity)
           
CaseInsensitiveMap(int initialCapacity, float loadFactor)
           
CaseInsensitiveMap(Map<? extends String,?> map)
           
 
Method Summary
 void clear()
           
 boolean containsKey(Object key)
           
 Set<Map.Entry<String,Object>> entrySet()
           
 Object get(Object key)
           
 Object put(String key, Object value)
           
 void putAll(Map<? extends String,?> map)
           
 Object remove(Object key)
           
 
Methods inherited from class java.util.HashMap
clone, containsValue, isEmpty, keySet, 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

CaseInsensitiveMap

public CaseInsensitiveMap()

CaseInsensitiveMap

public CaseInsensitiveMap(Map<? extends String,?> map)

CaseInsensitiveMap

public CaseInsensitiveMap(int initialCapacity,
                          float loadFactor)

CaseInsensitiveMap

public CaseInsensitiveMap(int initialCapacity)
Method Detail

get

public Object get(Object key)
Specified by:
get in interface Map<String,Object>
Overrides:
get in class HashMap<String,Object>

put

public Object put(String key,
                  Object value)
Specified by:
put in interface Map<String,Object>
Overrides:
put in class HashMap<String,Object>

putAll

public void putAll(Map<? extends String,?> map)
Specified by:
putAll in interface Map<String,Object>
Overrides:
putAll in class HashMap<String,Object>

remove

public Object remove(Object key)
Specified by:
remove in interface Map<String,Object>
Overrides:
remove in class HashMap<String,Object>

clear

public void clear()
Specified by:
clear in interface Map<String,Object>
Overrides:
clear in class HashMap<String,Object>

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<String,Object>
Overrides:
containsKey in class HashMap<String,Object>

entrySet

public Set<Map.Entry<String,Object>> entrySet()
Specified by:
entrySet in interface Map<String,Object>
Overrides:
entrySet in class HashMap<String,Object>


Apache CAMEL