将以逗号分割的字符串转换成List
String ids= "1,2,32,59,96";
List<Long> idsList = Arrays.asList(ids.split(",")).stream().map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());
基于StringUtils把List转换成String:
ids = StringUtils.join(idsList, ",");
String result = StringUtils.strip(idsList.toString(),"[]");
System.out.println(result);