org.apache.tinkerpop.gremlin.structure.util

## Interface CloseableIterator<T>

- All Superinterfaces:
    AutoCloseable, Closeable, Iterator<T>
  All Known Implementing Classes:
    DefaultCloseableIterator

      public interface CloseableIterator<T>
      extends Iterator<T>, Closeable

  An extension of `Iterator` that implements `Closeable` which allows a `Graph` implementation that hold open resources to provide the user the option to release those resources.
  Author:
    Stephen Mallette (http://stephen.genoprime.com)

- - ### Method Summary

    All Methods Static Methods Instance Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> CloseableIterator<T>` | `asCloseable(Iterator<T> iterator)` Wraps an existing `Iterator` in a `CloseableIterator`.
    `default void` | `close()`
    `static <T> void` | `closeIterator(Iterator<T> iterator)`

    - ### Methods inherited from interface java.util.Iterator

      `forEachRemaining, hasNext, next, remove`

- - ### Method Detail

    - #### asCloseable

          static <T> CloseableIterator<T> asCloseable(Iterator<T> iterator)

      Wraps an existing `Iterator` in a `CloseableIterator`. If the `Iterator` is already of that type then it will simply be returned as-is.

    - #### close

          default void close()

      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `Closeable`

    - #### closeIterator

          static <T> void closeIterator(Iterator<T> iterator)

Copyright © 2013–2018 Apache Software Foundation. All rights reserved.