String数组转List,List转String数组

    List<String> list = new ArrayList<String>();  
    list.add("a1");  
    list.add("a2");  
    String[] toBeStored = list.toArray(new String[list.size()]);  
    for(String s : toBeStored) {  
         System.out.println(s);  
    }  

List 转换为 String数组


String[] arr = new String[] {"1", "2"};
List list = Arrays.asList(arr);

String 数组转换为 List


参见:
Collection.toArray()

相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页