Class CaseInsensitiveKeyMap<V>

  • Type Parameters:
    V - Type of values placed in this Map.
    All Implemented Interfaces:
    java.util.Map<java.lang.String,​V>

    public class CaseInsensitiveKeyMap<V>
    extends java.util.AbstractMap<java.lang.String,​V>
    A Map implementation that uses case-insensitive (using Locale.ENGLISH) strings as keys.

    Keys must be instances of String. Note that this means that null keys are not permitted.

    This implementation is not thread-safe.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsKey​(java.lang.Object key)  
      java.util.Set<java.util.Map.Entry<java.lang.String,​V>> entrySet()  
      V get​(java.lang.Object key)  
      V put​(java.lang.String key, V value)  
      void putAll​(java.util.Map<? extends java.lang.String,​? extends V> m)
      V remove​(java.lang.Object key)  
      • Methods inherited from class java.util.AbstractMap

        clear, clone, containsValue, equals, hashCode, isEmpty, keySet, size, toString, values
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Constructor Detail

      • CaseInsensitiveKeyMap

        public CaseInsensitiveKeyMap()
    • Method Detail

      • get

        public V get​(java.lang.Object key)
        Specified by:
        get in interface java.util.Map<java.lang.String,​V>
        Overrides:
        get in class java.util.AbstractMap<java.lang.String,​V>
      • put

        public V put​(java.lang.String key,
                     V value)
        Specified by:
        put in interface java.util.Map<java.lang.String,​V>
        Overrides:
        put in class java.util.AbstractMap<java.lang.String,​V>
      • putAll

        public void putAll​(java.util.Map<? extends java.lang.String,​? extends V> m)

        Use this method with caution. If the input Map contains duplicate keys when the keys are compared in a case insensitive manner then some values will be lost when inserting via this method.

        Specified by:
        putAll in interface java.util.Map<java.lang.String,​V>
        Overrides:
        putAll in class java.util.AbstractMap<java.lang.String,​V>
      • containsKey

        public boolean containsKey​(java.lang.Object key)
        Specified by:
        containsKey in interface java.util.Map<java.lang.String,​V>
        Overrides:
        containsKey in class java.util.AbstractMap<java.lang.String,​V>
      • remove

        public V remove​(java.lang.Object key)
        Specified by:
        remove in interface java.util.Map<java.lang.String,​V>
        Overrides:
        remove in class java.util.AbstractMap<java.lang.String,​V>
      • entrySet

        public java.util.Set<java.util.Map.Entry<java.lang.String,​V>> entrySet()
        Specified by:
        entrySet in interface java.util.Map<java.lang.String,​V>
        Specified by:
        entrySet in class java.util.AbstractMap<java.lang.String,​V>