collection.stream将会破坏原有的数据结构,可以通过collect方法收集,可以用Collectors提供的构造器,add等方法构造形成新的数据结构。
HashSet> rs = new HashSet<>();
rs.stream().toList();
Collection集合转化为数组,存在复合数据结构并不能直接转化为数组,只能通过for循环,手动转化。
int[] numss = item.stream().mapToInt(x -> x).toArray();
List ints = rs.stream().map((item) -> {return item.stream().mapToInt(x -> x).toArray();}).toList();
int[][] intArray = new int[ints.size()][3];for(int i=0;iints1[i]=ints.get(i);}