org.entityfs.util.itr
Class FilteringIterator<T>
java.lang.Object
org.entityfs.util.itr.FilteringIterator<T>
- All Implemented Interfaces:
- Iterator<T>
public class FilteringIterator<T>
- extends Object
- implements Iterator<T>
An iterator that filters the results from another iterator. It can be used to
filter returned entities from other iterators.
For instance, if you want all XML files in a directory hierarchy, create a
recursive iterator on the root directory of the hierarchy, and filter the
returned entities through an EFileNameExtensionFilter
.
EntityFS iterators are not thread safe. Don't use them concurrently from
several threads without synchronizing access to them.
- Since:
- 1.0
- Author:
- Karl Gustafsson
Constructor Summary |
FilteringIterator(Iterator<? extends T> itr,
Filter<? super T> filter)
Create a filtering iterator that filters elements from the iterator
through the filter. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FilteringIterator
public FilteringIterator(Iterator<? extends T> itr,
Filter<? super T> filter)
- Create a filtering iterator that filters elements from the iterator
through the filter.
- Parameters:
itr
- The iterator.filter
- The filter.
next
public T next()
- Specified by:
next
in interface Iterator<T>
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface Iterator<T>
remove
public void remove()
- Specified by:
remove
in interface Iterator<T>
- Throws:
UnsupportedOperationException
- Always.