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 TypeMethodDescriptionvoid
addToFilter
(Collection<T> elements) Add elements to filter.void
addToFilter
(T element) Add an element to filter.boolean
hasNext()
next()
void
remove()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
next
in interfaceIterator<T>
- Throws:
NoSuchElementException
-
remove
- Specified by:
remove
in interfaceIterator<T>
- Throws:
UnsupportedOperationException
IllegalStateException
-