Class LinkedCaseInsensitiveMap<V>

java.lang.Object
nl.basjes.parse.useragent.utils.springframework.util.LinkedCaseInsensitiveMap<V>
Type Parameters:
V - the value type
All Implemented Interfaces:
Serializable, Cloneable, Map<String,V>

public class LinkedCaseInsensitiveMap<V> extends Object implements Map<String,V>, Serializable, Cloneable
{link LinkedHashMap} variant that stores String keys in a case-insensitive manner, for example for key-based access in a results table.

Preserves the original order as well as the original casing of keys, while allowing for contains, get and remove calls with any case of key.

Does not support null keys.

Since:
3.0
Author:
Juergen Hoeller, Phillip Webb
See Also:
  • Constructor Details

    • LinkedCaseInsensitiveMap

      public LinkedCaseInsensitiveMap()
      Create a new LinkedCaseInsensitiveMap that stores case-insensitive keys according to the default Locale (by default in lower case). see #convertKey(String)
    • LinkedCaseInsensitiveMap

      public LinkedCaseInsensitiveMap(@Nullable Locale locale)
      Create a new LinkedCaseInsensitiveMap that stores case-insensitive keys according to the given Locale (in lower case).
      Parameters:
      locale - the Locale to use for case-insensitive key conversion see #convertKey(String)
    • LinkedCaseInsensitiveMap

      public LinkedCaseInsensitiveMap(int expectedSize)
      Create a new LinkedCaseInsensitiveMap that wraps a {link LinkedHashMap} with an initial capacity that can accommodate the specified number of elements without any immediate resize/rehash operations to be expected, storing case-insensitive keys according to the default Locale (in lower case).
      Parameters:
      expectedSize - the expected number of elements (with a corresponding capacity to be derived so that no resize/rehash operations are needed) see CollectionUtils#newHashMap(int) see #convertKey(String)
    • LinkedCaseInsensitiveMap

      public LinkedCaseInsensitiveMap(int expectedSize, @Nullable Locale locale)
      Create a new LinkedCaseInsensitiveMap that wraps a {link LinkedHashMap} with an initial capacity that can accommodate the specified number of elements without any immediate resize/rehash operations to be expected, storing case-insensitive keys according to the given Locale (in lower case).
      Parameters:
      expectedSize - the expected number of elements (with a corresponding capacity to be derived so that no resize/rehash operations are needed)
      locale - the Locale to use for case-insensitive key conversion see CollectionUtils#newHashMap(int) see #convertKey(String)
  • Method Details