Java List转换成String数组几种实现方式详解
程序员文章站
2024-03-08 18:56:22
java list转换成string数组
实现代码:
list list = new arraylist...
java list转换成string数组
实现代码:
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); }
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!