public interface CloseableIterator<E> extends AutoCloseable, Iterator<E>
Iterator
and AutoCloseable
interfaces. This is
useful when you have data that must be iterated on and may hold resources in the underlying implementation that
must be closed.
Some implementations may close resources automatically when the iterator is finished being iterated on however
this is an implementation detail and all callers should call AutoCloseable.close()
method to be
sure all resources are freed properly.
Modifier and Type | Method and Description |
---|---|
void |
close() |
forEachRemaining, hasNext, next, remove
void close()
close
in interface AutoCloseable
Copyright © 2021 JBoss by Red Hat. All rights reserved.