Package io.servicetalk.concurrent
Interface CloseableIterable<T>
- Type Parameters:
T
- the type of elements returned by theCloseableIterator
.
- All Superinterfaces:
Iterable<T>
- All Known Subinterfaces:
BlockingIterable<T>
,BlockingIterable.Processor<T>
,HttpMessageBodyIterable<T>
- All Known Implementing Classes:
AbstractCloseableIterable
An
Iterable
which supports generation of CloseableIterator
s.
This interface is meant to be used in places where an Iterator
returned by an Iterable
contains
state that is required to be cleared irrespective of whether data from the Iterator
is completely
consumed (i.e. Iterator.hasNext()
is called till it returns false
) or not.
This interface provides a way for a user of such an Iterable
to discard data, by calling
AutoCloseable.close()
.
When using CloseableIterator
, it is expected that the user will either consume all the data from the
Iterator
or explicitly call AutoCloseable.close()
to dispose the remaining data.
-
Method Summary
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
iterator
CloseableIterator<T> iterator()
-