Class PaddingIterator<E>

java.lang.Object
org.seasar.doma.internal.util.PaddingIterator<E>
Type Parameters:
E - the type of elements returned by this iterator
All Implemented Interfaces:
Iterator<E>

public class PaddingIterator<E> extends Object implements Iterator<E>
An iterator that extends an existing Iterator with padding behavior.

The PaddingIterator guarantees that additional elements will be yielded even after the original iterator has been exhausted. These additional elements will repeat the last element produced by the original iterator until the specified padding size is reached.

  • Constructor Details

    • PaddingIterator

      public PaddingIterator(Iterator<E> iterator, int paddingSize)
      Constructs a PaddingIterator that decorates the specified Iterator with additional padding behavior.
      Parameters:
      iterator - the original iterator to be decorated; must not be null
      paddingSize - the number of additional elements to produce after the original iterator is exhausted; must be >= 0
      Throws:
      NullPointerException - if iterator is null
      IllegalArgumentException - if paddingSize is less than 0
  • Method Details

    • hasNext

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

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