I am trying to understand the following question I have to answer in an assignment. It is asking about infinite iterators. Where they would be useful? I thought iterators are used to traverse through a collection like:
Iterator itr = ArrayList.iterator();
while (itr.hasNext())
{
System.out.println(itr.next());
}
once itr
reaches the end of the collection, it's done, as long as no other operations must been made in the middle of the iteration. So why even bother with infinite iterators?