1、数组转换成List
public static <T> List<T> asList(T... a)
String[] arr = new String[] {"str1", "str2"};
2、List转换成数组
public Object[] toArray()
public <T> T[] toArray(T[] a)
示例代码:
List<String> list = new ArrayList<String>();
list.add("str1");
list.add("str2");
int size = list.size();
String[] arr =(String[])list.toArray(new String[size]);//使用了第二种接口,返回值和参数均为结果