Lines Matching refs:comparator
25 import java.util.Comparator;
36 * A comparator with added methods to support common functions. For example:
39 * if (Ordering.from(comparator).reverse().isOrdered(list)) { ... }}</pre>
41 * <p>The {@link #from(Comparator)} method returns the equivalent {@code
42 * Ordering} instance for a pre-existing comparator. You can also skip the
43 * comparator step and extend {@code Ordering} directly: <pre> {@code
61 public abstract class Ordering<T> implements Comparator<T> {
80 * Returns an ordering for a pre-existing {@code comparator}. Note
81 * that if the comparator is not pre-existing, and you don't require
85 * @param comparator the comparator that defines the order
88 public static <T> Ordering<T> from(Comparator<T> comparator) {
89 return (comparator instanceof Ordering)
90 ? (Ordering<T>) comparator
91 : new ComparatorOrdering<T>(comparator);
107 * (according to {@link Object#equals}) may be compared. This comparator
110 * comparator. Null values in the list are not supported.
112 * <p>The returned comparator throws an {@link ClassCastException} when it
115 * <p>The generated comparator is serializable if all the provided values are
118 * @param valuesInOrder the values that the returned comparator will be able
119 * to compare, in the order the comparator should induce
120 * @return the comparator described above
133 * list (according to {@link Object#equals}) may be compared. This comparator
137 * <p>The returned comparator throws a {@link ClassCastException} when it
140 * <p>The generated comparator is serializable if all the provided values are
143 * @param leastValue the value which the returned comparator should consider
146 * comparator will be able to compare, in the order the comparator should
148 * @return the comparator described above
161 * Ordering#explicit(Object, Object[])} comparator when comparing a value
185 * {@link Object#equals(Object)}" as defined by {@link Comparator}. Use
253 * <p>The comparator is serializable.
261 * Returns an ordering which tries each given comparator in order until a
277 Iterable<? extends Comparator<? super T>> comparators) {
302 Comparator<? super U> secondaryComparator) {
308 * {@link Collections#reverseOrder(Comparator)}.
383 * {@link Collections#binarySearch(List, Object, Comparator) Searches}