com.hp.hpl.jena.util.iterator
Interface ExtendedIterator<T>

All Superinterfaces:
ClosableIterator<T>, java.util.Iterator<T>
All Known Subinterfaces:
NodeIterator, NsIterator, ResIterator, RSIterator, StmtIterator, TripleIterator
All Known Implementing Classes:
EarlyBindingIterator, FilterDropIterator, FilterIterator, FilterKeepIterator, LazyIterator, Map1Iterator, MapFilterIterator, NiceIterator, NullIterator, RandomOrderIterator, SingletonIterator, TripleMatchIterator, UniqueExtendedIterator, WrappedIterator

public interface ExtendedIterator<T>
extends ClosableIterator<T>

an ExtendedIterator is a ClosableIterator on which other operations are defined for convenience in iterator composition: composition, filtering in, filtering out, and element mapping.
NOTE that the result of each of these operations consumes the base iterator(s); they do not make independant copies.
The canonical implementation of ExtendedIterator is NiceIterator, which also defines static methods for these operations that will work on any ClosableIterators.

Author:
kers

Method Summary
<X extends T>
ExtendedIterator<T>
andThen(java.util.Iterator<X> other)
          return a new iterator which delivers all the elements of this iterator and then all the elements of the other iterator.
 ExtendedIterator<T> filterDrop(Filter<T> f)
          return a new iterator containing only the elements of _this_ which are rejected by the filter _f_.
 ExtendedIterator<T> filterKeep(Filter<T> f)
          return a new iterator containing only the elements of _this_ which pass the filter _f_.
<U> ExtendedIterator<U>
mapWith(Map1<T,U> map1)
          return a new iterator where each element is the result of applying _map1_ to the corresponding element of _this_.
 T removeNext()
          Answer the next object, and remove it.
 java.util.List<T> toList()
          Answer a list of the [remaining] elements of this iterator, in order, consuming this iterator.
 java.util.Set<T> toSet()
          Answer a set of the [remaining] elements of this iterator, in order, consuming this iterator.
 
Methods inherited from interface com.hp.hpl.jena.util.iterator.ClosableIterator
close
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Method Detail

removeNext

T removeNext()
Answer the next object, and remove it. Equivalent to next(); remove().


andThen

<X extends T> ExtendedIterator<T> andThen(java.util.Iterator<X> other)
return a new iterator which delivers all the elements of this iterator and then all the elements of the other iterator. Does not copy either iterator; they are consumed as the result iterator is consumed.


filterKeep

ExtendedIterator<T> filterKeep(Filter<T> f)
return a new iterator containing only the elements of _this_ which pass the filter _f_. The order of the elements is preserved. Does not copy _this_, which is consumed as the result is consumed.


filterDrop

ExtendedIterator<T> filterDrop(Filter<T> f)
return a new iterator containing only the elements of _this_ which are rejected by the filter _f_. The order of the elements is preserved. Does not copy _this_, which is consumed as the result is consumed.


mapWith

<U> ExtendedIterator<U> mapWith(Map1<T,U> map1)
return a new iterator where each element is the result of applying _map1_ to the corresponding element of _this_. _this_ is not copied; it is consumed as the result is consumed.


toList

java.util.List<T> toList()
Answer a list of the [remaining] elements of this iterator, in order, consuming this iterator.


toSet

java.util.Set<T> toSet()
Answer a set of the [remaining] elements of this iterator, in order, consuming this iterator.



Copyright ? 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP