java String list转换到array

来源:互联网 发布:中国式父母 知乎 编辑:程序博客网 时间:2024/06/06 12:40
List<String> list = ..;String[] array = list.toArray(new String[list.size()]);

The toArray() method without passing any argument returns Object[]. So you have to pass an array as an argument, which will be filled with the data from the list, and returned. You can pass an empty array as well, but you can also pass an array with the desired size.

参考:

http://stackoverflow.com/questions/4042434/convert-string-arraylist-to-string-array-in-java

原创粉丝点击