public abstract class AbstractSkippingIterator<T> extends Object implements PeekingSkippingIterator<T>, CloseableIterator<T>
Abstract SkippingIterator implementation to help with concrete implementations. The remove function of
this implementation throws UnsupportedOperationException and its size estimate is
unknown.
CloseableIterator.AbstractCloseableIterator<T>, CloseableIterator.EmptyCloseableIterator<T>| Modifier and Type | Field and Description |
|---|---|
protected Comparator<T> |
mComparator
The comparator which defines the order for skipping
|
UNKNOWN_SIZE| Constructor and Description |
|---|
AbstractSkippingIterator(Comparator<T> theComparator) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Comparator<T> |
comparator()
Returns the comparator for this iterator that specifies the order in which the elements are returned.
|
protected abstract T |
computeNext()
Return the next element to be returned by the iterator
|
protected abstract T |
computeSkipTo(T theTarget)
Returns the element that this iteration has skipped to or
null if
it ran off the end. |
protected T |
endOfData()
Signal that you're done iterating.
|
long |
estimatedSize()
Returns the estimated size of this iterator without advancing the iterator or
SkippingIterator.UNKNOWN_SIZE if the
estimate is not known. |
boolean |
hasNext() |
T |
next() |
T |
peek()
Implementation of peeking to the next item returned by the iterator.
|
protected abstract void |
performReset() |
void |
remove() |
void |
reset()
Resets the iterator to the beginning so the following
Iterator.next() call will return the first element in this iteration. |
T |
skipTo(T theElement)
Returns the element which is equal or greater to theElement based on the ordering of the elements in the underlying data source,
i.e., for two elements A, B s.t.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcloseQuietly, collect, concat, empty, filter, first, isEmpty, onClose, singleton, size, toCloseable, toCloseable, toCloseable, toList, toSet, transformforEachRemainingprotected final Comparator<T> mComparator
public AbstractSkippingIterator(Comparator<T> theComparator)
public Comparator<T> comparator()
comparator in interface SkippingIterator<T>public long estimatedSize()
SkippingIterator.UNKNOWN_SIZE if the
estimate is not known. The estimate is for the whole iterator and will not change after the iterator is
advanced. There is no guarantee about the accuracy of the estimate.estimatedSize in interface SkippingIterator<T>public void remove()
protected abstract T computeNext()
protected abstract T computeSkipTo(T theTarget)
null if
it ran off the end.theTarget - the skipping targetnull if it doesn't exist.public final T next()
protected final T endOfData()
public void close()
close in interface CloseableIterator<T>close in interface AutoCloseablepublic final T peek()
PeekingIterator interface.peek in interface com.google.common.collect.PeekingIterator<T>public final T skipTo(T theElement)
A <= B.
Note that skips are always in the forward direction. if theElement compares to less than the last returned element (or less than the bounding start
of the iterator), then no skip will occur, and the returned value is the same as if `next()` was called.skipTo in interface SkippingIterator<T>A s.t. A <= theElement, if theElement > last seen element, or the output of next() if not.public final void reset()
Iterator.next() call will return the first element in this iteration.reset in interface ResettableIterator<T>protected abstract void performReset()
Copyright © 2010-2016 Stardog Union. All Rights Reserved.