String ids = new String("111,22,33,44");String[] items = ids.split(",");List<Integer> appIdList = Stream.of(items).map(Integer::parseInt).collect(Collectors.toList());
通过构造stream,使用stream的中间方法map进行String -> Integer的转化,最后使用stream的末端方法输出list。
String ids = new String("111,22,33,44");String[] items = ids.split(",");List<Integer> appIdList = Stream.of(items).map(Integer::parseInt).collect(Collectors.toList());
通过构造stream,使用stream的中间方法map进行String -> Integer的转化,最后使用stream的末端方法输出list。
版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。