Method One: Use the Arrays.aslist () method
String[] STRs = {"One", "one", "three"};
list<string> strlist = array.aslist (STRs);
Attention:
1) This method returns an array-based list view and does not create a list object, so the list cannot be added and deleted.
Making modifications to the list Yes, it will also be modified to the array.
2) The array is converted to a read-only list, using the Collections.unmodifiablelist () method to convert the array to list.
3) Return to the list of deletions, using new ArrayList (Array.aslist (Array)).
Method Two: Using the Collections.addall () method
String[] STRs = {"One", "one", "three"};
list<string> list = new ArrayList ();
Collections.addall (List,strs);
Attention:
This method is equivalent to an add operation that adds elements from the array STRs to the collection list without overwriting the original elements in the collection list.
Method Three: Using the Spring Framework's collectionutils.arraytolist () method
String[] STRs = {"One", "one", "three"};
list<string> list = Collectionutils.arraytolist (STRs);
Convert ArrayList to an array
Using the ToArray () method
arraylist<string> ArrayList = new arraylist<string> ();
Arraylist.add ("one");
Arraylist.add ("both");
String STRs = Arraylist.toarray (new string[0]);//Set conversion array
For more information, please refer to:
Https://www.cnblogs.com/GarfieldEr007/p/7082945.html
Java collections and arrays of mutual transfer