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 thecomparator 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()); } };}
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 be serialized, then{@code ordering.onResultOf(function)} can as well.
@author Jesse Wilson