Changed isEmpty to accept multiple variables

This commit is contained in:
Ziver Koc 2022-06-01 19:59:22 +02:00
parent 4e01c413e9
commit 75fa916ca5
2 changed files with 37 additions and 2 deletions

View file

@ -32,10 +32,25 @@ import java.util.Map;
*/
public class ObjectUtil {
/**
* @return true if all given Objects are null or empty String, List or Map
*/
public static boolean isEmpty(Object... objs) {
if (isEmptyCheck(objs))
return true;
for (Object obj : objs) {
if (!isEmptyCheck(obj))
return false;
}
return true;
}
/**
* @return true if obj is null or empty String, List, Map
*/
public static boolean isEmpty(Object obj) {
private static boolean isEmptyCheck(Object obj) {
if (obj == null)
return true;