Class ReverseOrdering<T>
- All Implemented Interfaces:
Serializable
,Comparator<T>
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.common.collect.Ordering
Ordering.ArbitraryOrdering, Ordering.IncomparableValueException
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
Fields inherited from class com.google.common.collect.Ordering
LEFT_IS_GREATER, RIGHT_IS_GREATER
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
int
hashCode()
<E extends T>
Emax
(E a, E b) Returns the greater of the two values according to this ordering.<E extends T>
Emax
(E a, E b, E c, E... rest) Returns the greatest of the specified values according to this ordering.<E extends T>
EReturns the greatest of the specified values according to this ordering.<E extends T>
EReturns the greatest of the specified values according to this ordering.<E extends T>
Emin
(E a, E b) Returns the lesser of the two values according to this ordering.<E extends T>
Emin
(E a, E b, E c, E... rest) Returns the least of the specified values according to this ordering.<E extends T>
EReturns the least of the specified values according to this ordering.<E extends T>
EReturns the least of the specified values according to this ordering.reverse()
Returns the reverse of this ordering; theOrdering
equivalent toCollections.reverseOrder(Comparator)
.toString()
Methods inherited from class com.google.common.collect.Ordering
allEqual, arbitrary, binarySearch, compound, compound, explicit, explicit, from, from, greatestOf, greatestOf, immutableSortedCopy, isOrdered, isStrictlyOrdered, leastOf, leastOf, lexicographical, natural, nullsFirst, nullsLast, onKeys, onResultOf, sortedCopy, usingToString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
forwardOrder
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
ReverseOrdering
-
-
Method Details
-
compare
-
reverse
Description copied from class:Ordering
Returns the reverse of this ordering; theOrdering
equivalent toCollections.reverseOrder(Comparator)
.Java 8+ users: Use
thisComparator.reversed()
instead. -
min
Description copied from class:Ordering
Returns the lesser of the two values according to this ordering. If the values compare as 0, the first is returned.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. IfthisComparator
isOrdering.natural()
, then useComparators.min(a, b)
. -
min
Description copied from class:Ordering
Returns the least of the specified values according to this ordering. If there are multiple least values, the first of those is returned.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). -
min
Description copied from class:Ordering
Returns the least of the specified values according to this ordering. If there are multiple least values, the first of those is returned. The iterator will be left exhausted: itshasNext()
method will returnfalse
.Java 8+ users: Use
Streams.stream(iterator).min(thisComparator).get()
instead (but note that it does not guarantee which tied minimum element is returned). -
min
Description copied from class:Ordering
Returns the least of the specified values according to this ordering. If there are multiple least values, the first of those is returned.Java 8+ users: If
iterable
is aCollection
, useCollections.min(collection, thisComparator)
instead. Otherwise, useStreams.stream(iterable).min(thisComparator).get()
instead. Note that these alternatives do not guarantee which tied minimum element is returned. -
max
Description copied from class:Ordering
Returns the greater of the two values according to this ordering. If the values compare as 0, the first is returned.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. IfthisComparator
isOrdering.natural()
, then useComparators.max(a, b)
. -
max
Description copied from class:Ordering
Returns the greatest of the specified values according to this ordering. If there are multiple greatest values, the first of those is returned.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). -
max
Description copied from class:Ordering
Returns the greatest of the specified values according to this ordering. If there are multiple greatest values, the first of those is returned. The iterator will be left exhausted: itshasNext()
method will returnfalse
.Java 8+ users: Use
Streams.stream(iterator).max(thisComparator).get()
instead (but note that it does not guarantee which tied maximum element is returned). -
max
Description copied from class:Ordering
Returns the greatest of the specified values according to this ordering. If there are multiple greatest values, the first of those is returned.Java 8+ users: If
iterable
is aCollection
, useCollections.max(collection, thisComparator)
instead. Otherwise, useStreams.stream(iterable).max(thisComparator).get()
instead. Note that these alternatives do not guarantee which tied maximum element is returned. -
hashCode
public int hashCode() -
equals
- Specified by:
equals
in interfaceComparator<T>
- Overrides:
equals
in classObject
-
toString
-