迭代器简易用法Iterator
1 public static void main(String[] args) { 2 List<String> list = Arrays.asList("111","222","111","333","4444"); 3 Collections.reverse(list); 4 System.out.println(list); 5 Iterator<String> iterator = list.iterator(); 6 while (iterator.hasNext()) { 7 String str = iterator.next(); 8 System.out.println(str); 9 } 10 }