Class ResultIterator<T>

  • Type Parameters:
    T - element type of the query results
    All Implemented Interfaces:
    Iterator<T>

    public final class ResultIterator<T>
    extends Object
    implements Iterator<T>
    Implements a query result iterator which only returns a maximum number of element from an underlying iterator starting at a given offset.
    • Method Detail

      • create

        public static <T> Iterator<T> create​(long offset,
                                             long max,
                                             Iterator<T> iterator)
        Returns an iterator respecting the specified offset and max.
        Type Parameters:
        T - element type
        Parameters:
        offset - offset to start iteration at. Must be non negative
        max - maximum elements this iterator should return. Set to MAX_ALL for all
        iterator - the underlying iterator
        Returns:
        an iterator which only returns the elements in the given bounds
      • hasNext

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

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

        public void remove()
        Specified by:
        remove in interface Iterator<T>