类 CollectUtils

java.lang.Object
org.springframework.util.CollectionUtils
com.cdkjframework.util.tool.CollectUtils

public class CollectUtils extends org.springframework.util.CollectionUtils
  • 构造器概要

    构造器
    构造器
    说明
     
  • 方法概要

    修饰符和类型
    方法
    说明
    static <K, V> V
    computeIfAbsent(Map<K,V> concurrentHashMap, K key, Function<? super K,? extends V> mappingFunction)
    用来过渡下Jdk1.8下ConcurrentHashMap的性能bug
    static boolean
    isEmpty(Object[] array)
    是否为空
    static boolean
    isNotEmpty(Object[] array)
    是否非空
    static boolean
    isNotEmpty(Collection<?> collection)
    是否非空
    static boolean
    isNotEmpty(Map<?,?> map)
    是否非空
    static <K, V> HashMap<K,V>
    newHashMapWithExpectedSize(int expectedSize)
    根据预期大小创建HashMap.
    static <T> List<List<T>>
    split(Collection<T> entityList, int batchSize)
    切割集合为多个集合
    static <T> List<T>
    toList(T... t)
    构建 List

    从类继承的方法 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

    从类继承的方法 java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造器详细资料

    • CollectUtils

      public CollectUtils()
  • 方法详细资料

    • isEmpty

      public static boolean isEmpty(Object[] array)
      是否为空
      参数:
      array - 集合
      返回:
      返回是否
    • isNotEmpty

      public static boolean isNotEmpty(Object[] array)
      是否非空
      参数:
      array - 集合
      返回:
      返回是否
    • isNotEmpty

      public static boolean isNotEmpty(@Nullable Collection<?> collection)
      是否非空
      参数:
      collection - 集合
      返回:
      返回是否
    • isNotEmpty

      public static boolean isNotEmpty(@Nullable Map<?,?> map)
      是否非空
      参数:
      map - 集合
      返回:
      返回是否
    • toList

      @SafeVarargs public static <T> List<T> toList(T... t)
      构建 List
    • newHashMapWithExpectedSize

      public static <K, V> HashMap<K,V> newHashMapWithExpectedSize(int expectedSize)
      根据预期大小创建HashMap.
      类型参数:
      K - K
      V - V
      参数:
      expectedSize - 预期大小
      返回:
      HashMap
      另请参阅:
      • Maps.newHashMapWithExpectedSize(int)
    • computeIfAbsent

      public static <K, V> V computeIfAbsent(Map<K,V> concurrentHashMap, K key, Function<? super K,? extends V> mappingFunction)
      用来过渡下Jdk1.8下ConcurrentHashMap的性能bug

      A temporary workaround for Java 8 ConcurrentHashMap#computeIfAbsent specific performance issue: JDK-8161372.

      类型参数:
      K - k
      V - v
      参数:
      concurrentHashMap - ConcurrentHashMap 没限制类型了,非ConcurrentHashMap就别调用这方法了
      key - key
      mappingFunction - function
      返回:
      V
    • split

      public static <T> List<List<T>> split(Collection<T> entityList, int batchSize)
      切割集合为多个集合
      类型参数:
      T - 数据类型
      参数:
      entityList - 数据集合
      batchSize - 每批集合的大小
      返回:
      切割后的多个集合