类 MapUtil
java.lang.Object
com.alibaba.nacos.common.utils.MapUtil
Map utils.
- 作者:
- liaochuntao
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static <K, C, V, T> VcomputeIfAbsent(Map<K,V> target, K key, BiFunction<C,T,V> mappingFunction, C param1, T param2)ComputeIfAbsent lazy load.static booleanisEmpty(Dictionary coll)Null-safe check if the specified Dictionary is empty.static booleanNull-safe check if the specified Dictionary is empty.static booleanisNotEmpty(Dictionary coll)Null-safe check if the specified Dictionary is not empty.static booleanisNotEmpty(Map map)Null-safe check if the specified Dictionary is not empty.static voidputIfValNoEmpty(Map target, Object key, Object value)Put into map if value is not empty.static voidputIfValNoNull(Map target, Object key, Object value)Put into map if value is not null.static <K, V> Vremove value, Thread safety depends on whether the Map is a thread-safe Map.
-
构造器详细资料
-
MapUtil
public MapUtil()
-
-
方法详细资料
-
isEmpty
Null-safe check if the specified Dictionary is empty.Null returns true.
- 参数:
map- the collection to check, may be null- 返回:
- true if empty or null
-
isEmpty
Null-safe check if the specified Dictionary is empty.Null returns true.
- 参数:
coll- the collection to check, may be null- 返回:
- true if empty or null
-
isNotEmpty
Null-safe check if the specified Dictionary is not empty.Null returns false.
- 参数:
map- the collection to check, may be null- 返回:
- true if non-null and non-empty
-
isNotEmpty
Null-safe check if the specified Dictionary is not empty.Null returns false.
- 参数:
coll- the collection to check, may be null- 返回:
- true if non-null and non-empty
-
putIfValNoNull
Put into map if value is not null.- 参数:
target- target mapkey- keyvalue- value
-
putIfValNoEmpty
Put into map if value is not empty.- 参数:
target- target mapkey- keyvalue- value
-
computeIfAbsent
@NotThreadSafe public static <K, C, V, T> V computeIfAbsent(Map<K,V> target, K key, BiFunction<C,T,V> mappingFunction, C param1, T param2)ComputeIfAbsent lazy load.- 参数:
target- target Map data.key- map key.mappingFunction- function which is need to be executed.param1- function's parameter value1.param2- function's parameter value1.- 返回:
-
removeKey
remove value, Thread safety depends on whether the Map is a thread-safe Map.- 类型参数:
K- key typeV- value type- 参数:
map- mapkey- keyremoveJudge- judge this key can be remove- 返回:
- value
-