|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.hp.hpl.jena.util.iterator.LazyIterator<T>
public abstract class LazyIterator<T>
An ExtendedIterator that is created lazily.
This is useful when constructing an iterator is expensive and
you'd prefer to delay doing it until certain it's actually needed.
For example, if you have iterator1.andThen(iterator2)
you could implement iterator2 as a LazyIterator.
The sequence to be defined is defined by the subclass's definition
of create(). That is called exactly once on the first attempt
to interact with the LazyIterator.
Constructor Summary | |
---|---|
LazyIterator()
An ExtendedIterator that is created lazily. |
Method Summary | ||
---|---|---|
ExtendedIterator<T> |
andThen(ClosableIterator<? extends T> other)
|
|
void |
close()
Close the iterator. |
|
abstract ExtendedIterator<T> |
create()
The subclass must define this to return the ExtendedIterator to invoke. |
|
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_. |
|
boolean |
hasNext()
|
|
|
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 |
next()
|
|
void |
remove()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.hp.hpl.jena.util.iterator.ExtendedIterator |
---|
andThen, removeNext, toList, toSet |
Constructor Detail |
---|
public LazyIterator()
Method Detail |
---|
public boolean hasNext()
hasNext
in interface java.util.Iterator<T>
public T next()
next
in interface java.util.Iterator<T>
public void remove()
remove
in interface java.util.Iterator<T>
public ExtendedIterator<T> andThen(ClosableIterator<? extends T> other)
public ExtendedIterator<T> filterKeep(Filter<T> f)
ExtendedIterator
filterKeep
in interface ExtendedIterator<T>
public ExtendedIterator<T> filterDrop(Filter<T> f)
ExtendedIterator
filterDrop
in interface ExtendedIterator<T>
public <U> ExtendedIterator<U> mapWith(Map1<T,U> map1)
ExtendedIterator
mapWith
in interface ExtendedIterator<T>
public void close()
ClosableIterator
close
in interface ClosableIterator<T>
public abstract ExtendedIterator<T> create()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |