maa*_*nus 10 java concurrency map case-insensitive
我该如何实施?
class CaseInsensitiveConcurrentMap<V> implements ConcurrentMap<String , V>
Run Code Online (Sandbox Code Playgroud)
哪个工作就像ConcurrentHashMap<String , V>除了密钥不区分大小写?密钥不应转换为小写或大写.
请注意,这Collections.synchronizedMap(new TreeMap<String, new MyCaseInsensitiveComparator())不是解决方案,因为它不允许并发并错过其他方法.
创建不区分大小写的一个字符串类equals和hashCode没有选择,因为相关地图将被传递给需要使用字符串作为键的方法.
Pet*_*rey 12
你有没有尝试过
ConcurrentMap<String, Object> map =
new ConcurrentSkipListMap<String, Object>(
String.CASE_INSENSITIVE_ORDER);
Run Code Online (Sandbox Code Playgroud)