Class ResultIterator<T>

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

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

      Fields 
      Modifier and Type Field Description
      static int MAX_ALL  
      static int OFFSET_NONE  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.Iterator<T> create​(long offset, long max, java.util.Iterator<T> iterator)
      Returns an iterator respecting the specified offset and max.
      boolean hasNext()  
      T next()  
      void remove()  
      • 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
    • Method Detail

      • create

        public static <T> java.util.Iterator<T> create​(long offset,
                                                       long max,
                                                       java.util.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 java.util.Iterator<T>
      • next

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

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