Enum SortedLists.KeyAbsentBehavior

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      INVERTED_INSERTION_INDEX
      Return ~insertionIndex, where insertionIndex is defined as the point at which the key would be inserted into the list: the index of the next higher element in the list, or list.size() if there is no such element.
      NEXT_HIGHER
      Return the index of the next higher element in the list, or list.size() if there is no such element.
      NEXT_LOWER
      Return the index of the next lower element in the list, or -1 if there is no such element.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private KeyAbsentBehavior()  
    • Enum Constant Detail

      • NEXT_LOWER

        public static final SortedLists.KeyAbsentBehavior NEXT_LOWER
        Return the index of the next lower element in the list, or -1 if there is no such element.
      • NEXT_HIGHER

        public static final SortedLists.KeyAbsentBehavior NEXT_HIGHER
        Return the index of the next higher element in the list, or list.size() if there is no such element.
      • INVERTED_INSERTION_INDEX

        public static final SortedLists.KeyAbsentBehavior INVERTED_INSERTION_INDEX
        Return ~insertionIndex, where insertionIndex is defined as the point at which the key would be inserted into the list: the index of the next higher element in the list, or list.size() if there is no such element.

        Note that the return value will be >= 0 if and only if there is an element of the list that compares as equal to the key.

        This is equivalent to the behavior of Collections.binarySearch(List, Object) when the key isn't present, since ~insertionIndex is equal to -1 - insertionIndex.

    • Constructor Detail

      • KeyAbsentBehavior

        private KeyAbsentBehavior()
    • Method Detail

      • values

        public static SortedLists.KeyAbsentBehavior[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (SortedLists.KeyAbsentBehavior c : SortedLists.KeyAbsentBehavior.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static SortedLists.KeyAbsentBehavior valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • resultIndex

        abstract int resultIndex​(int higherIndex)