Lists.newArrayList() 的用法

坐标依赖

 <dependency>
     <groupId>com.google.code.google-collections</groupId>
      <artifactId>google-collect</artifactId>
      <version>snapshot-20080530</version>
 </dependency>

用法:

 public static void main(String[] args) {
    
    
        List<String> list1 = null;
        List<String> list = Optional.ofNullable(list1).orElse( Lists.newArrayList()).stream().collect(Collectors.toList());
        Out.out(list);
    }

运行结果:

ziyuan 2023 2023-04-14 10:44:48 []

猜你喜欢

转载自blog.csdn.net/qq_15283475/article/details/130148586
今日推荐