common-util

local.tomas.util.collections
Class FilteredIterator<T>

java.lang.Object
  extended by local.tomas.util.collections.FilteredIterator<T>
Type Parameters:
T - type iterated over
All Implemented Interfaces:
Iterator<T>

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

Filtered iterator. A filtered iterator iterates only over those elements of the base iterator passing the filter.

Author:
tomas.teubner

Constructor Summary
FilteredIterator(Iterator<T> iterator, ObjectFilter filter)
          Construct filtered 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

FilteredIterator

public FilteredIterator(Iterator<T> iterator,
                        ObjectFilter filter)
Construct filtered iterator.

Parameters:
iterator - the base iterator
filter - the filter
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 - when invoked

common-util

Copyright © 2005-2007 Tomas Teubner. All Rights Reserved.