Class BoundedIterator<T>

java.lang.Object
org.refcodes.struct.BoundedIterator<T>
All Implemented Interfaces:
Iterator<T>

public class BoundedIterator<T> extends Object implements Iterator<T>
The BoundedIterator decorates an Iterator to limit its element to a maximum number.
  • Constructor Details

    • BoundedIterator

      public BoundedIterator(Iterator<T> aIterator, int aLengthBounds)
      Decorates the given Iterator with the given length bounds.
      Parameters:
      aIterator - The Iterator to which to apply the given length bounds.
      aLengthBounds - The length bounds to be applied to the given iterator;
  • Method Details

    • hasNext

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

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