"s"中包含AttributeGet:1,16,10106,10111
,需要获取属性ID列表中冒号后面的所有数字。有多种方法可以实现,但是否有一种方法可以直接将List<String>
转换为List<Integer>
?由于下面的代码提示类型不匹配,所以我尝试使用Integer.parseInt,但我认为这对于List无效。其中"s"是一个字符串。
private static List<Integer> attributeIDGet = new ArrayList<Integer>();
if(s.contains("AttributeGet:")) {
attributeIDGet = Arrays.asList(s.split(":")[1].split(","));
}