javatools.datatypes
Class FilteredIterator<T>

java.lang.Object
  extended by javatools.datatypes.PeekIterator<T>
      extended by javatools.datatypes.FilteredIterator<T>
All Implemented Interfaces:
java.io.Closeable, java.lang.Iterable<T>, java.util.Iterator<T>
Direct Known Subclasses:
FilteredIterator.IgnoreErrors

public class FilteredIterator<T>
extends PeekIterator<T>

This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools). It is licensed under the Creative Commons Attribution License (see http://creativecommons.org/licenses/by/3.0) by the YAGO-NAGA team (see http://mpii.de/yago-naga). The class wraps an iterator and returns only those elements that fulfill a condition


Nested Class Summary
static interface FilteredIterator.If<T>
           
static class FilteredIterator.IgnoreErrors<T>
          Wraps an iterator and skips elements that produce an exception
 
Nested classes/interfaces inherited from class javatools.datatypes.PeekIterator
PeekIterator.ElementaryPeekIterator<T>, PeekIterator.SimplePeekIterator<T>
 
Field Summary
 
Fields inherited from class javatools.datatypes.PeekIterator
closed, initialized, next
 
Constructor Summary
FilteredIterator(java.util.Iterator<T> i, FilteredIterator.If<T> condition)
           
 
Method Summary
 T internalNext()
          Returns the next or NULL if no next element is available
 void remove()
          Removes the current element, if supported by the underlying iterator
 
Methods inherited from class javatools.datatypes.PeekIterator
asList, asList, asSet, asSet, asSet, close, emptyIterator, hasNext, iterator, list, list, main, next, nextOrNull, numElements, numElements, peek, toString, toString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilteredIterator

public FilteredIterator(java.util.Iterator<T> i,
                        FilteredIterator.If<T> condition)
Method Detail

internalNext

public T internalNext()
Description copied from class: PeekIterator
Returns the next or NULL if no next element is available


remove

public void remove()
Description copied from class: PeekIterator
Removes the current element, if supported by the underlying iterator

Specified by:
remove in interface java.util.Iterator<T>
Overrides:
remove in class PeekIterator<T>