且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将Java 8 IntStream转换为List?

更新时间:2023-02-14 10:21:16

IntStream.boxed IntStream 转换为 Stream< Integer> ,然后您可以收集到列表中:

IntStream.boxed turns an IntStream into a Stream<Integer>, which you can then collect into a list:

theIntStream.boxed().collect(Collectors.toList())