public class CollectionTools extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isEmpty(Collection<?> collection)
判断集合是否为空
|
static boolean |
isEmpty(Map<?,?> map)
判断集合是否为空
|
static boolean |
isEmpty(com.google.common.collect.Multimap<?,?> map)
判断集合是否为空
|
static boolean |
isEmpty(com.google.common.collect.Multiset<?> set)
判断集合是否为空
|
static boolean |
isEmpty(com.google.common.collect.RangeSet<?> set)
判断集合是否为空
|
static boolean |
isEmpty(com.google.common.collect.Table<?,?,?> table)
判断集合是否为空
|
static boolean |
isNotEmpty(Collection<?> collection)
判断集合是否不为空
|
static boolean |
isNotEmpty(Map<?,?> map)
判断集合是否不为空
|
static boolean |
isNotEmpty(com.google.common.collect.Multimap<?,?> map)
判断集合是否不为空
|
static boolean |
isNotEmpty(com.google.common.collect.Multiset<?> set)
判断集合是否不为空
|
static boolean |
isNotEmpty(com.google.common.collect.RangeSet<?> set)
判断集合是否不为空
|
static boolean |
isNotEmpty(com.google.common.collect.Table<?,?,?> table)
判断集合是否不为空
|
static <T> List<T> |
nullToEmptyList(List<T> list)
将
null 转为空 List |
static <K,V> Map<K,V> |
nullToEmptyMap(Map<K,V> map)
将
null 转为空 Map |
static <T> Set<T> |
nullToEmptySet(Set<T> set)
将
null 转为空 Set |
public static boolean isEmpty(@Nullable Collection<?> collection)
collection - 集合public static boolean isEmpty(@Nullable Map<?,?> map)
map - 集合public static boolean isEmpty(@Nullable com.google.common.collect.Table<?,?,?> table)
table - 集合public static boolean isEmpty(@Nullable com.google.common.collect.Multimap<?,?> map)
map - 集合public static boolean isEmpty(@Nullable com.google.common.collect.Multiset<?> set)
set - 集合public static boolean isEmpty(@Nullable com.google.common.collect.RangeSet<?> set)
set - 集合public static boolean isNotEmpty(@Nullable Collection<?> collection)
collection - 集合public static boolean isNotEmpty(@Nullable Map<?,?> map)
map - 集合public static boolean isNotEmpty(@Nullable com.google.common.collect.Table<?,?,?> table)
table - 集合public static boolean isNotEmpty(@Nullable com.google.common.collect.Multimap<?,?> map)
map - 集合public static boolean isNotEmpty(@Nullable com.google.common.collect.Multiset<?> set)
set - 集合public static boolean isNotEmpty(@Nullable com.google.common.collect.RangeSet<?> set)
set - 集合@Nonnull public static <T> List<T> nullToEmptyList(@Nullable List<T> list)
null 转为空 ListT - List 元素的类型list - listlist 为 null,返回空列表;
如果 list 不为 null,返回 list 本身@Nonnull public static <T> Set<T> nullToEmptySet(@Nullable Set<T> set)
null 转为空 SetT - Set 元素的类型set - setset 为 null,返回空集合;
如果 set 不为 null,返回 set 本身Copyright © 2026. All rights reserved.