String[] 转List

时间:2022-11-23 07:28:31

String[] 转List<String>

String[] idArr = ids.split(",");
List<String> idList = new ArrayList<String>();
Collections.addAll(idList, idArr);

List<String>转String[]

List<String> list= new ArrayList<String>();
String[] strings = new String[list.size()];
list.toArray(strings);