org.chromattic.common
Class FilterIterator<E,I>

java.lang.Object
  extended by org.chromattic.common.AbstractFilterIterator<E,I>
      extended by org.chromattic.common.FilterIterator<E,I>
All Implemented Interfaces:
Iterator<E>

public class FilterIterator<E,I>
extends AbstractFilterIterator<E,I>

A convenient subclass for delegating the filtering function.

Version:
$Revision$
Author:
Julien Viet

Constructor Summary
FilterIterator(Iterator<I> iterator, IteratorFilter<E,I> filter)
          Creates a new filter iterator.
 
Method Summary
protected  E adapt(I internal)
          Adapts the internal element as an external element.
 
Methods inherited from class org.chromattic.common.AbstractFilterIterator
hasNext, next, 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<I> iterator,
                      IteratorFilter<E,I> filter)
               throws NullPointerException
Creates a new filter iterator.

Parameters:
iterator - the iterator
filter - the filter
Throws:
NullPointerException - if any argument is null
Method Detail

adapt

protected E adapt(I internal)
Description copied from class: AbstractFilterIterator
Adapts the internal element as an external element. Returning a null external element means that the element must be skipped and not considered by the iterator.

Specified by:
adapt in class AbstractFilterIterator<E,I>
Parameters:
internal - the internal element
Returns:
the external element


Copyright © 2010 eXo Platform SAS. All Rights Reserved.