Interface DatabaseIterator<T>

  • Type Parameters:
    T - the type for iterator
    All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable, java.util.Iterator<T>

    public interface DatabaseIterator<T>
    extends java.util.Iterator<T>, java.io.Closeable
    An iterator over records in a database that must be closed after use
    • Method Summary

      All Methods Static Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      static <T> DatabaseIterator<T> empty()
      Returns an empty database iterator
      default java.util.List<T> toList()
      Extracts all values from this iterator into a list
      default java.util.Set<T> toSet()
      Extracts all values from this iterator into a set
      • Methods inherited from interface java.io.Closeable

        close
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, hasNext, next, remove
    • Method Detail

      • toList

        default java.util.List<T> toList()
        Extracts all values from this iterator into a list
        Returns:
        the list of all values extracted from iterator
      • toSet

        default java.util.Set<T> toSet()
        Extracts all values from this iterator into a set
        Returns:
        the set of values extracted from set
      • empty

        static <T> DatabaseIterator<T> empty()
        Returns an empty database iterator
        Type Parameters:
        T - the iterator type
        Returns:
        the iterator