com.townleyenterprises.filter
Class FilteredIterator

java.lang.Object
  extended bycom.townleyenterprises.filter.FilteredIterator
All Implemented Interfaces:
java.util.Iterator

public class FilteredIterator
extends java.lang.Object
implements java.util.Iterator

This class provides a decorator to a regular Java iterator that can perform filtering.

Since:
2.0
Version:
$Id: FilteredIterator.java,v 1.3 2004/07/28 10:33:58 atownley Exp $
Author:
Andrew S. Townley

Constructor Summary
FilteredIterator(java.util.Iterator iterator, Filter filter)
          The constructor takes a regular iterator and the filter object that should be applied.
 
Method Summary
 boolean hasNext()
           
 java.lang.Object next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilteredIterator

public FilteredIterator(java.util.Iterator iterator,
                        Filter filter)
The constructor takes a regular iterator and the filter object that should be applied.

Parameters:
iterator - a regular Iterator
filter - a Filter
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Specified by:
next in interface java.util.Iterator

remove

public void remove()
            throws java.lang.UnsupportedOperationException,
                   java.lang.IllegalStateException
Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException
java.lang.IllegalStateException


Copyright © 2002-2004, Andrew S. Townley and Townley Enterprises. All Rights Reserved.
This project is hosted on http://te-code.sourceforge.net.