类 LinkedCaseInsensitiveMap<V>
- java.lang.Object
- org.springframework.util.LinkedCaseInsensitiveMap<V>
- 类型参数:
V- the value type
- 所有已实现的接口:
Serializable,Cloneable,Map<String,V>
public class LinkedCaseInsensitiveMap<V> extends Object implements Map<String,V>, Serializable, Cloneable
LinkedHashMapvariant 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
nullkeys.- 从以下版本开始:
- 3.0
- 作者:
- Juergen Hoeller, Phillip Webb
- 另请参阅:
- 序列化表格
构造器概要
构造器 构造器 说明 LinkedCaseInsensitiveMap()Create a new LinkedCaseInsensitiveMap that stores case-insensitive keys according to the default Locale (by default in lower case).LinkedCaseInsensitiveMap(int initialCapacity)Create a new LinkedCaseInsensitiveMap that wraps aLinkedHashMapwith the given initial capacity and stores case-insensitive keys according to the default Locale (by default in lower case).LinkedCaseInsensitiveMap(int initialCapacity, Locale locale)Create a new LinkedCaseInsensitiveMap that wraps aLinkedHashMapwith the given initial capacity and stores case-insensitive keys according to the given Locale (by default in lower case).LinkedCaseInsensitiveMap(Locale locale)Create a new LinkedCaseInsensitiveMap that stores case-insensitive keys according to the given Locale (by default in lower case).
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidclear()LinkedCaseInsensitiveMap<V>clone()VcomputeIfAbsent(String key, Function<? super String,? extends V> mappingFunction)booleancontainsKey(Object key)booleancontainsValue(Object value)protected StringconvertKey(String key)Convert the given key to a case-insensitive key.Set<Map.Entry<String,V>>entrySet()booleanequals(Object other)Vget(Object key)LocalegetLocale()Return the locale used by thisLinkedCaseInsensitiveMap.VgetOrDefault(Object key, V defaultValue)inthashCode()booleanisEmpty()Set<String>keySet()Vput(String key, V value)voidputAll(Map<? extends String,? extends V> map)VputIfAbsent(String key, V value)Vremove(Object key)protected booleanremoveEldestEntry(Map.Entry<String,V> eldest)Determine whether this map should remove the given eldest entry.intsize()StringtoString()Collection<V>values()从接口继承的方法 java.util.Map
compute, computeIfPresent, forEach, merge, remove, replace, replace, replaceAll
构造器详细资料
LinkedCaseInsensitiveMap
public LinkedCaseInsensitiveMap()
Create a new LinkedCaseInsensitiveMap that stores case-insensitive keys according to the default Locale (by default in lower case).- 另请参阅:
convertKey(String)
LinkedCaseInsensitiveMap
public LinkedCaseInsensitiveMap(@Nullable Locale locale)
Create a new LinkedCaseInsensitiveMap that stores case-insensitive keys according to the given Locale (by default in lower case).- 参数:
locale- the Locale to use for case-insensitive key conversion- 另请参阅:
convertKey(String)
LinkedCaseInsensitiveMap
public LinkedCaseInsensitiveMap(int initialCapacity)
Create a new LinkedCaseInsensitiveMap that wraps aLinkedHashMapwith the given initial capacity and stores case-insensitive keys according to the default Locale (by default in lower case).- 参数:
initialCapacity- the initial capacity- 另请参阅:
convertKey(String)
LinkedCaseInsensitiveMap
public LinkedCaseInsensitiveMap(int initialCapacity, @Nullable Locale locale)
Create a new LinkedCaseInsensitiveMap that wraps aLinkedHashMapwith the given initial capacity and stores case-insensitive keys according to the given Locale (by default in lower case).- 参数:
initialCapacity- the initial capacitylocale- the Locale to use for case-insensitive key conversion- 另请参阅:
convertKey(String)
方法详细资料
containsKey
public boolean containsKey(Object key)
- 指定者:
containsKey在接口中Map<String,V>
containsValue
public boolean containsValue(Object value)
- 指定者:
containsValue在接口中Map<String,V>
getOrDefault
@Nullable public V getOrDefault(Object key, V defaultValue)
- 指定者:
getOrDefault在接口中Map<String,V>
putIfAbsent
@Nullable public V putIfAbsent(String key, @Nullable V value)
- 指定者:
putIfAbsent在接口中Map<String,V>
computeIfAbsent
@Nullable public V computeIfAbsent(String key, Function<? super String,? extends V> mappingFunction)
- 指定者:
computeIfAbsent在接口中Map<String,V>
clone
public LinkedCaseInsensitiveMap<V> clone()
getLocale
public Locale getLocale()
Return the locale used by thisLinkedCaseInsensitiveMap. Used for case-insensitive key conversion.- 从以下版本开始:
- 4.3.10
- 另请参阅:
LinkedCaseInsensitiveMap(Locale),convertKey(String)
convertKey
protected String convertKey(String key)
Convert the given key to a case-insensitive key.The default implementation converts the key to lower-case according to this Map's Locale.
- 参数:
key- the user-specified key- 返回:
- the key to use for storing
- 另请参阅:
String.toLowerCase(Locale)
removeEldestEntry
protected boolean removeEldestEntry(Map.Entry<String,V> eldest)
Determine whether this map should remove the given eldest entry.- 参数:
eldest- the candidate entry- 返回:
truefor removing it,falsefor keeping it- 另请参阅:
LinkedHashMap.removeEldestEntry(java.util.Map.Entry<K, V>)