java.lang.Object
org.jdaemon.util.iterator.FilterIterator
- All Implemented Interfaces:
- java.util.Iterator
- Direct Known Subclasses:
- ExcludeIterator
- public abstract class FilterIterator
- extends java.lang.Object
- implements java.util.Iterator
Iterator that returns subset of values from some other enumeration
that match some predicate function (the 'filter')
- Version:
|
Method Summary |
abstract boolean |
filter(java.lang.Object obj)
This method should return true for any element we wish to include in the subset |
boolean |
hasNext()
True if more elements exist in filtered subset |
private void |
moveNext()
|
java.lang.Object |
next()
Get next element in filtered subset |
void |
remove()
Remove from the underlying collection the last element returned by next
(optional operation). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
enum
private java.util.Iterator enum
- Superset enumeration
next
private java.lang.Object next
- Lookahead object
FilterIterator
public FilterIterator(java.util.Iterator superset)
- Creates new FilterIterator
moveNext
private void moveNext()
hasNext
public boolean hasNext()
- True if more elements exist in filtered subset
- Specified by:
hasNext in interface java.util.Iterator
next
public java.lang.Object next()
- Get next element in filtered subset
- Specified by:
next in interface java.util.Iterator
remove
public void remove()
- Description copied from interface:
java.util.Iterator
- Remove from the underlying collection the last element returned by next
(optional operation). This method can be called only once after each
call to
next(). It does not affect what will be returned
by subsequent calls to next.
- Specified by:
remove in interface java.util.Iterator
filter
public abstract boolean filter(java.lang.Object obj)
- This method should return true for any element we wish to include in the subset