|
Plexus v0.13.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.phoenixst.collections.FilteredIterator
public class FilteredIterator
A filtered Iterator
. Because this class must advance
the underlying Iterator
to correctly implement hasNext()
, remove()
has unusual semantics. See the
javadocs for that method for details.
Constructor Summary | |
---|---|
FilteredIterator(Iterator delegate,
org.apache.commons.collections.Predicate predicate)
Creates a new FilteredIterator . |
Method Summary | |
---|---|
boolean |
hasNext()
|
Object |
next()
|
void |
remove()
Removes from the last object returned by next . |
protected void |
remove(Object object)
This method is called by remove() if
hasNext() was called after the last calls to both
next() and remove() (if any) and
remove() has not been called after the last call
to next() . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FilteredIterator(Iterator delegate, org.apache.commons.collections.Predicate predicate)
FilteredIterator
.
Method Detail |
---|
public boolean hasNext()
hasNext
in interface Iterator
public Object next()
next
in interface Iterator
public void remove()
next
.
Because the underlying Iterator
must be advanced
to correctly implement hasNext()
, this method has
unusual semantics. These are the possible states that an
instance of this class may be in, and how this method will
behave:
next()
has not yet been called or
remove()
was called after the last call to
next()
, throws an
IllegalStateException
. These are the same
conditions under which any implementation of
Iterator.remove
should throw an exception.
next()
was called after the last calls
to both hasNext()
and remove()
(if any), delegates to the remove()
method
of the underlying Iterator
.
hasNext()
was called after the last
calls to both next()
and
remove()
(if any) and remove()
has not been called after the last call to
next()
, calls remove( Object )
with the element last returned by
next()
. In other words, the underlying
Iterator
has been advanced beyond the
element to be removed.
Description copied from interface: Iterator
remove
in interface Iterator
protected void remove(Object object)
remove()
if
hasNext()
was called after the last calls to both
next()
and remove()
(if any) and
remove()
has not been called after the last call
to next()
. In other words, this method is called
if the call sequence goes something like next(),
hasNext(), remove()
, which means the underlying
Iterator
has been advanced beyond the element to
be removed. This provides an extension point for an
implementation to correctly handle this case if it is capable
of doing so.
This implementation throws an
IllegalStateException
.
|
Plexus v0.13.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |