IntおよびListタイプの変換

Intおよび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