Class LookAheadIterator<E>
java.lang.Object
org.eclipse.rdf4j.common.iterator.AbstractCloseableIterator<E>
org.eclipse.rdf4j.common.iterator.LookAheadIterator<E>
- All Implemented Interfaces:
Closeable, AutoCloseable, Iterator<E>
- Direct Known Subclasses:
UnionIterator
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract EGets the next element.protected voidprotected voidCalled byAbstractCloseableIterator.close()when it is called for the first time.final booleanhasNext()private voidFetches the next element if it hasn't been fetched yet and stores it innextElement.final Enext()voidremove()Throws anUnsupportedOperationException.Methods inherited from class AbstractCloseableIterator
close, isClosedMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining
-
Field Details
-
nextElement
-
closeException
-
-
Constructor Details
-
LookAheadIterator
protected LookAheadIterator()
-
-
Method Details
-
getNextElement
Gets the next element. Subclasses should implement this method so that it returns the next element.- Returns:
- The next element, or null if no more elements are available.
-
hasNext
public final boolean hasNext() -
next
-
lookAhead
private void lookAhead()Fetches the next element if it hasn't been fetched yet and stores it innextElement. -
remove
public void remove()Throws anUnsupportedOperationException. -
handleClose
Description copied from class:AbstractCloseableIteratorCalled byAbstractCloseableIterator.close()when it is called for the first time. This method is only called once on each iteration. By default, this method does nothing.- Overrides:
handleClosein classAbstractCloseableIterator<E>- Throws:
IOException
-
handleAlreadyClosed
- Overrides:
handleAlreadyClosedin classAbstractCloseableIterator<E>- Throws:
IOException
-