public class CollectionUtils extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static <K,V> V |
computeIfAbsent(Map<K,V> map,
K key,
Function<? super K,? extends V> mappingFunction)
Compute if absent.
|
static Map<String,String> |
decodeMap(String data)
Decode string to map
|
static String |
encodeMap(Map<String,String> map)
Encode map to string
|
static <T> T |
getLast(List<T> list)
Get the last item.
|
static boolean |
isEmpty(Collection<?> col)
Is empty boolean.
|
static boolean |
isEmpty(Map<?,?> map)
Is empty boolean.
|
static boolean |
isEmpty(Object[] array)
Is empty boolean.
|
static boolean |
isNotEmpty(Collection<?> col)
Is not empty boolean.
|
static boolean |
isNotEmpty(Map<?,?> map)
Is not empty boolean.
|
static boolean |
isNotEmpty(Object[] array)
Is not empty boolean.
|
static boolean |
isSizeEquals(Collection<?> col0,
Collection<?> col1)
Is size equals boolean.
|
static String |
toString(Collection<?> col)
Collection To string.
|
static String |
toString(Map<?,?> map)
Map to string.
|
static Map<String,String> |
toStringMap(Map<String,Object> param)
To string map
|
static List<String> |
toUpperList(List<String> sourceList)
To upper list.
|
public static boolean isEmpty(Collection<?> col)
col - the colpublic static boolean isNotEmpty(Collection<?> col)
col - the colpublic static boolean isEmpty(Object[] array)
array - the arraypublic static boolean isNotEmpty(Object[] array)
array - the arraypublic static boolean isEmpty(Map<?,?> map)
map - the mappublic static boolean isNotEmpty(Map<?,?> map)
map - the mappublic static String toString(Collection<?> col)
col - the colpublic static String toString(Map<?,?> map)
map - the mappublic static Map<String,String> toStringMap(Map<String,Object> param)
param - mappublic static boolean isSizeEquals(Collection<?> col0, Collection<?> col1)
col0 - the col 0col1 - the col 1public static String encodeMap(Map<String,String> map)
map - origin mappublic static Map<String,String> decodeMap(String data)
data - datapublic static <K,V> V computeIfAbsent(Map<K,V> map, K key, Function<? super K,? extends V> mappingFunction)
K - the type of keyV - the type of valuemap - the mapkey - the keymappingFunction - the mapping functionpublic static List<String> toUpperList(List<String> sourceList)
sourceList - the source listpublic static <T> T getLast(List<T> list)
'IndexOutOfBoundsException' may be thrown, because the `list.size()` and `list.get(size - 1)` are not atomic. This method can avoid the 'IndexOutOfBoundsException' cause by concurrency.
T - the type of itemlist - the listCopyright © 2022 Seata. All rights reserved.