Class CaseInsensitiveDictionary<V>

  • Type Parameters:
    V - the type for the stored values.

    @Internal
    public final class CaseInsensitiveDictionary<V>
    extends Object
    Wraps a ConcurrentHashMap having all keys as Strings and ensures all keys are lowercased. It does assume keys and arguments are never null, preferring to throw a NPE over adding unnecessary checks. The public exposed methods are similar to the ones on Map, but not all Map methods are exposed - only a selection we actually need; this implies it doesn't implement Map; nothing stops us to make it implement Map but at time of writing it seems unnecessary for our purposes.
    • Constructor Detail

      • CaseInsensitiveDictionary

        public CaseInsensitiveDictionary()
    • Method Detail

      • get

        public V get​(String key)
      • unmodifiableKeySet

        public Set<String> unmodifiableKeySet()
        Contrary to traditional Map, we make the return unmodifiable.
        Returns:
        the map's keySet
      • unmodifiableEntrySet

        public Set<Map.Entry<String,​V>> unmodifiableEntrySet()
        Contrary to traditional Map, we make the return unmodifiable.
        Returns:
        the map's entrySet
      • put

        public V put​(String key,
                     V value)
      • remove

        public V remove​(String key)
      • containsKey

        public boolean containsKey​(String key)
      • clear

        public void clear()