T - the type of the valuepublic interface Indexed<T> extends Iterable<T>, HotLoopCallee
| Modifier and Type | Method and Description |
|---|---|
static void |
checkIndex(int index,
int size)
Checks if
index is between 0 and size. |
T |
get(int index)
Get the value at specified position
|
int |
indexOf(T value)
Returns the index of "value" in this Indexed object, or a negative number if the value is not present.
|
default boolean |
isSorted()
Indicates if this value set is sorted, the implication being that the contract of
indexOf(T) is strenthened
to return a negative number equal to (-(insertion point) - 1) when the value is not present in the set. |
int |
size()
Number of elements in the value set
|
forEach, iterator, spliteratorinspectRuntimeShapeint size()
@CalledFromHotLoop @Nullable T get(int index)
int indexOf(@Nullable T value)
isSorted() returns true, in
which case it will be a negative number equal to (-(insertion point) - 1), in the manner of Arrays.binarySearch.value - value to search forisSorted())default boolean isSorted()
indexOf(T) is strenthened
to return a negative number equal to (-(insertion point) - 1) when the value is not present in the set.static void checkIndex(int index,
int size)
index is between 0 and size. Similar to Preconditions.checkElementIndex() except this
method throws IAE with custom error message.
Used here to get existing behavior(same error message and exception) of V1 GenericIndexed.
Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.