net.sf.molae.pipe.correct
Class CorrectIterator

java.lang.Object
  |
  +--org.apache.commons.collections.iterators.ProxyIterator
        |
        +--net.sf.molae.pipe.correct.CorrectIterator
All Implemented Interfaces:
Iterator

public class CorrectIterator
extends org.apache.commons.collections.iterators.ProxyIterator

Wrapper class to receive the correct exceptions from iterators.


Constructor Summary
CorrectIterator(Iterator base)
          Constructs a new exception safe iterator wrapper.
 
Method Summary
 void remove()
          Calls the corresponding method of the base iterator and maps NoSuchElementException to IllegalStateException.
 
Methods inherited from class org.apache.commons.collections.iterators.ProxyIterator
getIterator, hasNext, next, setIterator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CorrectIterator

public CorrectIterator(Iterator base)
Constructs a new exception safe iterator wrapper.
Parameters:
base - the underlying iterator
Throws:
NullPointerException - if the specified object is null.
Method Detail

remove

public void remove()
Calls the corresponding method of the base iterator and maps NoSuchElementException to IllegalStateException.
Overrides:
remove in class org.apache.commons.collections.iterators.ProxyIterator
Throws:
UnsupportedOperationException - depending on the base iterator
IllegalStateException - if the base iterator has thrown a IllegalStateException or NoSuchElementException