List转换为Array可以这样处理:
ArrayList<String> list=new ArrayList<String>();
String[] strings = new String[list.size()];
list.toArray(strings);
反过来,如果要将数组转成List怎么办呢?如下:
String[] s = {"a","b","c"};
List list = java.util.Arrays.asList(s);
int数组无法直接转成List,可以使用guava
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>25.0-jre</version>
</dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>25.0-jre</version>
</dependency>
int[] memIdsArr={1,2,3,4};
List<Integer> memIdsList = Ints.asList(memIdsArr);