mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
enhance countAll
This commit is contained in:
@@ -4,11 +4,10 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* 自定义键的Map,默认HashMap实现
|
||||
*
|
||||
* @author Looly
|
||||
*
|
||||
* @param <K> 键类型
|
||||
* @param <V> 值类型
|
||||
* @author Looly
|
||||
* @since 4.0.7
|
||||
*/
|
||||
public abstract class CustomKeyMap<K, V> extends MapWrapper<K, V> {
|
||||
@@ -17,7 +16,7 @@ public abstract class CustomKeyMap<K, V> extends MapWrapper<K, V> {
|
||||
/**
|
||||
* 构造<br>
|
||||
* 通过传入一个Map从而确定Map的类型,子类需创建一个空的Map,而非传入一个已有Map,否则值可能会被修改
|
||||
*
|
||||
*
|
||||
* @param m Map 被包装的Map
|
||||
* @since 3.1.2
|
||||
*/
|
||||
@@ -47,20 +46,30 @@ public abstract class CustomKeyMap<K, V> extends MapWrapper<K, V> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public V remove(Object key) { return super.remove(customKey(key)); }
|
||||
public V remove(Object key) {
|
||||
return super.remove(customKey(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object key, Object value) { return super.remove(customKey(key), value); }
|
||||
public boolean remove(Object key, Object value) {
|
||||
return super.remove(customKey(key), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replace(K key, V oldValue, V newValue) { return super.replace((K) customKey(key), oldValue, newValue); }
|
||||
public boolean replace(K key, V oldValue, V newValue) {
|
||||
//noinspection unchecked
|
||||
return super.replace((K) customKey(key), oldValue, newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public V replace(K key, V value) { return super.replace((K) customKey(key), value); }
|
||||
public V replace(K key, V value) {
|
||||
//noinspection unchecked
|
||||
return super.replace((K) customKey(key), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义键
|
||||
*
|
||||
*
|
||||
* @param key KEY
|
||||
* @return 自定义KEY
|
||||
*/
|
||||
|
Reference in New Issue
Block a user