Class FilterIterator<ELEMENTTYPE>
java.lang.Object
com.helger.commons.collection.iterate.FilterIterator<ELEMENTTYPE>
- Type Parameters:
ELEMENTTYPE- The type to iterate
- All Implemented Interfaces:
ICommonsIterable<ELEMENTTYPE>,IIterableIterator<ELEMENTTYPE>,Iterable<ELEMENTTYPE>,Iterator<ELEMENTTYPE>
A simple filter iterator that takes a base iterator and an additional filter
and returns only the items that match the filter.
- Author:
- Philip Helger
-
Constructor Summary
ConstructorsConstructorDescriptionFilterIterator(IIterableIterator<? extends ELEMENTTYPE> aBaseIter, Predicate<? super ELEMENTTYPE> aFilter) Constructor.FilterIterator(Iterable<? extends ELEMENTTYPE> aBaseCont, Predicate<? super ELEMENTTYPE> aFilter) Constructor.FilterIterator(Iterator<? extends ELEMENTTYPE> aBaseIter, Predicate<? super ELEMENTTYPE> aFilter) Constructor. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.commons.collection.impl.ICommonsIterable
containsAny, containsNone, containsOnly, findAll, findAllInstanceOf, findAllMapped, findAllMapped, findAllMapped, findFirst, findFirst, findFirstIndex, findFirstMapped, findFirstMapped, findLastIndex, forEachBreakable, forEachByIndex, forEachThrowing, getCount, getCountMethods inherited from interface com.helger.commons.collection.iterate.IIterableIterator
iterator, withFilter, withMapperMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
FilterIterator
public FilterIterator(@Nonnull IIterableIterator<? extends ELEMENTTYPE> aBaseIter, @Nonnull Predicate<? super ELEMENTTYPE> aFilter) Constructor.- Parameters:
aBaseIter- The base iterable iterator to use. May not benull.aFilter- The filter to be applied. May not benull.
-
FilterIterator
public FilterIterator(@Nonnull Iterator<? extends ELEMENTTYPE> aBaseIter, @Nonnull Predicate<? super ELEMENTTYPE> aFilter) Constructor.- Parameters:
aBaseIter- The base iterator to use. May not benull.aFilter- The filter to be applied. May not benull.
-
FilterIterator
public FilterIterator(@Nonnull Iterable<? extends ELEMENTTYPE> aBaseCont, @Nonnull Predicate<? super ELEMENTTYPE> aFilter) Constructor.- Parameters:
aBaseCont- The collection to iterate. May not benull.aFilter- The filter to be applied. May not benull.
-
-
Method Details
-
getFilter
- Returns:
- The filter as specified in the constructor.
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<ELEMENTTYPE>
-
next
- Specified by:
nextin interfaceIterator<ELEMENTTYPE>
-
remove
public void remove()- Specified by:
removein interfaceIterator<ELEMENTTYPE>
-
toString
-