Class Collections

java.lang.Object
com.thebuzzmedia.exiftool.commons.iterables.Collections

public final class Collections extends Object
Static Collection Utilities.
  • Method Details

    • isEmpty

      public static <T> boolean isEmpty(Collection<T> values)
      Check if collection is empty (null or empty).
      Type Parameters:
      T - Type of element in collection.
      Parameters:
      values - Collection of values.
      Returns:
      true if collection is empty (null or empty), false otherwise.
    • isNotEmpty

      public static <T> boolean isNotEmpty(Collection<T> values)
      Check if collection is not empty (not null and not empty).
      Type Parameters:
      T - Type of element in collection.
      Parameters:
      values - Collection of values.
      Returns:
      true if collection is not empty (not null and not empty), false otherwise.
    • size

      public static <T> int size(Collection<T> values)
      Get size of collection. If collection is empty (null or empty), zero will be returned.
      Type Parameters:
      T - Type of element in collection.
      Parameters:
      values - Collection of values.
      Returns:
      Size of collection.
    • toCollection

      public static <T> Collection<T> toCollection(Iterable<T> iterables)
      Create in memory collection from given iterable elements.
      • If iterables is null, an empty array list is returned.
      • If iterables is already an instance of Collection, it is returned.
      • Otherwise, iterable structure is iterated and loaded into an ArrayList.
      Type Parameters:
      T - Type of element in iterable structure.
      Parameters:
      iterables - Given iterable.
      Returns:
      The collection result.
    • addAll

      public static <T> void addAll(Collection<T> collection, Iterable<T> iterable)
      Add all elements of given iterable structure to given collection.
      Type Parameters:
      T - Type of elements.
      Parameters:
      collection - The collection.
      iterable - The iterable structure.