I am trying to replace my use of ConcurrentHashMap
with mine CaseInsensitiveConcurrentHashMap
. However, I cannot instantiate my hashmap. I will provide my implementations.
The hash map class - based from SO question: 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());
}
}
And my code below that does not work with the new hash map:
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>>>();
}
Both lines in tester
fail. This is my error message:
Incorrect number of arguments for type CaseInsensitiveConcurrentHashMap<T>; it cannot be parameterized with arguments <String, Collection<SomeClass>>
Any idea as of what I can try?