Class CloseableIteratorAdapter<T>
java.lang.Object
fr.lirmm.graphik.util.stream.CloseableIteratorAdapter<T>
- Type Parameters:
T- type of elements of the iterator
- All Implemented Interfaces:
CloseableIterator<T>, CloseableIteratorWithoutException<T>, Closeable, AutoCloseable, Iterator<T>
public class CloseableIteratorAdapter<T>
extends Object
implements CloseableIteratorWithoutException<T>
Adapts standard iterators and streams to the closeable-iterator API.
- Author:
- Clément Sipieter (INRIA) <clement@6pi.fr>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCloseableIteratorAdapter(Iterator<T> iterator) Adapts the specified iterator.CloseableIteratorAdapter(Stream<T> stream) Adapts the specified stream. -
Method Summary
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining, remove
-
Field Details
-
iterator
-
stream
-
isClosed
protected boolean isClosedIndicates whether this adapter has been closed.
-
-
Constructor Details
-
CloseableIteratorAdapter
-
CloseableIteratorAdapter
-
-
Method Details
-
hasNext
public boolean hasNext()Description copied from interface:CloseableIteratorReturns whether another element is available.- Specified by:
hasNextin interfaceCloseableIterator<T>- Specified by:
hasNextin interfaceCloseableIteratorWithoutException<T>- Specified by:
hasNextin interfaceIterator<T>- Returns:
- true if another element can be read
-
next
Description copied from interface:CloseableIteratorReturns the next element.- Specified by:
nextin interfaceCloseableIterator<T>- Specified by:
nextin interfaceCloseableIteratorWithoutException<T>- Specified by:
nextin interfaceIterator<T>- Returns:
- the next element
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceCloseableIterator<T>
-