Merge pull request #2045 from BruceIT/v5-dev

提升 isAllEmpty方法执行效率
This commit is contained in:
Golden Looly 2021-12-29 07:35:50 +08:00 committed by GitHub
commit c72ae732b2
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 * @since 4.5.18
*/ */
public static boolean isAllEmpty(Object... args) { 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 * @since 4.5.18
*/ */
public static boolean isAllNotEmpty(Object... args) { public static boolean isAllNotEmpty(Object... args) {
return false == hasEmpty(args); for (Object obj: args) {
if (ObjectUtil.isEmpty(obj)) {
return false;
}
}
return true;
} }
/** /**