Package com.google.common.collect
Enum Class SortedLists.KeyPresentBehavior
java.lang.Object
java.lang.Enum<SortedLists.KeyPresentBehavior>
com.google.common.collect.SortedLists.KeyPresentBehavior
- All Implemented Interfaces:
Serializable
,Comparable<SortedLists.KeyPresentBehavior>
,Constable
- Enclosing class:
SortedLists
A specification for which index to return if the list contains at least one element that
compares as equal to the key.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionReturn the index of any list element that compares as equal to the key.Return the index of the first list element that compares as greater than the key, orlist.size()
if there is no such element.Return the index of the first list element that compares as equal to the key.Return the index of the last list element that compares as less than the key, or-1
if there is no such element.Return the index of the last list element that compares as equal to the key. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) abstract <E> int
resultIndex
(Comparator<? super E> comparator, E key, List<? extends E> list, int foundIndex) Returns the enum constant of this class with the specified name.static SortedLists.KeyPresentBehavior[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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
Return the index of the last list element that compares as equal to the key. -
FIRST_PRESENT
Return the index of the first 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, orlist.size()
if there is no such element. -
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 Details
-
KeyPresentBehavior
private KeyPresentBehavior()
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
resultIndex
abstract <E> int resultIndex(Comparator<? super E> comparator, E key, List<? extends E> list, int foundIndex)
-