空指针

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/cheidou123/article/details/81777166
    List<String> list = new ArrayList<>(null);          // 空指针
    Set<String> set = new HashSet<>(null);              //空指针
    Set<String> set2 = new HashSet<>(new ArrayList<>());   //不会报空指针

猜你喜欢

转载自blog.csdn.net/cheidou123/article/details/81777166