Package org.apache.flink.runtime.state
Interface PriorityComparator<T>
-
- Type Parameters:
T- type of the compared objects.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface PriorityComparator<T>
This interface works similar toComparableand is used to prioritize between two objects. The main difference between this interface andComparableis it is not require to follow the usual contract between thatComparable.compareTo(Object)andObject.equals(Object). The contract of this interface is: When two objects are equal, they indicate the same priority, but indicating the same priority does not require that both objects are equal.
-
-
Field Summary
Fields Modifier and Type Field Description static PriorityComparator<? extends PriorityComparable<Object>>FOR_PRIORITY_COMPARABLE_OBJECTS
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description intcomparePriority(T left, T right)Compares two objects for priority.static <T extends PriorityComparable<?>>
PriorityComparator<T>forPriorityComparableObjects()
-
-
-
Field Detail
-
FOR_PRIORITY_COMPARABLE_OBJECTS
static final PriorityComparator<? extends PriorityComparable<Object>> FOR_PRIORITY_COMPARABLE_OBJECTS
-
-
Method Detail
-
comparePriority
int comparePriority(T left, T right)
Compares two objects for priority. Returns a negative integer, zero, or a positive integer as the first argument has lower, equal to, or higher priority than the second.- Parameters:
left- left operand in the comparison by priority.right- left operand in the comparison by priority.- Returns:
- a negative integer, zero, or a positive integer as the first argument has lower, equal to, or higher priority than the second.
-
forPriorityComparableObjects
static <T extends PriorityComparable<?>> PriorityComparator<T> forPriorityComparableObjects()
-
-