public abstract class KVStoreView<T>
extends Object
implements Iterable<T>
KVStore
.
The different methods can be used to configure the behavior of the iterator. Calling the same method multiple times is allowed; the most recent value will be used.
The iterators returned by this view are of type KVStoreIterator
; they auto-close
when used in a for loop that exhausts their contents, but when used manually, they need
to be closed explicitly unless all elements are read.
Constructor and Description |
---|
KVStoreView(Class<T> type) |
Modifier and Type | Method and Description |
---|---|
KVStoreIterator<T> |
closeableIterator()
Returns an iterator for the current configuration.
|
KVStoreView<T> |
first(Object value)
Iterates starting at the given value of the chosen index (inclusive).
|
KVStoreView<T> |
index(String name)
Iterates according to the given index.
|
KVStoreView<T> |
last(Object value)
Stops iteration at the given value of the chosen index (inclusive).
|
KVStoreView<T> |
max(long max)
Stops iteration after a number of elements has been retrieved.
|
KVStoreView<T> |
parent(Object value)
Defines the value of the parent index when iterating over a child index.
|
KVStoreView<T> |
reverse()
Reverses the order of iteration.
|
KVStoreView<T> |
skip(long n)
Skips a number of elements at the start of iteration.
|
public KVStoreView(Class<T> type)
public KVStoreView<T> reverse()
public KVStoreView<T> index(String name)
public KVStoreView<T> parent(Object value)
Required for iterating over child indices, will generate an error if iterating over a parent-less index.
public KVStoreView<T> first(Object value)
public KVStoreView<T> last(Object value)
public KVStoreView<T> max(long max)
public KVStoreView<T> skip(long n)
max(long)
.public KVStoreIterator<T> closeableIterator() throws Exception
Exception