Interface CloseableIterator<T>
-
- All Superinterfaces:
AutoCloseable
,Closeable
,Iterator<T>
- All Known Implementing Classes:
DefaultCloseableIterator
,TinkerGraphIterator
public interface CloseableIterator<T> extends Iterator<T>, Closeable
An extension ofIterator
that implementsCloseable
which allows aGraph
implementation that hold open resources to provide the user the option to release those resources.- Author:
- Stephen Mallette (http://stephen.genoprime.com)
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description static <T> CloseableIterator<T>
asCloseable(Iterator<T> iterator)
Wraps an existingIterator
in aCloseableIterator
.default void
close()
static <T> void
closeIterator(Iterator<T> iterator)
-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
-
-
-
Method Detail
-
asCloseable
static <T> CloseableIterator<T> asCloseable(Iterator<T> iterator)
Wraps an existingIterator
in aCloseableIterator
. If theIterator
is already of that type then it will simply be returned as-is.
-
close
default void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
closeIterator
static <T> void closeIterator(Iterator<T> iterator)
-
-