Collection集合变数组: 集合变量.toArray();
数组变Collection集合:
1.遍历的方式,依次添加到集合中。
2.Arrays.asList( 数组名)方法
3.List.of()方法 java9才有
4.Collections.addAll(集合,数组)方法,将集合存储到数组中
集合数组的转换
最新推荐文章于 2024-05-21 10:58:41 发布
Collection集合变数组: 集合变量.toArray();
数组变Collection集合:
1.遍历的方式,依次添加到集合中。
2.Arrays.asList( 数组名)方法
3.List.of()方法 java9才有
4.Collections.addAll(集合,数组)方法,将集合存储到数组中