|
JTemporal Home Tutorial |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jtemporal.util.SimpleCloseableIterator
public class SimpleCloseableIterator
Decorates an existing Iterator to make it closeable.
Can also be used just as an iterator proxy to be subclassed and
decorated.
Keeps track of what object has been fetched the lat time the
method next() has been called.
This class is designed to be subclassed to add more functionality.
Not thread safe.
Constructor Summary | |
---|---|
SimpleCloseableIterator(java.util.Iterator model)
If the passed iterator is instanceof CloseableIterator then it will closed when this iterator is closed. |
Method Summary | |
---|---|
void |
close()
Closes the iterator. |
protected java.lang.Object |
getLastFetched()
Returns the last object that has been retrieved using the next() method. |
boolean |
hasNext()
As soon the method returns false the cursor is
automatically closed. |
boolean |
isOpen()
Checks whether the iterator is open, or already closed. |
java.lang.Object |
next()
|
void |
remove()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleCloseableIterator(java.util.Iterator model)
model
- the model iteratorMethod Detail |
---|
protected java.lang.Object getLastFetched()
java.lang.IllegalStateException
- if next() has
not been called yet.public void close()
CloseableIterator
close
in interface CloseableIterator
public void remove()
remove
in interface java.util.Iterator
public boolean hasNext()
CloseableIterator
false
the cursor is
automatically closed.
hasNext
in interface java.util.Iterator
hasNext
in interface CloseableIterator
Iterator.hasNext()
public java.lang.Object next()
next
in interface java.util.Iterator
public boolean isOpen()
CloseableIterator
isOpen
in interface CloseableIterator
true
if the cursor is open.
|
JTemporal Home Tutorial |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |