使用 Collections 提升开发效率,势在必得

使用 Collections.addAll 批量给集合添加数据

1
2
3
List<String> nameList = new ArrayList<>();
Collections.addAll(nameList, "白手", "灯光师", "鬼手");
System.out.println(nameList);

输出:

1
[白手, 灯光师, 鬼手]

https://cuifuan.github.io/2022/08/08/back-end/java-base/Collections/
作者
cuifuan
发布于
2022年8月8日
许可协议