Class HashMapIgnoreCase<K,V>

java.lang.Object
java.util.AbstractMap<String,V>
java.util.HashMap<String,V>
com.randomnoun.common.HashMapIgnoreCase<K,V>
All Implemented Interfaces:
Serializable, Cloneable, Map<String,V>

public class HashMapIgnoreCase<K,V> extends HashMap<String,V>
Case-preserving hashmap that allows case-insensitive lookups.
Author:
knoxg
See Also:
  • Constructor Details

  • Method Details

    • get

      public V get(Object key)
      Retrieve a value from the cache.
      Specified by:
      get in interface Map<K,V>
      Overrides:
      get in class HashMap<String,V>
      Parameters:
      key - key whose associated value is to be returned
      Returns:
      the value to which this map maps the specified key, or null if the map contains no mapping for this key.
    • put

      public V put(String key, V value)
      Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced.
      Specified by:
      put in interface Map<K,V>
      Overrides:
      put in class HashMap<String,V>
      Parameters:
      key - key with which the specified value is to be associated.
      value - value to be associated with the specified key.
      Returns:
      previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the HashMap previously associated null with the specified key.
      Throws:
      IllegalArgumentException - if the key parameter is not a String
    • containsKey

      public boolean containsKey(Object key)
      Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains at a mapping for a key k such that (key==null ? k==null : key.equals(k)). (There can be at most one such mapping.)
      Specified by:
      containsKey in interface Map<K,V>
      Overrides:
      containsKey in class HashMap<String,V>
      Parameters:
      key - key whose presence in this map is to be tested.
      Returns:
      true if this map contains a mapping for the specified key.
    • remove

      public V remove(Object key)
      Removes the mapping for this key from this map if present.
      Specified by:
      remove in interface Map<K,V>
      Overrides:
      remove in class HashMap<String,V>
      Parameters:
      key - key whose mapping is to be removed from the map.
      Returns:
      previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key.