scolebourne    2003/01/30 15:10:29

  Modified:    collections/src/java/org/apache/commons/collections/iterators
                        FilterIterator.java
  Log:
  Enable remove()
  from Ralph Wagner
  
  Revision  Changes    Path
  1.3       +16 -7     
jakarta-commons/collections/src/java/org/apache/commons/collections/iterators/FilterIterator.java
  
  Index: FilterIterator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/iterators/FilterIterator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FilterIterator.java       15 Jan 2003 21:45:23 -0000      1.2
  +++ FilterIterator.java       30 Jan 2003 23:10:29 -0000      1.3
  @@ -73,6 +73,7 @@
    * 
    * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
    * @author Jan Sorensen
  + * @author Ralph Wagner
    */
   public class FilterIterator extends ProxyIterator {
       
  @@ -150,13 +151,21 @@
       }
   
       /**
  -     * Always throws UnsupportedOperationException as this class 
  -     * does look-ahead with its internal iterator.
  -     *
  -     * @throws UnsupportedOperationException  always
  +     * Removes from the underlying collection of the base iterator the last
  +     * element returned by this iterator.
  +     * This method can only be called
  +     * if <code>next()</code> was called, but not after
  +     * <code>hasNext()</code>, because the <code>hasNext()</code> call
  +     * changes the base iterator.
  +     * 
  +     * @throws IllegalStateException if <code>hasNext()</code> has already
  +     *  been called.
        */
       public void remove() {
  -        throw new UnsupportedOperationException();
  +        if (nextObjectSet) {
  +            throw new IllegalStateException("remove() cannot be called");
  +        }
  +        getIterator().remove();
       }
           
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to