eu.larkc.core.data.iterator
Class SimpleCloseableIterator<T>

java.lang.Object
  extended by eu.larkc.core.data.iterator.SimpleCloseableIterator<T>
All Implemented Interfaces:
CloseableIterator<T>, java.util.Iterator<T>

public class SimpleCloseableIterator<T>
extends java.lang.Object
implements CloseableIterator<T>


Constructor Summary
SimpleCloseableIterator(java.util.Iterator<T> iterator)
           
 
Method Summary
 void close()
          Closes the current iterator and all subsequent operations will raise exception.
 boolean hasNext()
          Checks whether the next result could be returned.
 boolean isClosed()
          Verifies if the current iterator is closed.
 T next()
          Fetches the next result from the iterator.
 void remove()
          Removes the current item from the iterated collection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleCloseableIterator

public SimpleCloseableIterator(java.util.Iterator<T> iterator)
Method Detail

close

public void close()
Description copied from interface: CloseableIterator
Closes the current iterator and all subsequent operations will raise exception. The method could be invoked many times.

Specified by:
close in interface CloseableIterator<T>

hasNext

public boolean hasNext()
Description copied from interface: CloseableIterator
Checks whether the next result could be returned.

Specified by:
hasNext in interface CloseableIterator<T>
Specified by:
hasNext in interface java.util.Iterator<T>
Returns:
whether a next item is available

next

public T next()
Description copied from interface: CloseableIterator
Fetches the next result from the iterator.

Specified by:
next in interface CloseableIterator<T>
Specified by:
next in interface java.util.Iterator<T>
Returns:
the next item

remove

public void remove()
Description copied from interface: CloseableIterator
Removes the current item from the iterated collection. This method may be not implemented.

Specified by:
remove in interface CloseableIterator<T>
Specified by:
remove in interface java.util.Iterator<T>

isClosed

public boolean isClosed()
Description copied from interface: CloseableIterator
Verifies if the current iterator is closed.

Specified by:
isClosed in interface CloseableIterator<T>
Returns:
is closed