Class PagingIterator<E>

  • All Implemented Interfaces:

    public class PagingIterator<E>
    extends java.lang.Object
    implements java.util.Iterator<E>
    A wrapper iterator to supports paging.

    If you have access to Collection 4.1, it is recommended to use IteratorUtils#boundedIterator(Iterator, long, long) instead.

    • Constructor Summary

      Constructor Description
      PagingIterator​(java.util.Iterator<E> it, java.lang.Integer offset, java.lang.Integer limit)
      Instantiates a new paging wrapper of the given iterator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()  
      E next()  
      void remove()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

    • Constructor Detail

      • PagingIterator

        public PagingIterator​(@Nonnull
                              java.util.Iterator<E> it,
                              java.lang.Integer offset,
                              java.lang.Integer limit)
                       throws java.lang.IllegalArgumentException
        Instantiates a new paging wrapper of the given iterator.

        The iterator is iterated immediately as per offset.

        it - The iterator to wrap
        offset - The offset of the paging; null to do paging without offset.
        limit - The limit of the paging; null to do paging without limit.
        java.lang.IllegalArgumentException - When either offset or limit is negative
    • Method Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<E>
      • next

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

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