public class CollectionUtils extends Object
| Constructor and Description |
|---|
CollectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isEmpty(Collection<?> collection)
判断集合是否为空
|
static boolean |
isEmpty(Map<?,?> map)
判断Map是否为空
|
static boolean |
isNotEmpty(Collection<?> collection)
判断集合是否不为空
|
static boolean |
isNotEmpty(Map<?,?> map)
判断Map是否不为空
|
static <T> String |
join(List<T> list,
CharSequence delimiter,
String prefix,
String suffix) |
static <T> List<T> |
newArrayList(T... values) |
static <E,T> List<T> |
toList(Collection<E> collection,
Function<E,T> function)
将collection转化为List集合,但是两者的泛型不同
Collection<E> ------> List<T> |
public static boolean isEmpty(Collection<?> collection)
collection - 集合对象public static boolean isNotEmpty(Collection<?> collection)
collection - 集合对象public static boolean isEmpty(Map<?,?> map)
map - Map对象public static boolean isNotEmpty(Map<?,?> map)
map - Map对象@SafeVarargs public static <T> List<T> newArrayList(T... values)
public static <T> String join(List<T> list, CharSequence delimiter, String prefix, String suffix)
public static <E,T> List<T> toList(Collection<E> collection, Function<E,T> function)
Collection<E> ------> List<T> E - collection中的泛型T - List中的泛型collection - 需要转化的集合function - collection中的泛型转化为list泛型的lambda表达式Copyright © 2025. All rights reserved.