int与List类型转化

int与List类型转化

  • Integer与List
Integer[] arrays = {1, 2, 3};
List<Integer> listStrings = Stream.of(arrays).collect(Collectors.toList());
  • Int与List
int[] arrays = {1, 2, 3};
List<Integer> listStrings = Arrays.stream(arrays).boxed().collect(Collectors.toList());
发布了19 篇原创文章 · 获赞 5 · 访问量 7726

猜你喜欢

转载自blog.csdn.net/qq_38119372/article/details/102333781
今日推荐