实现代码:
List<String> list = new ArrayList<String>();
list.add("a1");
list.add("a2");
String[] toBeStored = list.toArray(new String[list.size()]);
for(String s : toBeStored) {
System.out.println(s);
}
或
List<String> list = new ArrayList<String>();
list.add("a1");
list.add("a2");
String[] toBeStored = new String[al.size()];
list.toArray(toBeStored);
for (String s : toBeStored) {
System.out.println(s);
}