非空判定工具类

来源:互联网 发布:java 线程池原理 编辑:程序博客网 时间:2024/05/20 04:49
package com.lyt.base.util;


import java.util.Collection;


public class NullUtil {


public static boolean isEmpty(Object objs) {
return (objs == null);
}


public static boolean isEmpty(Object[] objs) {
return ((objs == null) || (objs.length == 0));
}


public static boolean isEmpty(Collection<?> objs) {
return ((objs == null) || (objs.size() <= 0));
}


public static boolean isEmpty(byte[] objs) {
return ((objs == null) || (objs.length == 0));
}


public static boolean isEmpty(String str) {
return ((str == null) || (str.trim().length() == 0));
}


public static boolean isEmpty(Long l) {
return ((l == null) || (l.longValue() == 0L));
}
}
0 0
原创粉丝点击