final class ReverseOrdering<T> extends Ordering<T> implements java.io.Serializable
Ordering.ArbitraryOrdering, Ordering.IncomparableValueException
Modifier and Type | Field and Description |
---|---|
(package private) Ordering<? super T> |
forwardOrder |
private static long |
serialVersionUID |
LEFT_IS_GREATER, RIGHT_IS_GREATER
Constructor and Description |
---|
ReverseOrdering(Ordering<? super T> forwardOrder) |
Modifier and Type | Method and Description |
---|---|
int |
compare(T a,
T b) |
boolean |
equals(java.lang.Object object) |
int |
hashCode() |
<E extends T> |
max(E a,
E b)
Returns the greater of the two values according to this ordering.
|
<E extends T> |
max(E a,
E b,
E c,
E... rest)
Returns the greatest of the specified values according to this ordering.
|
<E extends T> |
max(java.lang.Iterable<E> iterable)
Returns the greatest of the specified values according to this ordering.
|
<E extends T> |
max(java.util.Iterator<E> iterator)
Returns the greatest of the specified values according to this ordering.
|
<E extends T> |
min(E a,
E b)
Returns the lesser of the two values according to this ordering.
|
<E extends T> |
min(E a,
E b,
E c,
E... rest)
Returns the least of the specified values according to this ordering.
|
<E extends T> |
min(java.lang.Iterable<E> iterable)
Returns the least of the specified values according to this ordering.
|
<E extends T> |
min(java.util.Iterator<E> iterator)
Returns the least of the specified values according to this ordering.
|
<S extends T> |
reverse()
Returns the reverse of this ordering; the
Ordering equivalent to Collections.reverseOrder(Comparator) . |
java.lang.String |
toString() |
allEqual, arbitrary, binarySearch, compound, compound, explicit, explicit, from, from, greatestOf, greatestOf, immutableSortedCopy, isOrdered, isStrictlyOrdered, leastOf, leastOf, lexicographical, natural, nullsFirst, nullsLast, onKeys, onResultOf, sortedCopy, usingToString
private static final long serialVersionUID
public <S extends T> Ordering<S> reverse()
Ordering
Ordering
equivalent to Collections.reverseOrder(Comparator)
.
Java 8 users: Use thisComparator.reversed()
instead.
public <E extends T> E min(E a, E b)
Ordering
Implementation note: this method is invoked by the default implementations of the
other min
overloads, so overriding it will affect their behavior.
Note: Consider using Comparators.min(a, b, thisComparator)
instead. If thisComparator
is Ordering.natural()
, then use Comparators.min(a, b)
.
public <E extends T> E min(E a, E b, E c, E... rest)
Ordering
Java 8 users: Use Collections.min(Arrays.asList(a, b, c...), thisComparator)
instead (but note that it does not guarantee which tied minimum element is returned).
public <E extends T> E min(java.util.Iterator<E> iterator)
Ordering
hasNext()
method will return false
.
Java 8 users: Use Streams.stream(iterator).min(thisComparator).get()
instead
(but note that it does not guarantee which tied minimum element is returned).
public <E extends T> E min(java.lang.Iterable<E> iterable)
Ordering
Java 8 users: If iterable
is a Collection
, use Collections.min(collection, thisComparator)
instead. Otherwise, use Streams.stream(iterable).min(thisComparator).get()
instead. Note that these alternatives do
not guarantee which tied minimum element is returned)
public <E extends T> E max(E a, E b)
Ordering
Implementation note: this method is invoked by the default implementations of the
other max
overloads, so overriding it will affect their behavior.
Note: Consider using Comparators.max(a, b, thisComparator)
instead. If thisComparator
is Ordering.natural()
, then use Comparators.max(a, b)
.
public <E extends T> E max(E a, E b, E c, E... rest)
Ordering
Java 8 users: Use Collections.max(Arrays.asList(a, b, c...), thisComparator)
instead (but note that it does not guarantee which tied maximum element is returned).
public <E extends T> E max(java.util.Iterator<E> iterator)
Ordering
hasNext()
method will return false
.
Java 8 users: Use Streams.stream(iterator).max(thisComparator).get()
instead
(but note that it does not guarantee which tied maximum element is returned).
public <E extends T> E max(java.lang.Iterable<E> iterable)
Ordering
Java 8 users: If iterable
is a Collection
, use Collections.max(collection, thisComparator)
instead. Otherwise, use Streams.stream(iterable).max(thisComparator).get()
instead. Note that these alternatives do
not guarantee which tied maximum element is returned)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(@CheckForNull java.lang.Object object)
equals
in interface java.util.Comparator<T>
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object