Int and List type conversion

Int and List type conversion

  • Integer and List
Integer[] arrays = {1, 2, 3};
List<Integer> listStrings = Stream.of(arrays).collect(Collectors.toList());
  • Int and List
int[] arrays = {1, 2, 3};
List<Integer> listStrings = Arrays.stream(arrays).boxed().collect(Collectors.toList());
Published 19 original articles · won praise 5 · Views 7726

Guess you like

Origin blog.csdn.net/qq_38119372/article/details/102333781