Skip to content

Commit 25279ae

Browse files
author
zihluwang
committed
feat: check whether a collection is empty or not
1 parent c4dd542 commit 25279ae

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

common-toolbox/src/main/java/com/onixbyte/common/util/CollectionUtil.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,20 @@ public static <T, C extends Collection<T>> List<C> chunk(
113113
}
114114

115115
/**
116-
* Check whether a given collection is not empty.
116+
* Check if a collection is not null and not empty.
117117
*
118-
* @param collection the collection to be checked
119-
* @return {@code true} if provided collection is not null and not empty,
120-
* {@code false} otherwise
118+
* @param collection the collection to check
119+
* @return {@code true} if the collection is not null and not empty, {@code false} otherwise
121120
*/
122121
public static boolean notEmpty(Collection<?> collection) {
123122
return Objects.nonNull(collection) && !collection.isEmpty();
124123
}
125124

126125
/**
127-
* Check whether a given collection is empty.
126+
* Check if a collection is null or empty.
128127
*
129-
* @param collection the collection to be checked
130-
* @return {@code true} if provided collection is null or is empty, {@code false} otherwise
128+
* @param collection the collection to check
129+
* @return {@code true} if the collection is null or empty, {@code false} otherwise
131130
*/
132131
public static boolean isEmpty(Collection<?> collection) {
133132
return Objects.isNull(collection) || collection.isEmpty();

0 commit comments

Comments
 (0)