类 CollectionUtil
- java.lang.Object
-
- org.springframework.util.CollectionUtils
-
- me.youm.frame.common.utils.CollectionUtil
-
public class CollectionUtil extends org.springframework.util.CollectionUtils
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 private static classCollectionUtil.Partition<T>private static classCollectionUtil.RandomAccessPartition<T>
-
构造器概要
构造器 构造器 说明 CollectionUtil()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static <K,V>
VcomputeIfAbsent(Map<K,V> map, K key, Function<K,V> mappingFunction)static String[]concat(String[] one, String[] other)Concatenates 2 arraysstatic <T> T[]concat(T[] one, T[] other, Class<T> clazz)Concatenates 2 arraysstatic <T> booleancontains(T[] array, T element)Check whether the given Array contains the given element.static booleanisNotEmpty(Collection<?> collection)Returntrueif the supplied Collection is notnullor empty.static booleanisNotEmpty(Map<?,?> map)Returntrueif the supplied Map is notnullor empty.static <E> List<E>ofImmutableList(E... es)不可变 Liststatic <E> Set<E>ofImmutableSet(E... es)不可变 Setstatic <T> List<List<T>>partition(List<T> list, int size)list 分片static <E> List<E>toList(Iterable<E> elements)Iterable 转换为List集合static <K,V>
Map<K,V>toMap(Object... keysValues)将key value 数组转为 map-
从类继承的方法 org.springframework.util.CollectionUtils
arrayToList, contains, contains, containsAny, containsInstance, findCommonElementType, findFirstMatch, findValueOfType, findValueOfType, firstElement, firstElement, hasUniqueObject, isEmpty, isEmpty, lastElement, lastElement, mergeArrayIntoCollection, mergePropertiesIntoMap, newHashMap, newLinkedHashMap, toArray, toIterator, toMultiValueMap, unmodifiableMultiValueMap
-
-
-
-
方法详细资料
-
isNotEmpty
public static boolean isNotEmpty(@Nullable Collection<?> collection)Returntrueif the supplied Collection is notnullor empty. Otherwise, returnfalse.- 参数:
collection- the Collection to check- 返回:
- whether the given Collection is not empty
-
isNotEmpty
public static boolean isNotEmpty(@Nullable Map<?,?> map)Returntrueif the supplied Map is notnullor empty. Otherwise, returnfalse.- 参数:
map- the Map to check- 返回:
- whether the given Map is not empty
-
contains
public static <T> boolean contains(@Nullable T[] array, T element)Check whether the given Array contains the given element.- 类型参数:
T- The generic tag- 参数:
array- the Array to checkelement- the element to look for- 返回:
trueif found,falseelse
-
concat
public static String[] concat(String[] one, String[] other)
Concatenates 2 arrays- 参数:
one- 数组1other- 数组2- 返回:
- 新数组
-
concat
public static <T> T[] concat(T[] one, T[] other, Class<T> clazz)Concatenates 2 arrays- 参数:
one- 数组1other- 数组2clazz- 数组类- 返回:
- 新数组
-
ofImmutableSet
@SafeVarargs public static <E> Set<E> ofImmutableSet(E... es)
不可变 Set- 类型参数:
E- 泛型- 参数:
es- 对象- 返回:
- 集合
-
ofImmutableList
@SafeVarargs public static <E> List<E> ofImmutableList(E... es)
不可变 List- 类型参数:
E- 泛型- 参数:
es- 对象- 返回:
- 集合
-
toList
public static <E> List<E> toList(Iterable<E> elements)
Iterable 转换为List集合- 类型参数:
E- 泛型- 参数:
elements- Iterable- 返回:
- 集合
-
toMap
public static <K,V> Map<K,V> toMap(Object... keysValues)
将key value 数组转为 map- 类型参数:
K- keyV- value- 参数:
keysValues- key value 数组- 返回:
- map 集合
-
computeIfAbsent
public static <K,V> V computeIfAbsent(Map<K,V> map, K key, Function<K,V> mappingFunction)
-
-