Package com.day.util
Class CompoundIterator
- java.lang.Object
 - 
- com.day.util.CompoundIterator
 
 
- 
- All Implemented Interfaces:
 java.util.Iterator
public class CompoundIterator extends java.lang.Object implements java.util.IteratorImplements theIteratorinterface and combines twoIteratorobjects into one singleIterator.The constructor takes two
Iteratorarguments:parentandchild. Callingnext()on thisIteratorwill first try to return an element from the parentIteratorand once the parentIteratordoes not have any more elements it will return elements from the childIterator.- Since:
 - fennec Audience wad
 
 
- 
- 
Constructor Summary
Constructors Constructor Description CompoundIterator(java.util.Iterator parent, java.util.Iterator child)Creates aCompoundIteratorbased onparentandchild. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasNext()Returnstrueif either parent or child iterator has a next element;falseotherwise.java.lang.Objectnext()Returns the next element from the parent or the child iterator object.voidremove()Always throwsUnsupportedOperationException 
 - 
 
- 
- 
Constructor Detail
- 
CompoundIterator
public CompoundIterator(java.util.Iterator parent, java.util.Iterator child)Creates aCompoundIteratorbased onparentandchild. ThisCompountIteratorwill first return elements fromparentand then elements fromchild.- Parameters:
 parent- theIteratorfrom where to return the elements first.child- theIteratorfrom where to return the elements afterparentdoes not have elements any more.
 
 - 
 
- 
Method Detail
- 
hasNext
public boolean hasNext()
Returnstrueif either parent or child iterator has a next element;falseotherwise.- Specified by:
 hasNextin interfacejava.util.Iterator- Returns:
 trueif either parent or child iterator has a next element;falseotherwise.
 
- 
next
public java.lang.Object next()
Returns the next element from the parent or the child iterator object.- Specified by:
 nextin interfacejava.util.Iterator- Returns:
 - the next element from the parent or the child iterator object.
 
 
- 
remove
public void remove() throws java.lang.UnsupportedOperationExceptionAlways throwsUnsupportedOperationException- Specified by:
 removein interfacejava.util.Iterator- Throws:
 java.lang.UnsupportedOperationException- always!
 
 - 
 
 -