List转List


public static void main(String[] args) {
	List<String> strList = new ArrayList<String>();
	strList.add("1");
	strList.add("2");
	strList.add("3");
	strList.add("4");
	strList.add("5");
	strList.add("6");
	for (String str : strList) {
		System.out.println("这是String类型:" + str);
	}
	System.out.println("+++++++++++++++++++++++++++++++++");
    List<Integer> intList = strList.stream().map(Integer::parseInt).collect(Collectors.toList());
    for (Integer code : intList) {
    	System.out.println("这是Integer类型:"+code);
}
上一篇:java 16.数组工具类Arrays


下一篇:Java中各种数据结构的遍历