String[] coins = {"A","B","C","D","E"};
List l = new ArrayList();
for (int i = 0 ; i < coins.length; i++) {
l.add(coins[i]);
ListIterator liter = l.listIterator();
System.out.println("方法");
while (liter.hasNext())
System.out.println(liter.next());
Collections.reverse(l);
liter = l.listIterator();
System.out.println("反转后");
while (liter.hasNext())
System.out.println(liter.next()); |
|