T
- the type of iterated elements.public interface CloseableIterator<T> extends Iterator<T>, AutoCloseable
Iterator
that is also AutoCloseable
. A typical use-case for this
interface are iterators that are based on native-resources such as files, network, or database connections. Clients
must call AutoCloseable.close()
after using the iterator.Modifier and Type | Interface and Description |
---|---|
static class |
CloseableIterator.IteratorAdapter<E>
Adapter from
Iterator to CloseableIterator . |
Modifier and Type | Field and Description |
---|---|
static CloseableIterator<?> |
EMPTY_INSTANCE |
Modifier and Type | Method and Description |
---|---|
static <T> CloseableIterator<T> |
adapterForIterator(Iterator<T> iterator) |
static <T> CloseableIterator<T> |
empty() |
forEachRemaining, hasNext, next, remove
close
static final CloseableIterator<?> EMPTY_INSTANCE
@Nonnull static <T> CloseableIterator<T> adapterForIterator(@Nonnull Iterator<T> iterator)
static <T> CloseableIterator<T> empty()
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.