public class CollectionUtils extends Object
| 构造器和说明 |
|---|
CollectionUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
isAllEmpty(Object obj)
是否所有元素都为 null
Collection - removeIf null, size() == 0
Map - self(values())
Array - noneMatch nonNull
Iterator - !
|
static boolean |
isAnyEmpty(Object obj)
是否任意元素为 null
Collection - contains null
Map - containsValue null
Array - anyMatch null
Iterator - next() == null
Enumeration - 同 Iterator
|
static boolean |
isEmpty(Collection<?> coll)
是否为 null 或没有元素
|
static boolean |
isNotAllEmpty(Object obj)
是否任意元素不为 null
|
static boolean |
isNotAnyEmpty(Object obj)
是否任意元素为 null
|
static boolean |
isNotEmpty(Collection<?> coll)
是否不为 null 且有元素
|
static boolean |
moveForward(@NonNull Object arr,
int arrLength,
int startIndex,
int length)
从指定下标开始,将后面的元素往前复制指定位数
|
static boolean |
remove(@NonNull Object[] arr,
int index)
删除指定下标的元素
|
static boolean |
remove(@NonNull Object[] arr,
int index,
Object lastElementValue)
删除指定下标的元素
|
static <T> boolean |
remove(T arr,
int index)
删除指定下标的元素
|
static <T> boolean |
remove(T arr,
int index,
Object lastElementValue)
删除指定下标的元素
|
static boolean |
sizeIsEmpty(Object obj)
是否为 null 或没有元素
Collection - via collection isEmpty
Map - via map isEmpty
Array - using array size
Iterator - via hasNext
Enumeration - via hasMoreElements
|
static boolean |
sizeIsNotEmpty(Object obj)
是否不为 null 且有元素
|
public static boolean isEmpty(Collection<?> coll)
coll - 集合public static boolean isNotEmpty(Collection<?> coll)
coll - 集合public static boolean sizeIsEmpty(Object obj)
obj - 对象public static boolean sizeIsNotEmpty(Object obj)
obj - 对象public static boolean isAllEmpty(Object obj)
obj - 对象public static boolean isNotAllEmpty(Object obj)
obj - 对象public static boolean isAnyEmpty(Object obj)
obj - 对象public static boolean isNotAnyEmpty(Object obj)
obj - 对象public static boolean moveForward(@NonNull
@NonNull Object arr,
int arrLength,
int startIndex,
int length)
arr - 数组arrLength - 数组长度startIndex - 开始下标length - 位数public static boolean remove(@NonNull
@NonNull Object[] arr,
int index,
Object lastElementValue)
arr - 数组index - 下标lastElementValue - 最后一个元素的值public static boolean remove(@NonNull
@NonNull Object[] arr,
int index)
arr - 数组index - 下标public static <T> boolean remove(@NonNull
T arr,
int index,
Object lastElementValue)
T - 基本数据类型arr - 数组index - 下标lastElementValue - 最后一个元素的值public static <T> boolean remove(@NonNull
T arr,
int index)
T - 基本数据类型arr - 数组index - 下标Copyright © 2021. All rights reserved.