List is converted to a String array
public static void main(String[] args) {
List<String> list=new ArrayList<String>();
list.add("1");
list.add("2");
System.out.println(list);
String[] strings =list.toArray(new String[list.size()]);
for (String s:strings
) {
System.out.println(s);
}
}
String array converted to List
public static void main(String[] args) {
String[] a=new String[]{"1","2"};
List list= Arrays.asList(a);
System.out.println(list);
}
Read More:
- Array of PHP_ diff,array_ intersect,array_ merge, in_ Is there a limit on the number of arrays in array?
- Python conversion hex to string, high and low data processing
- ‘Conversion failed when converting date and/or time from character string.DB-Lib error message 241,
- [solved] error: valueerror: expected 2D array, got scalar array instead
- A repeated string is composed of two identical strings. For example, abcabc is a repeated string with length of 6, while abcba does not have a duplicate string. Given any string, please help Xiaoqiang find the longest repeated substring.
- Two dimensional array and pointer to one dimensional array
- TSLint:object access via string literals is disallowedtslint(no-string-literal)
- Variable type error: error of array occurs when TP5 controller receives the array of post
- Mybatis custom list collection parser
- Unity short string intercepts long string
- Java String.split () special character processing
- Array initializer is not allowed here
- Local date time conversion in java8
- Leetcode solution 189 Rotate Array Java version
- [Python] numpy library array splicing np.concatenate Detailed explanation and examples of official documents
- Conversion from hexadecimal to decimal
- The conversion between [Python] bytes and hex strings.
- Implement Set using Array.
- Exception jsonmappingexception: out of start_ ARRAY token
- How to use C + + function pointer array