String categorys = "12,34,54,64,6,4,32";
List<Integer> listIds = Arrays.asList(categorys.split(","))
.stream().map(s -> Integer.parseInt(s.trim()))
.collect(Collectors.toList());
listIds.forEach(s ->System.out.print(s+" "));
//结果:12 34 54 64 6 4 32
使用逗号分隔字符串转List<Integer>
最新推荐文章于 2022-10-26 17:45:00 发布