de.cau.cs.kieler.core.util
Class FilteredIterator<E>

java.lang.Object
  extended by de.cau.cs.kieler.core.util.FilteredIterator<E>
Type Parameters:
E - the type of elements
All Implemented Interfaces:
Iterator<E>, ListIterator<E>

public class FilteredIterator<E>
extends Object
implements ListIterator<E>

An iterator that filters the elements returned by a wrapped iterator.

Rating red

Nested Class Summary
static class FilteredIterator.Iterable<E>
          An iterable that creates a filtered iterator as iterator.
 
Constructor Summary
FilteredIterator(ListIterator<E> thewrappedIter, ICondition<E> thecondition)
          Creates a filtered iterator for a given list iterator and a condition.
 
Method Summary
 void add(E e)
          
 boolean hasNext()
          
 boolean hasPrevious()
          
 E next()
          
 int nextIndex()
          
 E previous()
          
 int previousIndex()
          
 void remove()
          Removes from the underlying collection the last element returned by the iterator (optional operation).
 void set(E e)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilteredIterator

public FilteredIterator(ListIterator<E> thewrappedIter,
                        ICondition<E> thecondition)
Creates a filtered iterator for a given list iterator and a condition.

Parameters:
thewrappedIter - the wrapped list iterator
thecondition - the condition to evaluate on each element
Method Detail

hasNext

public boolean hasNext()

Specified by:
hasNext in interface Iterator<E>
Returns:
Returns true if the iteration has more elements.

hasPrevious

public boolean hasPrevious()

Specified by:
hasPrevious in interface ListIterator<E>

next

public E next()

Specified by:
next in interface Iterator<E>
Returns:
Returns the next element in the interation.

nextIndex

public int nextIndex()

Specified by:
nextIndex in interface ListIterator<E>

previous

public E previous()

Specified by:
previous in interface ListIterator<E>

previousIndex

public int previousIndex()

Specified by:
previousIndex in interface ListIterator<E>

add

public void add(E e)

Specified by:
add in interface ListIterator<E>

remove

public void remove()
Removes from the underlying collection the last element returned by the iterator (optional operation).

Specified by:
remove in interface Iterator<E>

set

public void set(E e)

Specified by:
set in interface ListIterator<E>