我正在尝试用我的替换我的ConcurrentHashMap
使用CaseInsensitiveConcurrentHashMap
。但是,我无法实例化我的哈希图。我将提供我的实现。
哈希映射类 - 基于 SO 问题:https ://stackoverflow.com/a/8237007/850475
import java.util.concurrent.ConcurrentHashMap;
public class CaseInsensitiveConcurrentHashMap <T> extends ConcurrentHashMap<String, T>{
@Override
public T put(String key, T value) {
return super.put(key.toLowerCase(), value);
}
public T get(String key) {
return super.get(key.toLowerCase());
}
}
我下面的代码不适用于新的哈希映射:
public class tester {
private static ConcurrentMap<String, SomeClass> items = new CaseInsensitiveConcurrentHashMap<String, SomeClass>();
private static ConcurrentMap<String, CaseInsensitiveConcurrentHashMap<String, Collection<SomeClass2>>> tagMap = new CaseInsensitiveConcurrentHashMap<String, CaseInsensitiveConcurrentHashMap<String, Collection<SomeClass2>>>();
}
两条线都tester
失败了。这是我的错误信息:
Incorrect number of arguments for type CaseInsensitiveConcurrentHashMap<T>; it cannot be parameterized with arguments <String, Collection<SomeClass>>
关于我可以尝试什么的任何想法?