Interface CloseableIterator<T>
-
- All Superinterfaces:
AutoCloseable
,Iterator<T>
- All Known Implementing Classes:
CloseableIterator.EmptyCloseableIterator
,DefaultCloseableIterator
,TinkerGraphIterator
public interface CloseableIterator<T> extends Iterator<T>, AutoCloseable
An extension ofIterator
that implementsAutoCloseable
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)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
CloseableIterator.EmptyCloseableIterator<T>
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default void
close()
static <T> void
closeIterator(Iterator<T> iterator)
static <T> CloseableIterator<T>
empty()
static <T> CloseableIterator<T>
of(Iterator<T> iterator)
Wraps an existingIterator
in aCloseableIterator
.-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
-
-
-
Method Detail
-
of
static <T> CloseableIterator<T> of(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
-
closeIterator
static <T> void closeIterator(Iterator<T> iterator)
-
empty
static <T> CloseableIterator<T> empty()
-
-