org.openbp.common.util.iterator
Class WrappingIterator

java.lang.Object
  extended by org.openbp.common.util.iterator.WrappingIterator
All Implemented Interfaces:
java.util.Iterator

public abstract class WrappingIterator
extends java.lang.Object
implements java.util.Iterator

Base class for an iterator that wraps another iterator.

Author:
Heiko Erhardt

Constructor Summary
WrappingIterator()
          Default constructor.
WrappingIterator(java.util.Iterator basis)
          Constructor.
 
Method Summary
 boolean hasNext()
          Implementation of Iterator interface.
 java.lang.Object next()
          Implementation of the Iterator interface.
 void remove()
          Removes the current element (not supported).
protected abstract  java.lang.Object retrieveCurrentObject(java.util.Iterator basis)
          Retrieves current object by querying the underlying iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WrappingIterator

public WrappingIterator()
Default constructor.


WrappingIterator

public WrappingIterator(java.util.Iterator basis)
Constructor.

Parameters:
basis - Contains the iterator we are based on
Method Detail

hasNext

public boolean hasNext()
Implementation of Iterator interface.

Specified by:
hasNext in interface java.util.Iterator
Returns:
Always false

next

public java.lang.Object next()
Implementation of the Iterator interface.

Specified by:
next in interface java.util.Iterator
Returns:
Nothing, throws a NoSuchElementException instead

remove

public void remove()
Removes the current element (not supported).

Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException - Always

retrieveCurrentObject

protected abstract java.lang.Object retrieveCurrentObject(java.util.Iterator basis)
Retrieves current object by querying the underlying iterator.

Parameters:
basis - The underlying iterator
Returns:
The current object or null if the end of the underlying iterator has been reached.


Copyright © 2011. All Rights Reserved.