com.hp.hpl.jena.util.iterator
Class WrappedIterator<T>

java.lang.Object
  extended by com.hp.hpl.jena.util.iterator.NiceIterator<T>
      extended by com.hp.hpl.jena.util.iterator.WrappedIterator<T>
All Implemented Interfaces:
ClosableIterator<T>, ExtendedIterator<T>, java.util.Iterator<T>
Direct Known Subclasses:
EarlyBindingIterator, FilterIterator, RandomOrderIterator, UniqueExtendedIterator

public class WrappedIterator<T>
extends NiceIterator<T>

a WrappedIterator is an ExtendedIterator wrapping around a plain (or presented as plain) Iterator. The wrapping allows the usual extended operations (filtering, concatenating) to be done on an Iterator derived from some other source.

Author:
kers

Method Summary
 void close()
          close: defer to the base, iff it is closable
static void close(java.util.Iterator<?> it)
          if it is a Closableiterator, close it.
static
<T> ExtendedIterator<T>
create(java.util.Iterator<T> it)
          Answer an ExtendedIterator returning the elements of it.
static
<T> WrappedIterator<T>
createNoRemove(java.util.Iterator<T> it)
          Answer an ExtendedIterator wrapped round it which does not permit .remove() even if it does.
 java.util.Iterator<? extends T> forTestingOnly_getBase()
           
 boolean hasNext()
          hasNext: defer to the base iterator
 T next()
          next: defer to the base iterator
 void remove()
          if .remove() is allowed, delegate to the base iterator's .remove; otherwise, throw an UnsupportedOperationException.
 
Methods inherited from class com.hp.hpl.jena.util.iterator.NiceIterator
andThen, andThen, asList, asSet, emptyIterator, filterDrop, filterKeep, mapWith, removeNext, toList, toSet
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static <T> ExtendedIterator<T> create(java.util.Iterator<T> it)
Answer an ExtendedIterator returning the elements of it. If it is itself an ExtendedIterator, return that; otherwise wrap it.


createNoRemove

public static <T> WrappedIterator<T> createNoRemove(java.util.Iterator<T> it)
Answer an ExtendedIterator wrapped round it which does not permit .remove() even if it does.


forTestingOnly_getBase

public java.util.Iterator<? extends T> forTestingOnly_getBase()

hasNext

public boolean hasNext()
hasNext: defer to the base iterator

Specified by:
hasNext in interface java.util.Iterator<T>
Overrides:
hasNext in class NiceIterator<T>

next

public T next()
next: defer to the base iterator

Specified by:
next in interface java.util.Iterator<T>
Overrides:
next in class NiceIterator<T>

remove

public void remove()
if .remove() is allowed, delegate to the base iterator's .remove; otherwise, throw an UnsupportedOperationException.

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

close

public void close()
close: defer to the base, iff it is closable

Specified by:
close in interface ClosableIterator<T>
Overrides:
close in class NiceIterator<T>

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.



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