compareByIndex<T extends Enum> method
Null safety
- @Since("2.15")
- T value1,
- T value2
@Since("2.15")
Compares two enum values by their index.
A generic Comparator function for enum types which
orders enum values by their index value, which corresponds
to the source order of the enum element declarations in
the enum
declaration.
Implementation
@Since("2.15")
static int compareByIndex<T extends Enum>(T value1, T value2) =>
value1.index - value2.index;