Class CollectionUtils

java.lang.Object
io.github.blyznytsiaorg.bibernate.utils.CollectionUtils

public class CollectionUtils extends Object
Utility class for common operations on collections.
Since:
1.0
Author:
Blyzhnytsia Team
  • Constructor Details

    • CollectionUtils

      public CollectionUtils()
  • Method Details

    • isEmpty

      public boolean isEmpty(Collection<?> collection)
      Checks if a collection is empty.
      Parameters:
      collection - the collection to check
      Returns:
      true if the collection is null or empty, false otherwise
    • isNotEmpty

      public boolean isNotEmpty(Collection<?> collection)
      Checks if a collection is not empty.
      Parameters:
      collection - the collection to check
      Returns:
      true if the collection is not null and not empty, false otherwise
    • requireNonEmpty

      public void requireNonEmpty(Collection<?> collection, String message)
      Requires that a collection is not empty, throwing an exception with the specified message if it is.
      Parameters:
      collection - the collection to check
      message - the message to include in the exception if the collection is empty
      Throws:
      CollectionIsEmptyException - if the collection is empty