Class CriterionIterator<T>

java.lang.Object
com.saperion.common.lang.iterator.CriterionIterator<T>
Type Parameters:
T - type of objects to iterate
All Implemented Interfaces:
Iterator<T>

public final class CriterionIterator<T> extends Object implements Iterator<T>

An Iterator that filters the objects of an existing iterator using a Criterion.

Iterator.remove() is not supported.

Author:
agz
  • Constructor Details

    • CriterionIterator

      public CriterionIterator(Iterator<? extends T> iterator, Criterion<? super T> criterion)
      Creates a new CriterionIterator, that filters the objects of the specified iterator using the specified Criterion.

      The specified iterator must not be null.

      The specified criterion may be null, in which case no filtering is done and the returned iterator iterates through all objects of the specified iterator.

      Parameters:
      iterator - underlying iterator whose iteration should be filtered
      criterion - filter-Criterion
  • Method Details