List<Long> 与 字符串 相互转换

https://blog.csdn.net/u012516166/article/details/78913871

 

示例:

String ids= "1,2,3,4,5,6";
List<Long> listIds = Arrays.asList(ids.split(",")).stream().map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());
System.out.println(Arrays.toString(listIds .toArray()));//[1,2,3,3,4,5,6]

  

posted @ 2018-11-22 20:47  sunnyamy  阅读(1999)  评论(0编辑  收藏  举报