Applied patch submitted by Michael Smith that clarifies the description of the FilterIterator

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130510 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2002-02-01 16:27:40 +00:00
parent 6a5c4a72c6
commit 4b266ff8bc
1 changed files with 7 additions and 0 deletions

View File

@ -12,6 +12,10 @@ import java.util.NoSuchElementException;
/** A Proxy {@link Iterator Iterator} which takes a {@link Predicate Predicate} instance to filter
* out objects from an underlying {@link Iterator Iterator} instance.
* out objects from an underlying {@link Iterator Iterator} instance.
* Only objects for which the
* specified <code>Predicate</code> evaluates to <code>true</code> are
* returned.
*
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
* @author Jan Sorensen
@ -41,6 +45,8 @@ public class FilterIterator extends ProxyIterator {
// Iterator interface
//-------------------------------------------------------------------------
/** @return true if there is another object that matches the given predicate */
public boolean hasNext() {
if ( nextObjectSet ) {
return true;
@ -49,6 +55,7 @@ public class FilterIterator extends ProxyIterator {
}
}
/** @return the next object which matches the given predicate */
public Object next() {
if ( !nextObjectSet ) {
if (!setNextObject()) {