Package org.apache.druid.segment.data
Interface Indexed<T>
- Type Parameters:
T- the type of the value
- All Superinterfaces:
HotLoopCallee,Iterable<T>
- All Known Subinterfaces:
CloseableIndexed<T>,ColumnarMultiInts
- All Known Implementing Classes:
CompressedVSizeColumnarMultiIntsSupplier.CompressedVSizeColumnarMultiInts,FixedIndexed,FrontCodedIndexed,FrontCodedIndexed.FrontCodedV0,FrontCodedIndexed.FrontCodedV1,FrontCodedIntArrayIndexed,GenericIndexed,GenericIndexed.BufferIndexed,ListIndexed,NestedDataColumnSupplier.FieldsFixupIndexed,StringEncodingStrategies.Utf8ToStringIndexed,VSizeColumnarMultiInts
Indexed is a fixed-size, immutable, indexed set of values which allows
locating a specific index via an exact match, the semantics of which are defined
by the implementation. The indexed is ordered, and may contain duplicate values.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckIndex(int index, int size) Checks ifindexis between 0 andsize.static <T> Indexed<T>empty()get(int index) Get the value at specified positionintReturns the index of "value" in this Indexed object, or a negative number if the value is not present.default booleanisSorted()Indicates if this value set is sorted, the implication being that the contract ofindexOf(T)is strenthened to return a negative number equal to (-(insertion point) - 1) when the value is not present in the set.intsize()Number of elements in the value setMethods inherited from interface org.apache.druid.query.monomorphicprocessing.HotLoopCallee
inspectRuntimeShapeMethods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
empty
-
size
int size()Number of elements in the value set -
get
Get the value at specified position -
indexOf
Returns the index of "value" in this Indexed object, or a negative number if the value is not present. The negative number is not guaranteed to be any particular number unlessisSorted()returns true, in which case it will be a negative number equal to (-(insertion point) - 1), in the manner of Arrays.binarySearch.- Parameters:
value- value to search for- Returns:
- index of value, or a negative number (equal to (-(insertion point) - 1) if
isSorted())
-
isSorted
default boolean isSorted()Indicates if this value set is sorted, the implication being that the contract ofindexOf(T)is strenthened to return a negative number equal to (-(insertion point) - 1) when the value is not present in the set. -
checkIndex
static void checkIndex(int index, int size) Checks ifindexis between 0 andsize. Similar to Preconditions.checkElementIndex() except this method throwsIAEwith custom error message.Used here to get existing behavior(same error message and exception) of V1
GenericIndexed.
-