【发布时间】:2020-09-20 10:02:58
【问题描述】:
如果我运行这行代码:
Arrays.stream(new int[] {2, 4, 6, 8, 10}).forEach(x->System.out.print(x+ " " ));
值是否有装箱或拆箱?
【问题讨论】:
-
您可以使用 boxed() 方法将其装箱为整数。试试这个例子:.List
list = Arrays.stream(new int[] {2, 4, 6, 8, 10}) .sorted() .boxed() .collect(Collectors.toList());
标签: java java-stream