diff --git a/common-toolbox/src/main/java/com/onixbyte/common/util/CollectionUtil.java b/common-toolbox/src/main/java/com/onixbyte/common/util/CollectionUtil.java index 615f1ee..2303b72 100644 --- a/common-toolbox/src/main/java/com/onixbyte/common/util/CollectionUtil.java +++ b/common-toolbox/src/main/java/com/onixbyte/common/util/CollectionUtil.java @@ -112,4 +112,24 @@ public final class CollectionUtil { return result; } + /** + * Check if a collection is not null and not empty. + * + * @param collection the collection to check + * @return {@code true} if the collection is not null and not empty, {@code false} otherwise + */ + public static boolean notEmpty(Collection collection) { + return Objects.nonNull(collection) && !collection.isEmpty(); + } + + /** + * Check if a collection is null or empty. + * + * @param collection the collection to check + * @return {@code true} if the collection is null or empty, {@code false} otherwise + */ + public static boolean isEmpty(Collection collection) { + return Objects.isNull(collection) || collection.isEmpty(); + } + } diff --git a/gradle.properties b/gradle.properties index 526a544..3c0b678 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,7 +20,7 @@ # SOFTWARE. # -artefactVersion=3.1.0 +artefactVersion=3.2.0 projectUrl=https://onixbyte.com/projects/onixbyte-toolbox projectGithubUrl=https://github.com/onixbyte/onixbyte-toolbox licenseName=MIT