一、List 转 String[]
@Test
void arraysTostr() {
List<String> list = new ArrayList<>();
list.add("mm");
list.add("nn");
list.add("hh");
String[] strings = list.toArray(new String[list.size()]);
System.out.println(strings.length);
}
二、 String[] 转List
@Test
void strToArrays() {
String[] strs = new String[]{"mm","nn","hh"};
List<String> list = Arrays.asList(strs);
System.out.println(list.toString());
}
版权声明:本文为qq_42862247原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。