java String [], ArrayList array of strings and string collection system conversion.

1, String [] transfected ArrayList <String> (string array to a set of strings).

// Create the set array 
String [] = new new String String [. 5]; 
the ArrayList <String> = new new List the ArrayList <String> (); 
// to turn into the collection array, i.e. the array of data has been stored inside the set; 
Collections.addAll (list, string);

2, ArrayList <String> String rotation [] (set to String String Array).

ArrayList<String> list = new ArrayList<String>();
String[] string = (String[]) list.toArray();//集合转数组

  



Guess you like

Origin www.cnblogs.com/mengweihong/p/11365244.html