Enum SortedLists.KeyPresentBehavior

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<SortedLists.KeyPresentBehavior>
    Enclosing class:
    SortedLists

    public static enum SortedLists.KeyPresentBehavior
    extends java.lang.Enum<SortedLists.KeyPresentBehavior>
    A specification for which index to return if the list contains at least one element that compares as equal to the key.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      ANY_PRESENT
      Return the index of any list element that compares as equal to the key.
      FIRST_AFTER
      Return the index of the first list element that compares as greater than the key, or list.size() if there is no such element.
      FIRST_PRESENT
      Return the index of the first list element that compares as equal to the key.
      LAST_BEFORE
      Return the index of the last list element that compares as less than the key, or -1 if there is no such element.
      LAST_PRESENT
      Return the index of the last list element that compares as equal to the key.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private KeyPresentBehavior()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract <E> int resultIndex​(java.util.Comparator<? super E> comparator, E key, java.util.List<? extends E> list, int foundIndex)  
      static SortedLists.KeyPresentBehavior valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static SortedLists.KeyPresentBehavior[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • ANY_PRESENT

        public static final SortedLists.KeyPresentBehavior ANY_PRESENT
        Return the index of any list element that compares as equal to the key. No guarantees are made as to which index is returned, if more than one element compares as equal to the key.
      • LAST_PRESENT

        public static final SortedLists.KeyPresentBehavior LAST_PRESENT
        Return the index of the last list element that compares as equal to the key.
      • FIRST_PRESENT

        public static final SortedLists.KeyPresentBehavior FIRST_PRESENT
        Return the index of the first list element that compares as equal to the key.
      • FIRST_AFTER

        public static final SortedLists.KeyPresentBehavior FIRST_AFTER
        Return the index of the first list element that compares as greater than the key, or list.size() if there is no such element.
      • LAST_BEFORE

        public static final SortedLists.KeyPresentBehavior LAST_BEFORE
        Return the index of the last list element that compares as less than the key, or -1 if there is no such element.
    • Constructor Detail

      • KeyPresentBehavior

        private KeyPresentBehavior()
    • Method Detail

      • values

        public static SortedLists.KeyPresentBehavior[] 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.KeyPresentBehavior c : SortedLists.KeyPresentBehavior.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.KeyPresentBehavior 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

        public abstract <E> int resultIndex​(java.util.Comparator<? super E> comparator,
                                            E key,
                                            java.util.List<? extends E> list,
                                            int foundIndex)