Debian Codegraph @

src/main/org/h2/value/CaseInsensitiveConcurrentMap.java

raw
1 /*
2 * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,
3 * and the EPL 1.0 (https://h2database.com/html/license.html).
4 * Initial Developer: H2 Group
5 */
6 package org.h2.value;
7
8 import java.util.concurrent.ConcurrentHashMap;
9
10 import org.h2.util.StringUtils;
11
12 /**
13 * A concurrent hash map with case-insensitive string keys.
14 *
15 * @param <V> the value type
16 */
17 public class CaseInsensitiveConcurrentMap<V> extends ConcurrentHashMap<String, V> {
18
19 private static final long serialVersionUID = 1L;
20
21 @Override
22 public V get(Object key) {
23 return super.get(StringUtils.toUpperEnglish((String) key));
24 }
25
26 @Override
27 public V put(String key, V value) {
28 return super.put(StringUtils.toUpperEnglish(key), value);
29 }
30
31 @Override
32 public V putIfAbsent(String key, V value) {
33 return super.putIfAbsent(StringUtils.toUpperEnglish(key), value);
34 }
35
36 @Override
37 public boolean containsKey(Object key) {
38 return super.containsKey(StringUtils.toUpperEnglish((String) key));
39 }
40
41 @Override
42 public V remove(Object key) {
43 return super.remove(StringUtils.toUpperEnglish((String) key));
44 }
45
46 }