67,512
社区成员
发帖
与我相关
我的任务
分享
public static boolean isEmpty(Object value)
{
if (value == null)
return true;
if (value instanceof String)
{
String text = (String) value;
return text.isEmpty() || text.trim().isEmpty();
}
if (value.getClass().isArray())
return Array.getLength(value) == 0;
return false;
}
用这个静态方法,去判断。一劳永逸