Package com.google.common.collect
Enum Class SortedLists.KeyAbsentBehavior
java.lang.Object
java.lang.Enum<SortedLists.KeyAbsentBehavior>
com.google.common.collect.SortedLists.KeyAbsentBehavior
- All Implemented Interfaces:
Serializable
,Comparable<SortedLists.KeyAbsentBehavior>
,Constable
- Enclosing class:
SortedLists
A specification for which index to return if the list contains no elements that compare 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~insertionIndex
, whereinsertionIndex
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, orlist.size()
if there is no such element.Return the index of the next higher element in the list, orlist.size()
if there is no such element.Return the index of the next lower element in the list, or-1
if there is no such element. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) abstract int
resultIndex
(int higherIndex) Returns the enum constant of this class with the specified name.static SortedLists.KeyAbsentBehavior[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NEXT_LOWER
Return the index of the next lower element in the list, or-1
if there is no such element. -
NEXT_HIGHER
Return the index of the next higher element in the list, orlist.size()
if there is no such element. -
INVERTED_INSERTION_INDEX
Return~insertionIndex
, whereinsertionIndex
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, orlist.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 Details
-
KeyAbsentBehavior
private KeyAbsentBehavior()
-
-
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 int resultIndex(int higherIndex)
-