org.sakaiproject.tool.util
Class CaseBlindHashMap

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.HashMap
          extended byorg.sakaiproject.tool.util.CaseBlindHashMap
All Implemented Interfaces:
Cloneable, Map, Serializable

public class CaseBlindHashMap
extends HashMap

CaseBlindHashMap - a HashMap extension, using Strings as key values.

Internally, keys are case insensitive: ABC = abc.

Two methods have been added to facilitate working with Sets of key strings. See stringKeySet() and stringKeyIterator().

See Also:
Serialized Form

Nested Class Summary
static class CaseBlindHashMap.CaseBlindString
          A crude, case insensitive string - used internally to represent key values.
 
Constructor Summary
CaseBlindHashMap()
          Constructors
CaseBlindHashMap(CaseBlindHashMap map)
           
CaseBlindHashMap(int initCap)
           
CaseBlindHashMap(int initCap, float loadFactor)
           
 
Method Summary
 boolean containsKey(String key)
          Does the map contain this key?
 Object get(String key)
          Fetch a value by name - null keys are not supported
 void put(String key, Object value)
          Add the key/value pair to the map - null values are not supported
 void remove(String key)
          Remove a key/value pair from this map
 Iterator stringKeyIterator()
          Get an Iterator to the String based key set
 Set stringKeySet()
          Get the set of keys contained in this map.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, 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

CaseBlindHashMap

public CaseBlindHashMap()
Constructors


CaseBlindHashMap

public CaseBlindHashMap(CaseBlindHashMap map)

CaseBlindHashMap

public CaseBlindHashMap(int initCap)

CaseBlindHashMap

public CaseBlindHashMap(int initCap,
                        float loadFactor)
Method Detail

stringKeySet

public Set stringKeySet()
Get the set of keys contained in this map. Keys values are returned as simple Strings (not the CaseBlindStrings used internally).

This is accopmlished by making a copy of the original map - modifications made to this copy are not reflected in the original.

Returns:
The set of keys

stringKeyIterator

public Iterator stringKeyIterator()
Get an Iterator to the String based key set

Returns:
An iterator to the key set

containsKey

public boolean containsKey(String key)
Does the map contain this key?

Parameters:
key - The key to look up
Returns:
true If the key is present in the map

get

public Object get(String key)
Fetch a value by name - null keys are not supported

Parameters:
key - The key to look up
Returns:
The associated value object

put

public void put(String key,
                Object value)
Add the key/value pair to the map - null values are not supported

Parameters:
key - The key name
value - The object to store

remove

public void remove(String key)
Remove a key/value pair from this map

Parameters:
key - Non-null key to remove