[java] view plaincopy
 
  1. List<String> list = new ArrayList<String>();    
  2. list.add("a1");    
  3. list.add("a2");    
  4. String[] toBeStored = list.toArray(new String[list.size()]);    
  5. for(String s : toBeStored) {    
  6.      System.out.println(s);    
  7. }    

 

List 转换为 String数组

 

 

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


String 数组转换为 List

 

 

参见:
Collection.toArray()

 

 

http://blog.csdn.net/aaronuu/article/details/7055650

相关文章:

  • 2021-07-28
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2021-08-31
  • 2022-12-23
相关资源
相似解决方案