org.chromattic.common
Class AbstractFilterIterator<E,I>
java.lang.Object
org.chromattic.common.AbstractFilterIterator<E,I>
- All Implemented Interfaces:
- Iterator<E>
- Direct Known Subclasses:
- FilterIterator
public abstract class AbstractFilterIterator<E,I>
- extends Object
- implements Iterator<E>
An iterator that filter the elements of a delegate iterator allowing to skip some elements and
to perform type conversion.
- Version:
- $Revision$
- Author:
- Julien Viet
|
Method Summary |
protected abstract E |
adapt(I internal)
Adapts the internal element as an external element. |
boolean |
hasNext()
|
E |
next()
|
void |
remove()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractFilterIterator
public AbstractFilterIterator(Iterator<I> iterator)
throws NullPointerException
- Create a new filter iterator.
- Parameters:
iterator - the iterator
- Throws:
NullPointerException - if the iterator is null
hasNext
public final boolean hasNext()
- Specified by:
hasNext in interface Iterator<E>
next
public final E next()
- Specified by:
next in interface Iterator<E>
remove
public void remove()
- Specified by:
remove in interface Iterator<E>
adapt
protected abstract E adapt(I internal)
- 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.
- Parameters:
internal - the internal element
- Returns:
- the external element
Copyright © 2009 eXo Platform SAS. All Rights Reserved.