1.数组转list
(1)通过ArrayList的构造器
String[] strArray = new String[2]; ArrayList<String> list = new ArrayList<String>(Arrays.asList(strArray)) ;
(2)通过Collections.addAll(arrayList, strArray)
方式转换 (比较高效,推荐使用)
ArrayList< String> arrayList = new ArrayList<String>(strArray.length); Collections.addAll(arrayList, strArray);
(3)使用流方式转换
String[] arrays = {"tom", "jack", "kate"}; List<String> stringList= Stream.of(arrays).collect(Collectors.toList());
2.list转数组
String[] strs = list.toArray(new String[list.size()]);