public interface SkippingIterator<T> extends ResettableIterator<T>
Iterator over an ordered data source that is able to jump to a specific element (or the next greater after that). Iterator might return duplicate objects in which case skipping to an element might skip some occurrences of that element.
CloseableIterator.AbstractCloseableIterator<T>, CloseableIterator.DelegatingCloseableIterator<T>, CloseableIterator.EmptyCloseableIterator<T>
Modifier and Type | Field and Description |
---|---|
static long |
UNKNOWN_SIZE |
Modifier and Type | Method and Description |
---|---|
Comparator<T> |
comparator()
Returns the comparator for this iterator that specifies the order in which the elements are returned.
|
long |
estimatedSize()
Returns the estimated size of this iterator without advancing the iterator or
UNKNOWN_SIZE if the
estimate is not known. |
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.
|
default T |
skipTo(T theElement,
T theBound)
Same contract as
skipTo(Object) but skipping is bounded: if the next element that is greater than or equal to the target is greater than
the bound, the method returns null. |
reset
close, closeAfterLast, closeQuietly, collect, concat, concat, concat, empty, filter, first, isEmpty, limit, map, offset, onClose, singleton, size, toCloseable, toCloseable, toCloseable, toList, toSet, transform
forEachRemaining, hasNext, next, remove
static final long UNKNOWN_SIZE
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.A
s.t. A <= theElement
, if theElement > last seen element
, or the output of next()
if not.default T skipTo(T theElement, T theBound)
skipTo(Object)
but skipping is bounded: if the next element that is greater than or equal to the target is greater than
the bound, the method returns null.
Implementations are free to not move their internal cursor beyond the bound which may enable them to make less work or skip IO.
However, they must maintain their internal state to ensure that the smallest element that is greater than theBound
is not consumed and is returned for the next Iterator.next()
call.theElement
- the targettheBound
- the bound. null means no upper bound.Comparator<T> comparator()
long estimatedSize()
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.Copyright © 2010-2016 Stardog Union. All Rights Reserved.