public class MapUtil extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
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.
|
static boolean |
isEmpty(Dictionary coll)
Null-safe check if the specified Dictionary is empty.
|
static boolean |
isEmpty(Map map)
Null-safe check if the specified Dictionary is empty.
|
static boolean |
isNotEmpty(Dictionary coll)
Null-safe check if the specified Dictionary is not empty.
|
static boolean |
isNotEmpty(Map map)
Null-safe check if the specified Dictionary is not empty.
|
static void |
putIfValNoEmpty(Map target,
Object key,
Object value)
Put into map if value is not empty.
|
static void |
putIfValNoNull(Map target,
Object key,
Object value)
Put into map if value is not null.
|
static <K,V> V |
removeKey(Map<K,V> map,
K key,
Predicate<V> removeJudge)
remove value, Thread safety depends on whether the Map is a thread-safe Map.
|
public static boolean isEmpty(Map map)
Null returns true.
map - the collection to check, may be nullpublic static boolean isEmpty(Dictionary coll)
Null returns true.
coll - the collection to check, may be nullpublic static boolean isNotEmpty(Map map)
Null returns false.
map - the collection to check, may be nullpublic static boolean isNotEmpty(Dictionary coll)
Null returns false.
coll - the collection to check, may be nullpublic static void putIfValNoNull(Map target, Object key, Object value)
target - target mapkey - keyvalue - valuepublic static void putIfValNoEmpty(Map target, Object key, Object value)
target - target mapkey - keyvalue - value@NotThreadSafe public static <K,C,V,T> V computeIfAbsent(Map<K,V> target, K key, BiFunction<C,T,V> mappingFunction, C param1, T param2)
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.Copyright © 2018–2024 Alibaba Group. All rights reserved.