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>
AnIterable
which supports generation ofCloseableIterator
s.This interface is meant to be used in places where an
Iterator
returned by anIterable
contains state that is required to be cleared irrespective of whether data from theIterator
is completely consumed (i.e.Iterator.hasNext()
is called till it returnsfalse
) or not. This interface provides a way for a user of such anIterable
to discard data, by callingAutoCloseable.close()
. When usingCloseableIterator
, it is expected that the user will either consume all the data from theIterator
or 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:
iterator
in interfacejava.lang.Iterable<T>
-
-