Package io.servicetalk.concurrent
Interface CloseableIterable<T>
-
- Type Parameters:
T- the type of elements returned by theCloseableIterator.
- All Superinterfaces:
java.lang.Iterable<T>
- All Known Subinterfaces:
BlockingIterable<T>,BlockingIterable.Processor<T>
- All Known Implementing Classes:
AbstractCloseableIterable,TestIterableToBlockingIterable
public interface CloseableIterable<T> extends java.lang.Iterable<T>AnIterablewhich supports generation ofCloseableIterators.This interface is meant to be used in places where an
Iteratorreturned by anIterablecontains state that is required to be cleared irrespective of whether data from theIteratoris completely consumed (i.e.Iterator.hasNext()is called till it returnsfalse) or not. This interface provides a way for a user of such anIterableto discard data, by callingAutoCloseable.close(). When usingCloseableIterator, it is expected that the user will either consume all the data from theIteratoror explicitly callAutoCloseable.close()to dispose the remaining data.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CloseableIterator<T>iterator()
-
-
-
Method Detail
-
iterator
CloseableIterator<T> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<T>
-
-