完善常用工具类.

pull/84/head
chen.ma 3 years ago
parent 030c99466d
commit 2177b9cb27

@ -1,6 +1,7 @@
package cn.hippo4j.common.toolkit; package cn.hippo4j.common.toolkit;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -27,6 +28,37 @@ public class CollectionUtil {
return null; return null;
} }
/**
* Is empty.
*
* @param list
* @return
*/
public static boolean isEmpty(List<?> list) {
return list == null || list.isEmpty();
}
/**
* Is not empty.
*
* @param list
* @return
*/
public static boolean isNotEmpty(List<?> list) {
return !isEmpty(list);
}
/**
* Is empty.
*
* @param map
* @return
*/
public static boolean isEmpty(Map<?, ?> map) {
return map == null || map.isEmpty();
}
/** /**
* Is not empty. * Is not empty.
* *
@ -34,7 +66,7 @@ public class CollectionUtil {
* @return * @return
*/ */
public static boolean isNotEmpty(Map<?, ?> map) { public static boolean isNotEmpty(Map<?, ?> map) {
return map != null && map.isEmpty() == false; return !isEmpty(map);
} }
} }

Loading…
Cancel
Save