首页 > 代码库 > 数组 , List互转

数组 , List互转

调用库函数:
String[] s = {"aa","bb","cc","dd","ee"}; 
List<String> list = Arrays.asList(s);
 
String[] s1 = (String[]) list.toArray();
 
String[] s = {"aa","bb","cc","dd","ee"}; 
ArrayList<String> list = new ArrayList<String>();
for (String string : s) {
    list.add(string);
}

数组 , List互转