Class PagingIterator<E>

java.lang.Object
com.adobe.granite.ui.components.PagingIterator<E>
All Implemented Interfaces:
Iterator<E>

public class PagingIterator<E> extends Object implements 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 Details

    • PagingIterator

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

      The iterator is iterated immediately as per offset.

      Parameters:
      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.
      Throws:
      IllegalArgumentException - When either offset or limit is negative
  • Method Details

    • hasNext

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

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

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