java8 字符串转换 list long Integer

 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]

//You can use the Lambda functions of Java 8 to achieve this without looping
//来自:http://*.com/questions/19946980/convert-string-to-listlong

上一篇:C#设计模式——抽象工厂模式(原文转自:http://blog.jobbole.com/78059/)


下一篇:IT兄弟连 JavaWeb教程 JSP静态包含和动态包含的区别