List与String数组转换

List 转换为 String数组

List<String> list = new ArrayList<String>();    
list.add("a1");    
list.add("a2");    
String[] toBeStored = list.toArray(new String[list.size()]);  

 

String数组转List

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

 

posted @ 2017-08-23 09:39  Yannis-chen  阅读(757)  评论(0编辑  收藏  举报