Class ResultSetIterator<T>

java.lang.Object
com.valqueries.ResultSetIterator<T>
All Implemented Interfaces:
AutoCloseable, Iterator<T>

public class ResultSetIterator<T> extends Object implements Iterator<T>, AutoCloseable
Used to create a Stream out of ResultSet and close it after the Stream is consumed.
  • Constructor Details

  • 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()
      Closes the resultSet, preparedStatement, and possibly the connection, if it was provided in the constructor. The objects are closed in this order. If any exception is encountered it thrown after all objects were closed. Any subsequent exceptions are added as suppressed exceptions to the first one.
      Specified by:
      close in interface AutoCloseable