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


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

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

注意判空

posted @ 2021-11-22 10:05  liaozk  阅读(92)  评论(0编辑  收藏  举报