Class CollectionUtils

java.lang.Object
no.mnemonic.commons.utilities.collections.CollectionUtils

public class CollectionUtils extends Object
  • Method Details

    • isEmpty

      public static <T> boolean isEmpty(Collection<T> collection)
      Null-safe operation to test if a collection is empty.
      Type Parameters:
      T - Type of collection elements.
      Parameters:
      collection - Collection to be tested.
      Returns:
      Returns true if the collection is null or contains no elements.
    • size

      public static int size(Collection collection)
      Null-safe operation to determine the size of a collection.
      Parameters:
      collection - Collection to compute size for.
      Returns:
      Returns 0 if the collection is null, otherwise the number of elements in the collection.