Class CollectionUtil

java.lang.Object
nl.siegmann.epublib.util.CollectionUtil

public class CollectionUtil extends Object
  • Constructor Details

    • CollectionUtil

      public CollectionUtil()
  • Method Details

    • createEnumerationFromIterator

      public static <T> Enumeration<T> createEnumerationFromIterator(Iterator<T> it)
      Creates an Enumeration out of the given Iterator.
      Type Parameters:
      T -
      Parameters:
      it -
      Returns:
      an Enumeration created out of the given Iterator.
    • first

      public static <T> T first(List<T> list)
      Returns the first element of the list, null if the list is null or empty.
      Type Parameters:
      T -
      Parameters:
      list -
      Returns:
      the first element of the list, null if the list is null or empty.
    • isEmpty

      public static boolean isEmpty(Collection<?> collection)
      Whether the given collection is null or has no elements.
      Parameters:
      collection -
      Returns:
      Whether the given collection is null or has no elements.