Iterator
Collection<String> coll = new ArrayList<>(); coll.add("a"); coll.add("b"); Iterator<String> it = coll.iterator();//指针指向集合的-1索引 while (it.hasNext()){ System.out.println(it.next());//取出下一个元素并把指针向后移动一位。 }
原文:https://www.cnblogs.com/yinmu/p/15213296.html