Interface Indexed<T>

    • Method Detail

      • empty

        static <T> Indexed<T> empty()
      • size

        int size()
        Number of elements in the value set
      • indexOf

        int indexOf​(@Nullable
                    T value)
        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 unless isSorted() 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 of indexOf(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 if 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.

        Parameters:
        index - identifying an element of an Indexed
        size - size of the Indexed