Package com.liferay.adaptive.media
Interface AMDistanceComparator<T>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Compares two values, returning a long value representing the distance between
them. The meaning of this distance is dependent on the kind of value.
-
Method Summary
Modifier and TypeMethodDescriptionlongCompare the two values, returning a long value representing how far they are from each other.default Comparator<T> Return a comparator that is equivalent to thisAMDistanceComparator.
-
Method Details
-
compare
Compare the two values, returning a long value representing how far they are from each other. The meaning of this distance depends on the kind of attribute.- Parameters:
value1- the first valuevalue2- the second value- Returns:
- the distance between the two values
-
toComparator
Return a comparator that is equivalent to thisAMDistanceComparator. Implementations of this interface must use saturated arithmetic, guaranteeing the following conditions:if amDistanceComparator.compare(a, b) invalid input: '<' 0 then amDistanceComparator.toComparator().compare(a, b) invalid input: '<' 0 if amDistanceComparator.compare(a, b) > 0 then amDistanceComparator.toComparator().compare(a, b) > 0 if amDistanceComparator.compare(a, b) = 0 then amDistanceComparator.toComparator().compare(a, b) = 0- Returns:
- a
Comparatorequivalent to thisAMDistanceComparator
-