首页 > 技术文章 > String转list

michaelcnblogs 2019-09-07 11:14 原文

String l = "63, 47, 51, 35, 36, 52, 37, 53, 38, 54, 39, 55, 40, 56, 41, 57, 42";
List<Integer> list = Arrays.asList(l.split(", ")).stream()
.map(s -> Integer.parseInt(s)) //.map(Integer::valueOf)
.collect(Collectors.toList());

推荐阅读