美文网首页
java 中判断各种数据类型是否为空

java 中判断各种数据类型是否为空

作者: CharlesNg | 来源:发表于2020-08-17 18:49 被阅读0次
  1. 字符串
    java中判断字符串都是空的方法
if(s == null || s.length() == 0) 或者 if(s == null || s.isEmpty())
  1. 判断list是否为空(Map、Set同list)
if(list != null && !list.isEmpty())
  1. 判断date数据类型是否为空
Date date =  //实例化的过程
if( date == null ) {}

相关文章

网友评论

      本文标题:java 中判断各种数据类型是否为空

      本文链接:https://www.haomeiwen.com/subject/ysaqjktx.html