- Type Parameters:
T
- the type to fetch from the result set
- All Superinterfaces:
AutoCloseable
,Iterable<T>
Iterates through a ResultSet fetching instances of T.
Use try with resources or remember to call
close()
in order to close underlying resources.-
Method Summary
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
hasNext
Returns true if a row is available in the underlying result set.- Returns:
- true if a row is available in the underlying result set
- Throws:
SQLException
- in case of an exception
-
next
- Returns:
- an instance of T fetched from the result set
- Throws:
SQLException
- in case of an exceptionNoSuchElementException
- in case no more rows are available
-
close
void close()Closes the underlying result set and other resources held by this iterator- Specified by:
close
in interfaceAutoCloseable
-
iterator
Wraps thisResultIterator
in aIterator
. Any SQLExceptions that occur are rethrown as RuntimeExceptions.- Specified by:
iterator
in interfaceIterable<T>
- Returns:
- a
Iterator
instance based on thisResultIterator
-