String string="1786,1867,1809";
String stringArray[] = string.split(",");
List<String> stringList = Arrays.asList(stringArray);
List<Integer> integerList =stringList.stream().map(x -> Integer.parseInt(x)).collect(Collectors.toList());
System.out.println(integerList);//输出[1786, 1867, 1809]
List<String>转换为List<Integer>
最新推荐文章于 2022-07-13 16:56:44 发布