org.apache.jackrabbit.commons.flat
Class FilterIterator<T>

java.lang.Object
  extended by org.apache.jackrabbit.commons.flat.FilterIterator<T>
Type Parameters:
T -
All Implemented Interfaces:
Iterator<T>

public class FilterIterator<T>
extends Object
implements Iterator<T>

Iterator filtering out items which do not match a given predicate.


Constructor Summary
FilterIterator(Iterator<T> iterator, Predicate predicate)
          Create a new filtered iterator based on the given iterator.
 
Method Summary
 boolean hasNext()
           
 T next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterIterator

public FilterIterator(Iterator<T> iterator,
                      Predicate predicate)
Create a new filtered iterator based on the given iterator.

Parameters:
iterator - iterator to filter
predicate - only item matching this predicate are included
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<T>

next

public T next()
Specified by:
next in interface Iterator<T>

remove

public void remove()
Specified by:
remove in interface Iterator<T>
Throws:
UnsupportedOperationException - always
See Also:
Iterator.remove()


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.