美文网首页
判断字符串与集合是否为空

判断字符串与集合是否为空

作者: 进击的三文鱼 | 来源:发表于2019-05-08 18:20 被阅读0次
    String str ="ss";
    str ="";
    if(str!=null && !str.isEmpty()){
        System.out.println("234");
    }
    List<String> list = new ArrayList<String>();
    list = null;
    if (list != null && !list.isEmpty()) {
        System.out.println("234");
    }
更新 判断字符串是否为空  引用了jpa的StringUtils
       String str ="ss";
        str =null;
        if(StringUtils.isEmpty(str)){
            System.out.println("234");
        }

相关文章

网友评论

      本文标题:判断字符串与集合是否为空

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