Class ReverseNaturalOrdering
- All Implemented Interfaces:
Serializable,Comparator<Comparable<?>>
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.common.collect.Ordering
Ordering.ArbitraryOrdering, Ordering.IncomparableValueException -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final ReverseNaturalOrderingprivate static final longFields inherited from class com.google.common.collect.Ordering
LEFT_IS_GREATER, RIGHT_IS_GREATER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompare(Comparable<?> left, Comparable<?> right) <E extends Comparable<?>>
Emax(E a, E b) Returns the greater of the two values according to this ordering.<E extends Comparable<?>>
Emax(E a, E b, E c, E... rest) Returns the greatest of the specified values according to this ordering.<E extends Comparable<?>>
EReturns the greatest of the specified values according to this ordering.<E extends Comparable<?>>
EReturns the greatest of the specified values according to this ordering.<E extends Comparable<?>>
Emin(E a, E b) Returns the lesser of the two values according to this ordering.<E extends Comparable<?>>
Emin(E a, E b, E c, E... rest) Returns the least of the specified values according to this ordering.<E extends Comparable<?>>
EReturns the least of the specified values according to this ordering.<E extends Comparable<?>>
EReturns the least of the specified values according to this ordering.private Object<S extends Comparable<?>>
Ordering<S> 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
INSTANCE
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
ReverseNaturalOrdering
private ReverseNaturalOrdering()
-
-
Method Details
-
compare
- Specified by:
comparein interfaceComparator<Comparable<?>>- Specified by:
comparein classOrdering<Comparable<?>>
-
reverse
Description copied from class:OrderingReturns the reverse of this ordering; theOrderingequivalent toCollections.reverseOrder(Comparator).Java 8+ users: Use
thisComparator.reversed()instead.- Overrides:
reversein classOrdering<Comparable<?>>
-
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).- Overrides:
minin classOrdering<Comparable<?>>- Parameters:
a- value to compare, returned if less than or equal to b.b- value to compare.
-
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).- Overrides:
minin classOrdering<Comparable<?>>- Parameters:
a- value to compare, returned if less than or equal to the rest.b- value to comparec- value to comparerest- values to compare
-
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).- Overrides:
minin classOrdering<Comparable<?>>- Parameters:
iterator- the iterator whose minimum element is to be determined
-
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.- Overrides:
minin classOrdering<Comparable<?>>- Parameters:
iterable- the iterable whose minimum element is to be determined
-
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).- Overrides:
maxin classOrdering<Comparable<?>>- Parameters:
a- value to compare, returned if greater than or equal to b.b- value to compare.
-
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).- Overrides:
maxin classOrdering<Comparable<?>>- Parameters:
a- value to compare, returned if greater than or equal to the rest.b- value to comparec- value to comparerest- values to compare
-
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).- Overrides:
maxin classOrdering<Comparable<?>>- Parameters:
iterator- the iterator whose maximum element is to be determined
-
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.- Overrides:
maxin classOrdering<Comparable<?>>- Parameters:
iterable- the iterable whose maximum element is to be determined
-
readResolve
-
toString
-