Interface CloseableIterable<T>

Type Parameters:
T - the element type
All Superinterfaces:
AutoCloseable, Iterable<T>

public interface CloseableIterable<T> extends Iterable<T>, AutoCloseable
An Iterable that holds resources which must be released by calling close().

Intended for use with try-with-resources:


 try (CloseableIterable<GetResult> scan = client.rangeScan(start, end)) {
     for (GetResult r : scan) {
         if (done) break;
     }
 }
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Releases any resources held by this iterable, cancelling iteration in progress.

    Methods inherited from interface Iterable

    forEach, iterator, spliterator
  • Method Details

    • close

      void close()
      Releases any resources held by this iterable, cancelling iteration in progress.
      Specified by:
      close in interface AutoCloseable