Package edu.indiana.lib.twinpeaks.util
Class CaseBlindHashMap
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap
-
- edu.indiana.lib.twinpeaks.util.CaseBlindHashMap
-
- All Implemented Interfaces:
Serializable,Cloneable,Map
public class CaseBlindHashMap extends HashMap
CaseBlindHashMap - a HashMap extension, usingStrings 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()andstringKeyIterator().- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCaseBlindHashMap.CaseBlindStringA crude, case insensitive string - used internally to represent key values.-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description CaseBlindHashMap()ConstructorsCaseBlindHashMap(int initCap)CaseBlindHashMap(int initCap, float loadFactor)CaseBlindHashMap(CaseBlindHashMap map)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(String key)Does the map contain this key?Objectget(String key)Fetch a value by name - null keys are not supportedvoidput(String key, Object value)Add the key/value pair to the map - null values are not supportedvoidremove(String key)Remove a key/value pair from this mapIteratorstringKeyIterator()Get an Iterator to the String based key setSetstringKeySet()Get the set of keys contained in this map.-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
-
-
-
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 simpleStrings (not theCaseBlindStrings 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 namevalue- 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
-
-