java.lang.Object
org.bzdev.util.FilteringIterator<T>
- All Implemented Interfaces:
Iterator<T>
Iterator that filters out elements.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToFilter(Collection<T> elements) Add elements to filter.voidaddToFilter(T element) Add an element to filter.booleanhasNext()next()voidremove()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
FilteringIterator
Constructor.- Parameters:
it- the iterator to filter
-
-
Method Details
-
addToFilter
Add an element to filter. The iterator will return a sequence of elements. Those elements that match ones added to the filter will be ignored. An element o matches an element e in the filter if either o and e are both null or if o.equals(e) returns true.- Parameters:
element- the element to filter
-
addToFilter
Add elements to filter. The iterator will return a sequence of elements. Those elements that match ones added to the filter will be ignored. An element o matches an element e in the filter if either o and e are both null or if o.equals(e) returns true.- Parameters:
elements- the elements to filter
-
hasNext
public boolean hasNext() -
next
- Specified by:
nextin interfaceIterator<T>- Throws:
NoSuchElementException
-
remove
- Specified by:
removein interfaceIterator<T>- Throws:
UnsupportedOperationExceptionIllegalStateException
-