📜  int[] -&gt; Integer[] 或列表<Integer>- 无论代码示例

📅  最后修改于: 2022-03-11 14:58:55.308000             🧑  作者: Mango

代码示例1
int[] data = {1,2,3,4,5,6,7,8,9,10};

// To boxed array
Integer[] what = Arrays.stream( data ).boxed().toArray( Integer[]::new );
Integer[] ever = IntStream.of( data ).boxed().toArray( Integer[]::new );

// To boxed list
List you  = Arrays.stream( data ).boxed().collect( Collectors.toList() );
List like = IntStream.of( data ).boxed().collect( Collectors.toList() );