java List转换和数组互转

1、List转Array

ArrayList<String> list=new ArrayList<String>();
String[] strings = new String[list.size()];
list.toArray(strings);

2、Array转List

String[] s = {"a","b","c"};
List list = java.util.Arrays.asList(s);

 

posted @ 2019-06-19 20:02  花拾夕  阅读(5456)  评论(0编辑  收藏  举报