@Override public boolean containsKey(Object key) { return (key instanceof String && this.caseInsensitiveKeys.containsKey(convertKey((String) key))); }
@Override @Nullable 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 @Nullable public V remove(Object key) { if (key instanceof String) { String caseInsensitiveKey = this.caseInsensitiveKeys.remove(convertKey((String) key)); if (caseInsensitiveKey != null) { return this.targetMap.remove(caseInsensitiveKey); } } return null; }
@Override @Nullable 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 @Nullable public V put(String key, @Nullable V value) { String oldKey = this.caseInsensitiveKeys.put(convertKey(key), key); V oldKeyValue = null; if (oldKey != null && !oldKey.equals(key)) { oldKeyValue = this.targetMap.remove(oldKey); } V oldValue = this.targetMap.put(key, value); return (oldKeyValue != null ? oldKeyValue : oldValue); }
@Override public boolean containsKey(Object key) { return (key instanceof String && this.caseInsensitiveKeys.containsKey(convertKey((String) key))); }
@Override protected boolean removeEldestEntry(Map.Entry<String, V> eldest) { boolean doRemove = LinkedCaseInsensitiveMap.this.removeEldestEntry(eldest); if (doRemove) { caseInsensitiveKeys.remove(convertKey(eldest.getKey())); } return doRemove; } };
@Override @Nullable 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 @Nullable public V remove(Object key) { if (key instanceof String) { String caseInsensitiveKey = this.caseInsensitiveKeys.remove(convertKey((String) key)); if (caseInsensitiveKey != null) { return this.targetMap.remove(caseInsensitiveKey); } } return null; }
@Override @Nullable 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 @Nullable public V putIfAbsent(String key, @Nullable V value) { String oldKey = this.caseInsensitiveKeys.putIfAbsent(convertKey(key), key); if (oldKey != null) { return this.targetMap.get(oldKey); } return this.targetMap.putIfAbsent(key, value); }
@Override @Nullable public V computeIfAbsent(String key, Function<? super String, ? extends V> mappingFunction) { String oldKey = this.caseInsensitiveKeys.putIfAbsent(convertKey(key), key); if (oldKey != null) { return this.targetMap.get(oldKey); } return this.targetMap.computeIfAbsent(key, mappingFunction); }
@Override @Nullable public V put(String key, @Nullable V value) { String oldKey = this.caseInsensitiveKeys.put(convertKey(key), key); V oldKeyValue = null; if (oldKey != null && !oldKey.equals(key)) { oldKeyValue = this.targetMap.remove(oldKey); } V oldValue = this.targetMap.put(key, value); return (oldKeyValue != null ? oldKeyValue : oldValue); }
@Override protected boolean removeEldestEntry(Map.Entry<String, V> eldest) { boolean doRemove = LinkedCaseInsensitiveMap.this.removeEldestEntry(eldest); if (doRemove) { caseInsensitiveKeys.remove(convertKey(eldest.getKey())); } return doRemove; } };
@Override @Nullable public V putIfAbsent(String key, @Nullable V value) { String oldKey = this.caseInsensitiveKeys.putIfAbsent(convertKey(key), key); if (oldKey != null) { return this.targetMap.get(oldKey); } return this.targetMap.putIfAbsent(key, value); }
@Override @Nullable public V computeIfAbsent(String key, Function<? super String, ? extends V> mappingFunction) { String oldKey = this.caseInsensitiveKeys.putIfAbsent(convertKey(key), key); if (oldKey != null) { return this.targetMap.get(oldKey); } return this.targetMap.computeIfAbsent(key, mappingFunction); }
@Override public boolean containsKey(Object key) { return (key instanceof String && this.caseInsensitiveKeys.containsKey(convertKey((String) key))); }
@Override public V put(String key, V value) { this.caseInsensitiveKeys.put(convertKey(key), key); return super.put(key, value); }
@Override public V remove(Object key) { if (key instanceof String ) { return super.remove(this.caseInsensitiveKeys.remove(convertKey((String) key))); } else { return null; } }
@Override public V get(Object key) { if (key instanceof String) { return super.get(this.caseInsensitiveKeys.get(convertKey((String) key))); } else { return null; } }