A comparator with added methods to support common functions. For example:
{@code}if (Ordering.from(comparator).reverse().isOrdered(list)) ... }}
The {@link #from(Comparator)} method returns the equivalent {@code Ordering}instance for a pre-existing comparator. You can also skip the comparator step and extend {@code Ordering} directly:
{@code}Ordering byLengthOrdering = new Ordering() public int compare(String left, String right) { return Ints.compare(left.length(), right.length()); } };}
Except as noted, the orderings returned by the factory methods of this class are serializable if and only if the provided instances that back them are. For example, if {@code ordering} and {@code function} can themselves beserialized, then {@code ordering.onResultOf(function)} can as well.
@author Jesse Wilson
@author Kevin Bourrillion
@since Guava release 02 (imported from Google Collections Library)