org.springmodules.validation.util.collection
Class FilteredIterator

java.lang.Object
  extended by org.springmodules.validation.util.collection.ReadOnlyIterator
      extended by org.springmodules.validation.util.collection.FilteredIterator
All Implemented Interfaces:
java.util.Iterator
Direct Known Subclasses:
SubElementsIterator

public class FilteredIterator
extends ReadOnlyIterator

An wrapper iterator that filters out items from the underlying iterator based on a condition.

Author:
Uri Boness

Constructor Summary
FilteredIterator(java.util.Iterator iterator, Condition condition)
          Constructs a new FilteredIterator with given iterator to wrap and a condition.
 
Method Summary
protected  void advanceIterator()
           
 boolean hasNext()
           
protected  void initializeIfNeeded()
           
 java.lang.Object next()
           
 
Methods inherited from class org.springmodules.validation.util.collection.ReadOnlyIterator
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,
                        Condition condition)
Constructs a new FilteredIterator with given iterator to wrap and a condition. The constructed iterator will return only the element that adhere to the given condition.

Parameters:
iterator - The iterator to wrap.
condition - The condition that determines what elements should be returned by this iterator.
Method Detail

hasNext

public boolean hasNext()

next

public java.lang.Object next()

initializeIfNeeded

protected void initializeIfNeeded()

advanceIterator

protected void advanceIterator()


Copyright © 2005. All Rights Reserved.