Class CollectionUtils

    • Method Detail

      • isEmpty

        public static boolean isEmpty​(Collection<?> collection)
        Returns true if the specified collection is null or empty.
        Parameters:
        collection - The collection. May be null.
        Returns:
        true if the collection is null or empty, else false.
      • isNotEmpty

        public static boolean isNotEmpty​(Collection<?> collection)
        Returns true if the specified collection is not empty.
        Parameters:
        collection - The collection. May be null.
        Returns:
        true if the collection is not empty, else false.
      • contains

        public static <T> boolean contains​(Collection<T> collection,
                                           T item)
        Returns true if the specified collection contains the specified item.
        Parameters:
        collection - The collection. May be null.
        item - The item. Should not be null.
        Returns:
        true if the collection is not empty and contains the item, else false.
      • intersect

        public static <T> boolean intersect​(Collection<T> a,
                                            Collection<T> b)
        Returns true if the specified collections intersect.
        Parameters:
        a - The first collection. May be null.
        b - The second collection. May be null.
        Returns:
        true if the collections intersect, else false.