类 MapUtil
- java.lang.Object
-
- com.alibaba.nacos.common.utils.MapUtil
-
public class MapUtil extends java.lang.ObjectMap utils.- 作者:
- liaochuntao
-
-
构造器概要
构造器 构造器 说明 MapUtil()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static <K,C,V,T>
VcomputeIfAbsent(java.util.Map<K,V> target, K key, java.util.function.BiFunction<C,T,V> mappingFunction, C param1, T param2)ComputeIfAbsent lazy load.static booleanisEmpty(java.util.Dictionary coll)Null-safe check if the specified Dictionary is empty.static booleanisEmpty(java.util.Map map)Null-safe check if the specified Dictionary is empty.static booleanisNotEmpty(java.util.Dictionary coll)Null-safe check if the specified Dictionary is not empty.static booleanisNotEmpty(java.util.Map map)Null-safe check if the specified Dictionary is not empty.static voidputIfValNoEmpty(java.util.Map target, java.lang.Object key, java.lang.Object value)Put into map if value is not empty.static voidputIfValNoNull(java.util.Map target, java.lang.Object key, java.lang.Object value)Put into map if value is not null.static <K,V>
VremoveKey(java.util.Map<K,V> map, K key, java.util.function.Predicate<V> removeJudge)remove value, Thread safety depends on whether the Map is a thread-safe Map.
-
-
-
方法详细资料
-
isEmpty
public static boolean isEmpty(java.util.Map map)
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
public static boolean isEmpty(java.util.Dictionary coll)
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
public static boolean isNotEmpty(java.util.Map map)
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
public static boolean isNotEmpty(java.util.Dictionary coll)
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
public static void putIfValNoNull(java.util.Map target, java.lang.Object key, java.lang.Object value)Put into map if value is not null.- 参数:
target- target mapkey- keyvalue- value
-
putIfValNoEmpty
public static void putIfValNoEmpty(java.util.Map target, java.lang.Object key, java.lang.Object value)Put into map if value is not empty.- 参数:
target- target mapkey- keyvalue- value
-
computeIfAbsent
@NotThreadSafe public static <K,C,V,T> V computeIfAbsent(java.util.Map<K,V> target, K key, java.util.function.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
public static <K,V> V removeKey(java.util.Map<K,V> map, K key, java.util.function.Predicate<V> removeJudge)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
-
-