Interface Index<V>
- Type Parameters:
V- value type
- All Superinterfaces:
Iterable<Index.Element<V>>
- All Known Subinterfaces:
ModifiableIndex<V>,UpdatableIndex<V>
Indexes provide lexicographically ordered access to the index keys/elements via the iterator functions. Reverse iterator functions provide reverse lexicographically ordered access.
Instances of this interface are generally not thread-safe when modified, read-only accesses are generally thread-safe.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents an element in an index. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck whether the index contains the given key and whether its value is notnull.static <V> Index<V> empty()Retrieves a read-only, empty index.@Nullable VRetrieve the value for a key.default @NonNull Iterator<Index.Element<V>> iterator()Convenience foriterator(null, null, false).@NonNull Iterator<Index.Element<V>> Iterate over the elements in this index, with optional lower/higher or prefix restrictions.voidprefetchIfNecessary(Iterable<IndexKey> keys) Prefetch this index and/or index splits that are needed to satisfy operations against the given keys.default @NonNull Iterator<Index.Element<V>> Convenience forreverseIterator(null, null, false).@NonNull Iterator<Index.Element<V>> reverseIterator(@Nullable IndexKey lower, @Nullable IndexKey higher, boolean prefetch) Iterate in reverse order over the elements in this index, with optional lower/higher or prefix restrictions.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
empty
Retrieves a read-only, empty index. -
prefetchIfNecessary
Prefetch this index and/or index splits that are needed to satisfy operations against the given keys. -
contains
Check whether the index contains the given key and whether its value is notnull. -
get
Retrieve the value for a key.- Parameters:
key- key to retrieve the value for- Returns:
- value or
null, if the key does not exist
-
iterator
Convenience foriterator(null, null, false). -
iterator
@NonNull Iterator<Index.Element<V>> iterator(@Nullable IndexKey lower, @Nullable IndexKey higher, boolean prefetch) Iterate over the elements in this index, with optional lower/higher or prefix restrictions.Prefix queries:
lowerandhighermust be equal and notnull, only elements that start with the given key value will be returned.Start at queries: Start at
lower(inclusive)End at queries: End at
higher(inclusive if exact match) restrictionsRange queries:
lower(inclusive) andhigher(inclusive if exact match) restrictions- Parameters:
lower- optional lower bound for the range, see description above..higher- optional higher bound for the range, see description above..prefetch- Enables eager prefetch of all potentially required indexes. Set tofalse, when using result paging.- Returns:
- iterator over the elements in this index, lexicographically ordered.
- See Also:
-
reverseIterator
Convenience forreverseIterator(null, null, false).- See Also:
-
reverseIterator
@NonNull Iterator<Index.Element<V>> reverseIterator(@Nullable IndexKey lower, @Nullable IndexKey higher, boolean prefetch) Iterate in reverse order over the elements in this index, with optional lower/higher or prefix restrictions.Prefix queries (NOT SUPPORTED, YET?):
lowerandhighermust be equal and notnull, only elements that start with the given key value will be returned.Start at queries: Start at
higher(inclusive)End at queries: End at
lower(inclusive if exact match) restrictionsRange queries:
higher(inclusive) andlower(inclusive if exact match) restrictions- Parameters:
lower- optional lower bound for the range, see description above..higher- optional higher bound for the range, see description above..prefetch- Enables eager prefetch of all potentially required indexes. Set tofalse, when using result paging.- Returns:
- iterator over the elements in this index, reverse-lexicographically ordered.
- See Also:
-