File D:\maven-qcr-plugin-testsunitaires\qcr4java\h2-1.3.170-sources\target\site\qc\lecode\value\CaseInsensitiveMap.java.html

1 /*
2 * Copyright 2004-2011 H2 Group. Multiple-Licensed under the H2 License,
3 * Version 1.0, and under the Eclipse Public License, Version 1.0
4 * (http://h2database.com/html/license.html).
5 * Initial Developer: H2 Group
6 */
7 package org.h2.value;
8
9 import java.util.HashMap;
10 import org.h2.util.StringUtils;
11
12 /**
13 * A hash map with a case-insensitive string key.
14 *
15 * @param <V> the value type
16 */
17 public class CaseInsensitiveMap<V> extends HashMap<String, V> {
18
19 private static final long serialVersionUID = 1L;
20
21 public V get(Object key) {
22 return super.get(toUpper(key));
23 }
24
25 public V put(String key, V value) {
26 return super.put(toUpper(key), value);
27 }
28
29 public boolean containsKey(Object key) {
30 return super.containsKey(toUpper(key));
31 }
32
33 public V remove(Object key) {
34 return super.remove(toUpper(key));
35 }
36
37 private static String toUpper(Object key) {
38 return key == null ? null : StringUtils.toUpperEnglish(key.toString());
39 }
40
41 }
42