com.hp.hpl.jena.util.iterator
Class NiceIterator

java.lang.Object
  extended by com.hp.hpl.jena.util.iterator.NiceIterator
All Implemented Interfaces:
ClosableIterator, ExtendedIterator, java.util.Iterator
Direct Known Subclasses:
MapFilterIterator, NullIterator, SingletonIterator, WrappedIterator

public class NiceIterator
extends java.lang.Object
implements ExtendedIterator

NiceIterator is the standard base class implementing ExtendedIterator. It provides the static methods for andThen, filterKeep and filterDrop; these can be reused from any other class. It defines equivalent instance methods for descendants and to satisfy ExtendedIterator.

Author:
kers

Constructor Summary
NiceIterator()
           
 
Method Summary
 ExtendedIterator andThen(ClosableIterator other)
          make a new iterator, which is us then the other chap.
static ExtendedIterator andThen(java.util.Iterator a, java.util.Iterator b)
          concatenate two closable iterators.
 void close()
          default close: don't need to do anything.
static void close(java.util.Iterator it)
          If it is a Closableiterator, close it.
static ExtendedIterator emptyIterator()
          An iterator over no elements.
 ExtendedIterator filterDrop(Filter f)
          make a new iterator, which is our elements that do not pass the filter
 ExtendedIterator filterKeep(Filter f)
          make a new iterator, which is our elements that pass the filter
 boolean hasNext()
          default hasNext: no elements, return false.
 ExtendedIterator mapWith(Map1 map1)
          make a new iterator which is the elementwise _map1_ of the base iterator.
 java.lang.Object next()
          default next: throw an exception.
 void remove()
          default remove: we have no elements, so we can't remove any.
 java.lang.Object removeNext()
          Answer the next object, and remove it.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NiceIterator

public NiceIterator()
Method Detail

close

public void close()
default close: don't need to do anything.

Specified by:
close in interface ClosableIterator

hasNext

public boolean hasNext()
default hasNext: no elements, return false.

Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
default next: throw an exception.

Specified by:
next in interface java.util.Iterator

remove

public void remove()
default remove: we have no elements, so we can't remove any.

Specified by:
remove in interface java.util.Iterator

removeNext

public java.lang.Object removeNext()
Answer the next object, and remove it.

Specified by:
removeNext in interface ExtendedIterator

andThen

public static ExtendedIterator andThen(java.util.Iterator a,
                                       java.util.Iterator b)
concatenate two closable iterators.


andThen

public ExtendedIterator andThen(ClosableIterator other)
make a new iterator, which is us then the other chap.

Specified by:
andThen in interface ExtendedIterator

filterKeep

public ExtendedIterator filterKeep(Filter f)
make a new iterator, which is our elements that pass the filter

Specified by:
filterKeep in interface ExtendedIterator

filterDrop

public ExtendedIterator filterDrop(Filter f)
make a new iterator, which is our elements that do not pass the filter

Specified by:
filterDrop in interface ExtendedIterator

mapWith

public ExtendedIterator mapWith(Map1 map1)
make a new iterator which is the elementwise _map1_ of the base iterator.

Specified by:
mapWith in interface ExtendedIterator

close

public static void close(java.util.Iterator it)
If it is a Closableiterator, close it. Abstracts away from tests [that were] scattered through the code.


emptyIterator

public static ExtendedIterator emptyIterator()
An iterator over no elements.

Returns:
A class singleton which doesn't iterate.


Copyright © 2000, 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP