List<String> list = new ArrayList<String>();
Collections.addAll(list, "a", "b", "c");
或
String [] array = new String[] {"a", "b", "c"};
List<String> list = new ArrayList<String>();
Collections.addAll(list, array);
或初始化时添加
List<String> list = new ArrayList<String>(){
{
this.add("a");
this.add("b");
this.add("c");
}
};
相关推荐
List集合取最大最小元素
快速打印数组和List集合中的所有元素的方法
实现 List 转 数组、数组 转 List