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 ReverseNaturalOrdering
private 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
compare
(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; 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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:
compare
in interfaceComparator<Comparable<?>>
- Specified by:
compare
in classOrdering<Comparable<?>>
-
reverse
Description copied from class:Ordering
Returns the reverse of this ordering; theOrdering
equivalent toCollections.reverseOrder(Comparator)
.Java 8+ users: Use
thisComparator.reversed()
instead.- Overrides:
reverse
in classOrdering<Comparable<?>>
-
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)
.- Overrides:
min
in classOrdering<Comparable<?>>
- Parameters:
a
- value to compare, returned if less than or equal to b.b
- value to compare.
-
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).- Overrides:
min
in 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: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).- Overrides:
min
in classOrdering<Comparable<?>>
- Parameters:
iterator
- the iterator whose minimum element is to be determined
-
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.- Overrides:
min
in classOrdering<Comparable<?>>
- Parameters:
iterable
- the iterable whose minimum element is to be determined
-
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)
.- Overrides:
max
in classOrdering<Comparable<?>>
- Parameters:
a
- value to compare, returned if greater than or equal to b.b
- value to compare.
-
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).- Overrides:
max
in 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: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).- Overrides:
max
in classOrdering<Comparable<?>>
- Parameters:
iterator
- the iterator whose maximum element is to be determined
-
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.- Overrides:
max
in classOrdering<Comparable<?>>
- Parameters:
iterable
- the iterable whose maximum element is to be determined
-
readResolve
-
toString
-