标签:collect arraylist list while print static int iter 反转
/**
* 反转集合中的内容
*/
private static void test03() {
List<String> list = new ArrayList<>();
Collections.addAll(list, "w", "l", "m");//给list集合添加元素
Collections.reverse(list);//反转list集合
Iterator<String> itre = list.iterator();
while (itre.hasNext()) {
System.out.print(itre.next() + "、");
}
}
标签:collect arraylist list while print static int iter 反转
原文地址:https://www.cnblogs.com/wangffeng293/p/14285314.html