|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2016 the original author or authors. |
|
|
|
|
* Copyright 2002-2017 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -85,6 +85,10 @@ public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable
@@ -85,6 +85,10 @@ public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable
|
|
|
|
|
*/ |
|
|
|
|
public LinkedCaseInsensitiveMap(int initialCapacity, Locale locale) { |
|
|
|
|
this.targetMap = new LinkedHashMap<String, V>(initialCapacity) { |
|
|
|
|
@Override |
|
|
|
|
public boolean containsKey(Object key) { |
|
|
|
|
return LinkedCaseInsensitiveMap.this.containsKey(key); |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
protected boolean removeEldestEntry(Map.Entry<String, V> eldest) { |
|
|
|
|
boolean doRemove = LinkedCaseInsensitiveMap.this.removeEldestEntry(eldest); |
|
|
|
@ -120,23 +124,35 @@ public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable
@@ -120,23 +124,35 @@ public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean containsValue(Object value) { |
|
|
|
|
return this.targetMap.containsValue(value); |
|
|
|
|
public boolean containsKey(Object key) { |
|
|
|
|
return (key instanceof String && this.caseInsensitiveKeys.containsKey(convertKey((String) key))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Set<String> keySet() { |
|
|
|
|
return this.targetMap.keySet(); |
|
|
|
|
public boolean containsValue(Object value) { |
|
|
|
|
return this.targetMap.containsValue(value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Collection<V> values() { |
|
|
|
|
return this.targetMap.values(); |
|
|
|
|
public V get(Object key) { |
|
|
|
|
if (key instanceof String) { |
|
|
|
|
String caseInsensitiveKey = this.caseInsensitiveKeys.get(convertKey((String) key)); |
|
|
|
|
if (caseInsensitiveKey != null) { |
|
|
|
|
return this.targetMap.get(caseInsensitiveKey); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Set<Entry<String, V>> entrySet() { |
|
|
|
|
return this.targetMap.entrySet(); |
|
|
|
|
public V getOrDefault(Object key, V defaultValue) { |
|
|
|
|
if (key instanceof String) { |
|
|
|
|
String caseInsensitiveKey = this.caseInsensitiveKeys.get(convertKey((String) key)); |
|
|
|
|
if (caseInsensitiveKey != null) { |
|
|
|
|
return this.targetMap.get(caseInsensitiveKey); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return defaultValue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -158,33 +174,6 @@ public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable
@@ -158,33 +174,6 @@ public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean containsKey(Object key) { |
|
|
|
|
return (key instanceof String && this.caseInsensitiveKeys.containsKey(convertKey((String) key))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public V get(Object key) { |
|
|
|
|
if (key instanceof String) { |
|
|
|
|
String caseInsensitiveKey = this.caseInsensitiveKeys.get(convertKey((String) key)); |
|
|
|
|
if (caseInsensitiveKey != null) { |
|
|
|
|
return this.targetMap.get(caseInsensitiveKey); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public V getOrDefault(Object key, V defaultValue) { |
|
|
|
|
if (key instanceof String) { |
|
|
|
|
String caseInsensitiveKey = this.caseInsensitiveKeys.get(convertKey((String) key)); |
|
|
|
|
if (caseInsensitiveKey != null) { |
|
|
|
|
return this.targetMap.get(caseInsensitiveKey); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return defaultValue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public V remove(Object key) { |
|
|
|
|
if (key instanceof String) { |
|
|
|
@ -202,6 +191,20 @@ public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable
@@ -202,6 +191,20 @@ public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable
|
|
|
|
|
this.targetMap.clear(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Set<String> keySet() { |
|
|
|
|
return this.targetMap.keySet(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Collection<V> values() { |
|
|
|
|
return this.targetMap.values(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Set<Entry<String, V>> entrySet() { |
|
|
|
|
return this.targetMap.entrySet(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public LinkedCaseInsensitiveMap<V> clone() { |
|
|
|
|