提升 isAllEmpty方法执行效率

This commit is contained in:
BruceIT 2021-12-27 21:00:39 +08:00 committed by GitHub
parent ce504c2a3e
commit 94d3a40e14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1540,7 +1540,12 @@ public class ArrayUtil extends PrimitiveArrayUtil {
* @since 4.5.18
*/
public static boolean isAllEmpty(Object... args) {
return emptyCount(args) == args.length;
for (Object obj: args) {
if (!ObjectUtil.isEmpty(obj)) {
return false;
}
}
return true;
}
/**
@ -1551,7 +1556,12 @@ public class ArrayUtil extends PrimitiveArrayUtil {
* @since 4.5.18
*/
public static boolean isAllNotEmpty(Object... args) {
return false == hasEmpty(args);
for (Object obj: args) {
if (ObjectUtil.isEmpty(obj)) {
return false;
}
}
return true;
}
/**