Class ForwardingCloseableIterator<T>

java.lang.Object
org.springframework.data.keyvalue.core.ForwardingCloseableIterator<T>
All Implemented Interfaces:
Closeable, AutoCloseable, Iterator<T>, org.springframework.data.util.CloseableIterator<T>

public class ForwardingCloseableIterator<T> extends Object implements org.springframework.data.util.CloseableIterator<T>
Forwards CloseableIterator invocations to the configured Iterator delegate.
Author:
Christoph Strobl, Thomas Darimont, Oliver Gierke, Mark Paluch
  • Constructor Details

    • ForwardingCloseableIterator

      public ForwardingCloseableIterator(Iterator<? extends T> delegate)
      Parameters:
      delegate - must not be null.
    • ForwardingCloseableIterator

      public ForwardingCloseableIterator(Iterator<? extends T> delegate, @Nullable Runnable closeHandler)
      Creates a new ForwardingCloseableIterator that invokes the configured closeHandler on close().
      Parameters:
      delegate - must not be null.
      closeHandler - may be null.
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<T>
    • next

      public T next()
      Specified by:
      next in interface Iterator<T>
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.springframework.data.util.CloseableIterator<T>