41 Java中List转换为数组,数组转List

List转换为Array可以这样处理:

ArrayList list=new ArrayList();

String[] strings = new String[list.size()];

list.toArray(strings);

反过来,如果要将数组转成List怎么办呢?如下:

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








你可能感兴趣的:(41 Java中List转换为数组,数组转List)