| 构造器和说明 |
|---|
CollectionUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> Collection<Collection<T>> |
batch(Collection<T> collection,
int size)
将集合元素分批
|
static <T> void |
batch(Collection<T> collection,
int size,
Consumer<Collection<T>> consumer)
将集合元素分批
|
static <T> T |
getElement(Collection<T> collection,
int index)
获取元素集合中指定下标的元素
|
static <T> T |
getFirstElement(Collection<T> collection)
获取元素集合中的第一个元素
|
static <T> T |
getLastElement(Collection<T> collection)
获取元素集合中的最后一个元素
|
static boolean |
isEmpty(Collection<?> collection)
返回集合是否为空
|
static boolean |
notEmpty(Collection<?> collection)
返回集合是否非空
|
static long |
size(Collection<?> collection)
获取集合大小
|
public static boolean isEmpty(Collection<?> collection)
collection - 集合public static boolean notEmpty(Collection<?> collection)
collection - 集合public static <T> T getFirstElement(Collection<T> collection)
T - 元素类型collection - 集合public static <T> T getLastElement(Collection<T> collection)
T - 元素类型collection - 集合public static <T> T getElement(Collection<T> collection, int index)
T - 元素类型collection - 集合index - 下标public static <T> void batch(Collection<T> collection, int size, Consumer<Collection<T>> consumer)
T - 元素类型collection - 集合size - 每一批的元素个数consumer - 消费者public static <T> Collection<Collection<T>> batch(Collection<T> collection, int size)
T - 元素类型collection - 集合size - 每一批的元素个数public static long size(Collection<?> collection)
collection - 集合Copyright © 2025 EFCloud. All rights reserved.