类 CollectionUtils


  • public abstract class CollectionUtils
    extends BaseUtils
    The utilities class for Java Collection
    版本:
    1.0.0
    作者:
    Mercy
    另请参阅:
    Collections
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static <T> int addAll​(java.util.Collection<T> collection, T... values)
      Add the multiple values into the specified collection
      static boolean equals​(java.util.Collection<?> one, java.util.Collection<?> another)
      Compares the specified collection with another, the main implementation references AbstractSet
      static <T> T first​(java.lang.Iterable<T> values)
      Take the first element from the specified Iterable
      static <T> T first​(java.util.Collection<T> values)
      Take the first element from the specified collection
      static <T> T first​(java.util.Iterator<T> values)
      Take the first element from the specified
      static boolean isEmpty​(java.util.Collection<?> collection)  
      static boolean isNotEmpty​(java.util.Collection<?> collection)  
      static <E> java.util.Enumeration<E> singletonEnumeration​(E element)  
      static <E> java.lang.Iterable<E> singletonIterable​(E element)  
      static <E> java.util.Iterator<E> singletonIterator​(E element)  
      static int size​(java.lang.Iterable<?> iterable)
      Get the size of the specified Iterable
      static int size​(java.util.Collection<?> collection)
      Get the size of the specified Collection
      static <E> java.lang.Iterable<E> toIterable​(java.util.Collection<E> collection)  
      static <E> java.lang.Iterable<E> toIterable​(java.util.Enumeration<E> enumeration)  
      static <E> java.lang.Iterable<E> toIterable​(java.util.Iterator<E> iterator)  
      static <E> java.util.Iterator<E> toIterator​(java.util.Enumeration<E> enumeration)  
      static <E> java.util.Iterator<E> unmodifiableIterator​(java.util.Iterator<E> iterator)  
      • 从类继承的方法 java.lang.Object

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

      • CollectionUtils

        public CollectionUtils()
    • 方法详细资料

      • isEmpty

        public static boolean isEmpty​(java.util.Collection<?> collection)
      • isNotEmpty

        public static boolean isNotEmpty​(java.util.Collection<?> collection)
      • toIterable

        public static <E> java.lang.Iterable<E> toIterable​(java.util.Collection<E> collection)
      • toIterable

        public static <E> java.lang.Iterable<E> toIterable​(java.util.Iterator<E> iterator)
      • toIterator

        public static <E> java.util.Iterator<E> toIterator​(java.util.Enumeration<E> enumeration)
      • toIterable

        public static <E> java.lang.Iterable<E> toIterable​(java.util.Enumeration<E> enumeration)
      • singletonIterable

        public static <E> java.lang.Iterable<E> singletonIterable​(E element)
      • singletonIterator

        public static <E> java.util.Iterator<E> singletonIterator​(E element)
      • singletonEnumeration

        public static <E> java.util.Enumeration<E> singletonEnumeration​(E element)
      • unmodifiableIterator

        public static <E> java.util.Iterator<E> unmodifiableIterator​(java.util.Iterator<E> iterator)
      • size

        public static int size​(java.util.Collection<?> collection)
        Get the size of the specified Collection
        参数:
        collection - the specified Collection
        返回:
        must be positive number
      • size

        public static int size​(java.lang.Iterable<?> iterable)
        Get the size of the specified Iterable
        参数:
        iterable - the specified Iterable
        返回:
        must be positive number
      • equals

        public static boolean equals​(java.util.Collection<?> one,
                                     java.util.Collection<?> another)
        Compares the specified collection with another, the main implementation references AbstractSet
        参数:
        one - Collection
        another - Collection
        返回:
        if equals, return true, or false
      • addAll

        public static <T> int addAll​(java.util.Collection<T> collection,
                                     T... values)
        Add the multiple values into the specified collection
        类型参数:
        T - the type of values
        参数:
        collection - the specified collection
        values - the multiple values
        返回:
        the effected count after added
      • first

        public static <T> T first​(java.util.Collection<T> values)
        Take the first element from the specified collection
        类型参数:
        T - the type of element of collection
        参数:
        values - the collection object
        返回:
        if found, return the first one, or null
      • first

        public static <T> T first​(java.lang.Iterable<T> values)
        Take the first element from the specified Iterable
        类型参数:
        T - the type of element of Iterable
        参数:
        values - the Iterable object
        返回:
        if found, return the first one, or null
      • first

        public static <T> T first​(java.util.Iterator<T> values)
        Take the first element from the specified
        类型参数:
        T - the type of element of
        参数:
        values - the Iterator object
        返回:
        if found, return the first one, or null