数组转List:
String[] arr = new String[] {"str1", "str2"};
List<String> list = Arrays.asList(arr);
List转数组:
List<String> list = new ArrayList<String>();
list.add("str1");
list.add("str2");
int size = list.size();
String[] arr = (String[])list.toArray(new String[size]);
时间: 2024-10-15 01:13:01