Class CloseableIterator<T>

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.util.Iterator<T>

    public class CloseableIterator<T>
    extends java.lang.Object
    implements java.util.Iterator<T>, java.io.Closeable
    • Constructor Summary

      Constructors 
      Constructor Description
      CloseableIterator​(java.util.Iterator<T> iterable, java.io.Closeable closeable)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      boolean hasNext()  
      T next()  
      void remove()  
      static <T> CloseableIterator<T> wrap​(java.util.Iterator<T> iterator)  
      static <T> CloseableIterator<T> wrap​(java.util.Iterator<T> iterator, java.io.Closeable closeable)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
    • Constructor Detail

      • CloseableIterator

        public CloseableIterator​(java.util.Iterator<T> iterable,
                                 java.io.Closeable closeable)
    • Method Detail

      • wrap

        public static <T> CloseableIterator<T> wrap​(java.util.Iterator<T> iterator,
                                                    java.io.Closeable closeable)
      • wrap

        public static <T> CloseableIterator<T> wrap​(java.util.Iterator<T> iterator)
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<T>
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<T>
      • next

        public T next()
        Specified by:
        next in interface java.util.Iterator<T>