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 longFields inherited from class com.google.common.collect.Ordering
LEFT_IS_GREATER, RIGHT_IS_GREATER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbooleaninthashCode()<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; theOrderingequivalent 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, usingToStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:OrderingReturns the reverse of this ordering; theOrderingequivalent toCollections.reverseOrder(Comparator).Java 8+ users: Use
thisComparator.reversed()instead. -
min
Description copied from class:OrderingReturns 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
minoverloads, so overriding it will affect their behavior.Note: Consider using
Comparators.min(a, b, thisComparator)instead. IfthisComparatorisOrdering.natural(), then useComparators.min(a, b). -
min
Description copied from class:OrderingReturns 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:OrderingReturns 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:OrderingReturns 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
iterableis 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:OrderingReturns 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
maxoverloads, so overriding it will affect their behavior.Note: Consider using
Comparators.max(a, b, thisComparator)instead. IfthisComparatorisOrdering.natural(), then useComparators.max(a, b). -
max
Description copied from class:OrderingReturns 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:OrderingReturns 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:OrderingReturns 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
iterableis 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:
equalsin interfaceComparator<T>- Overrides:
equalsin classObject
-
toString
-