Package diva.util
Class IteratorIterator
- java.lang.Object
-
- diva.util.IteratorAdapter
-
- diva.util.IteratorIterator
-
- All Implemented Interfaces:
java.util.Iterator
public abstract class IteratorIterator extends IteratorAdapter
An iterator that takes an iterator over objects that themselves produce iterators, and which iterators over the elements in the sub-iterators. To get the iterators from the objects iterated over, the method iterator() must be over-ridden to convert a given result from the top-level iterator into a sub-iterator.- Version:
- $Id$
- Author:
- John Reekie
-
-
Constructor Summary
Constructors Constructor Description IteratorIterator(java.util.Iterator i)Construct a new iterator over the contents of the given iterator.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanhasNext()Test if there are more elements.protected abstract java.util.Iteratoriterator(java.lang.Object o)Convert an object returned by the top-level iterator into a sub-iterator.java.lang.Objectnext()Return the next object.-
Methods inherited from class diva.util.IteratorAdapter
remove
-
-
-
-
Method Detail
-
hasNext
public boolean hasNext()
Test if there are more elements. This will return false if the top-level iterator has no more elements.- Specified by:
hasNextin interfacejava.util.Iterator- Overrides:
hasNextin classIteratorAdapter
-
iterator
protected abstract java.util.Iterator iterator(java.lang.Object o)
Convert an object returned by the top-level iterator into a sub-iterator.
-
next
public java.lang.Object next() throws java.util.NoSuchElementExceptionReturn the next object.- Specified by:
nextin interfacejava.util.Iterator- Overrides:
nextin classIteratorAdapter- Returns:
- The next object
- Throws:
java.util.NoSuchElementException
-
-