String分割成int[]和List<Integer>


int[]
int[] ids= StringUtil.isEmpty(classIds)?null:Arrays.stream(classIds.split(",")).mapToInt(Integer::parseInt).toArray();

 

 
List<Integer>
List<Integer> collect = StringUtil.isEmpty(classIds)?null:Arrays.stream(classIds.split(",")).mapToInt(Integer::parseInt).boxed().collect(Collectors.toList());

 

 
posted @ 2021-12-06 18:52  ToDarcy  阅读(101)  评论(0编辑  收藏  举报