程序包 cn.godmao.utils

类 CollectUtil

java.lang.Object
cn.hutool.core.collection.CollUtil
cn.godmao.utils.CollectUtil

public class CollectUtil extends cn.hutool.core.collection.CollUtil
  • 嵌套类概要

    从类继承的嵌套类/接口 cn.hutool.core.collection.CollUtil

    cn.hutool.core.collection.CollUtil.Consumer<T extends Object>, cn.hutool.core.collection.CollUtil.KVConsumer<K extends Object,V extends Object>
  • 方法概要

    修饰符和类型
    方法
    说明
    static <C> boolean
    contains(C[] array, C c)
     
    static <T, V> List<T>
    distinct(Collection<? extends T> collection, Function<T,V> function)
     
    static <C extends Collection<E>, E>
    C
    fill(C array, E obj)
     
    static <C extends Collection<E>, E>
    C
    fill(C array, E obj, Integer size)
     
    static <T, V> List<V>
    getArr(Collection<? extends T> collection, Function<T,V> function)
    获取数组中指定字段的集合
    static <T, V> List<T>
    getArr(List<T> collection, Function<T,V> function, Collection<V> values)
    获取数组中指定字段满足条件的所有值
    static <T, V> List<T>
    getArr(List<T> collection, Function<T,V> function, V... values)
    获取数组中指定字段满足条件的所有值
    static <T, V> T
    getOne(Collection<? extends T> collection, Function<T,V> function, V value)
    获取数组中指定字段满足条件的第一个值
    static <T, V> T
    getOne(T[] collection, Function<T,V> function, V value)
    获取数组中指定字段满足条件的第一个值
    static <T, V> Set<V>
    getSet(Collection<? extends T> collection, Function<T,V> function)
    获取数组中指定字段的集合
    static <T, V> Set<T>
    getSet(Collection<? extends T> collection, Function<T,V> function, Collection<V> values)
    获取数组中指定字段满足条件的所有值
    static <T, V> Set<T>
    getSet(Collection<? extends T> collection, Function<T,V> function, V... values)
    获取数组中指定字段满足条件的所有值
    static <K, V> Collection<V>
    getValues(Map<K,V> map, Collection<? extends K> keys)
     
    static <S> List<S>
    listOf(S... es)
     
    static <T, V extends Comparable<? super V>>
    T
    max(Collection<? extends T> collection, Function<T,V> function)
     
    static <T, V extends Comparable<? super V>>
    T
    min(Collection<? extends T> collection, Function<T,V> function)
     
    static <T> T
    next(Object key, List<T> array)
     
    static <T> T
    next(List<T> array, AtomicLong counter)
     
    static <T> T
    random(List<T> array)
     
    static <T, V> void
    remove(Collection<? extends T> collection, Function<T,V> function, Collection<V> values)
     
    static <T, V> void
    remove(Collection<? extends T> collection, Function<T,V> function, V... values)
     
    static <S> Set<S>
    setOf(S... es)
     
    static <K, V> Map<K,List<V>>
    toGroup(Collection<V> collection, Function<V,K> function)
    集合分组
    static <T> Map<Integer,T>
    toMap(Collection<T> collection)
    集合 转 Map K 是 hashCode
    static <K, V> Map<K,V>
    toMap(Collection<V> collection, Function<V,K> function)
    集合 转 Map K 是 Function
    static <K1, K2, V> Map<K1,K2>
    toMap(Collection<V> collection, Function<V,K1> f1, Function<V,K2> f2)
    集合 转 Map K 是 Function
    static <K, V> Map<K,V>
    toMap(V[] collection, Function<V,K> function)
    集合 转 Map K 是 Function

    从类继承的方法 cn.hutool.core.collection.CollUtil

    addAll, addAll, addAll, addAll, addAll, addAll, addAllIfNotContains, addIfAbsent, allMatch, anyMatch, asEnumeration, asIterable, asIterator, clear, contains, contains, containsAll, containsAny, count, countMap, create, create, defaultIfEmpty, defaultIfEmpty, disjunction, distinct, distinct, edit, empty, emptyIfNull, emptyIfNull, extract, extract, fieldValueAsMap, fieldValueMap, filter, filterNew, findOne, findOneByField, forEach, forEach, forEach, forEach, get, getAny, getElementType, getElementType, getFieldValues, getFieldValues, getFieldValues, getFirst, getFirst, getLast, group, groupByField, hasNull, indexOf, indexOfAll, intersection, intersection, intersectionDistinct, isEmpty, isEmpty, isEmpty, isEmpty, isEmpty, isEqualList, isNotEmpty, isNotEmpty, isNotEmpty, isNotEmpty, isNotEmpty, join, join, join, join, keySet, lastIndexOf, list, list, list, list, list, list, map, max, min, newArrayList, newArrayList, newArrayList, newArrayList, newArrayList, newBlockingQueue, newCopyOnWriteArrayList, newHashSet, newHashSet, newHashSet, newHashSet, newHashSet, newLinkedHashSet, newLinkedList, padLeft, padRight, page, popPart, popPart, removeAny, removeBlank, removeEmpty, removeNull, removeWithAddIf, removeWithAddIf, reverse, reverseNew, safeContains, set, setOrAppend, setValueByMap, size, sort, sort, sort, sortByEntry, sortByPinyin, sortByPinyin, sortByProperty, sortByProperty, sortEntryToList, sortPageAll, sortToMap, split, splitList, sub, sub, sub, sub, subtract, subtractToList, toCollection, toList, toListMap, toMap, toMap, toMap, toMap, toMapList, toTreeSet, trans, union, union, unionAll, unionDistinct, unmodifiable, values, valuesOfKeys, valuesOfKeys, valuesOfKeys, zip, zip, zip

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

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 方法详细资料

    • toMap

      public static <T> Map<Integer,T> toMap(Collection<T> collection)
      集合 转 Map K 是 hashCode
    • toMap

      public static <K, V> Map<K,V> toMap(Collection<V> collection, Function<V,K> function)
      集合 转 Map K 是 Function
    • toMap

      public static <K1, K2, V> Map<K1,K2> toMap(Collection<V> collection, Function<V,K1> f1, Function<V,K2> f2)
      集合 转 Map K 是 Function
    • toMap

      public static <K, V> Map<K,V> toMap(V[] collection, Function<V,K> function)
      集合 转 Map K 是 Function
    • toGroup

      public static <K, V> Map<K,List<V>> toGroup(Collection<V> collection, Function<V,K> function)
      集合分组
    • getOne

      public static <T, V> T getOne(Collection<? extends T> collection, Function<T,V> function, V value)
      获取数组中指定字段满足条件的第一个值
      参数:
      collection - 数组
      function - 字段
      value - 值 条件
    • getOne

      public static <T, V> T getOne(T[] collection, Function<T,V> function, V value)
      获取数组中指定字段满足条件的第一个值
      参数:
      collection - 数组
      function - 字段
      value - 值 条件
    • getArr

      public static <T, V> List<T> getArr(List<T> collection, Function<T,V> function, V... values)
      获取数组中指定字段满足条件的所有值
      参数:
      collection - 数组
      function - 字段
      values - 所有值 所有条件
    • getArr

      public static <T, V> List<T> getArr(List<T> collection, Function<T,V> function, Collection<V> values)
      获取数组中指定字段满足条件的所有值
      参数:
      collection - 数组
      function - 字段
      values - 所有值 所有条件
    • getArr

      public static <T, V> List<V> getArr(Collection<? extends T> collection, Function<T,V> function)
      获取数组中指定字段的集合
      参数:
      collection - 数组
      function - 指定字段
      返回:
      IFunction
    • getSet

      public static <T, V> Set<V> getSet(Collection<? extends T> collection, Function<T,V> function)
      获取数组中指定字段的集合
      参数:
      collection - 数组
      function - 指定字段
      返回:
      IFunction
    • getSet

      public static <T, V> Set<T> getSet(Collection<? extends T> collection, Function<T,V> function, V... values)
      获取数组中指定字段满足条件的所有值
      参数:
      collection - 数组
      function - 字段
      values - 所有值 所有条件
    • getSet

      public static <T, V> Set<T> getSet(Collection<? extends T> collection, Function<T,V> function, Collection<V> values)
      获取数组中指定字段满足条件的所有值
      参数:
      collection - 数组
      function - 字段
      values - 所有值 所有条件
    • remove

      public static <T, V> void remove(Collection<? extends T> collection, Function<T,V> function, V... values)
    • remove

      public static <T, V> void remove(Collection<? extends T> collection, Function<T,V> function, Collection<V> values)
    • getValues

      public static <K, V> Collection<V> getValues(Map<K,V> map, Collection<? extends K> keys)
    • setOf

      public static <S> Set<S> setOf(S... es)
    • listOf

      public static <S> List<S> listOf(S... es)
    • max

      public static <T, V extends Comparable<? super V>> T max(Collection<? extends T> collection, Function<T,V> function)
    • min

      public static <T, V extends Comparable<? super V>> T min(Collection<? extends T> collection, Function<T,V> function)
    • fill

      public static <C extends Collection<E>, E> C fill(C array, E obj)
    • fill

      public static <C extends Collection<E>, E> C fill(C array, E obj, Integer size)
    • distinct

      public static <T, V> List<T> distinct(Collection<? extends T> collection, Function<T,V> function)
    • contains

      public static <C> boolean contains(C[] array, C c)
    • next

      public static <T> T next(Object key, List<T> array)
    • next

      public static <T> T next(List<T> array, AtomicLong counter)
    • random

      public static <T> T random(List<T> array)