List

作者: xueyueshuai | 来源:发表于2022-07-18 14:27 被阅读0次
            List<String> stringList0 = new ArrayList<String>();
            stringList0.add("aaa");
            stringList0.add("bbb");
            System.out.println(stringList0.toString());
            //  [aaa, bbb]
    
    
            List<String> stringList1 = Lists.newArrayList("aaa","bbb");
            System.out.println(stringList1.toString());
            // [aaa, bbb]
    
            List<String> stringList2 = Arrays.asList("aaa,bbb".split(","));
            System.out.println(stringList2.toString());
            // [aaa, bbb]
    
            List<String> stringList3 = Arrays.stream("aaa,bbb".split(",")).map(e->{return e+"aaa";}).collect(Collectors.toList());
            System.out.println(stringList3.toString());
            // [aaaaaa, bbbaaa]
    
    
            String str0 = Arrays.stream("aaa,bbb".split(",")).map(e->{return e+"aaa";}).collect(Collectors.joining(","));
            System.out.println(str0);
            // aaaaaa,bbbaaa
    
            String str1 = Lists.newArrayList("aaa","bbb").stream().map(e->{return e+"bbb";}).collect(Collectors.joining(","));
            System.out.println(str1);
            // aaabbb,bbbbbb
    
    
     // 以下都是 true
            System.out.println(StringUtils.isBlank(null));
            System.out.println(StringUtils.isBlank(""));
            System.out.println(StringUtils.isBlank(" "));
            System.out.println(StringUtils.isBlank("            "));
            System.out.println(StringUtils.isBlank("\n \r \t \f"));
           
    

    相关文章

      网友评论

          本文标题:List

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