1   
2 String ids= "1,2,3,4,5,6";  
3 List<Long> listIds = Arrays.asList(ids.split(",")).stream().map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());  
4 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://stackoverflow.com/questions/19946980/convert-string-to-listlong

相关文章:

  • 2022-12-23
  • 2021-08-20
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
猜你喜欢
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2021-08-30
  • 2022-12-23
  • 2022-12-23
  • 2021-10-07
相关资源
相似解决方案