Class ReverseNaturalOrdering
- java.lang.Object
-
- com.google.common.collect.Ordering<java.lang.Comparable>
-
- com.google.common.collect.ReverseNaturalOrdering
-
- All Implemented Interfaces:
java.io.Serializable
,java.util.Comparator<java.lang.Comparable>
@GwtCompatible(serializable=true) final class ReverseNaturalOrdering extends Ordering<java.lang.Comparable> implements java.io.Serializable
An ordering that uses the reverse of the natural order of the values.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.collect.Ordering
Ordering.ArbitraryOrdering, Ordering.IncomparableValueException
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static ReverseNaturalOrdering
INSTANCE
private static long
serialVersionUID
-
Fields inherited from class com.google.common.collect.Ordering
LEFT_IS_GREATER, RIGHT_IS_GREATER
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ReverseNaturalOrdering()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(java.lang.Comparable left, java.lang.Comparable right)
<E extends java.lang.Comparable>
Emax(E a, E b)
Returns the greater of the two values according to this ordering.<E extends java.lang.Comparable>
Emax(E a, E b, E c, E... rest)
Returns the greatest of the specified values according to this ordering.<E extends java.lang.Comparable>
Emax(java.lang.Iterable<E> iterable)
Returns the greatest of the specified values according to this ordering.<E extends java.lang.Comparable>
Emax(java.util.Iterator<E> iterator)
Returns the greatest of the specified values according to this ordering.<E extends java.lang.Comparable>
Emin(E a, E b)
Returns the lesser of the two values according to this ordering.<E extends java.lang.Comparable>
Emin(E a, E b, E c, E... rest)
Returns the least of the specified values according to this ordering.<E extends java.lang.Comparable>
Emin(java.lang.Iterable<E> iterable)
Returns the least of the specified values according to this ordering.<E extends java.lang.Comparable>
Emin(java.util.Iterator<E> iterator)
Returns the least of the specified values according to this ordering.private java.lang.Object
readResolve()
<S extends java.lang.Comparable>
Ordering<S>reverse()
Returns the reverse of this ordering; theOrdering
equivalent toCollections.reverseOrder(Comparator)
.java.lang.String
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
-
-
-
-
Field Detail
-
INSTANCE
static final ReverseNaturalOrdering INSTANCE
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
compare
public int compare(java.lang.Comparable left, java.lang.Comparable right)
-
reverse
public <S extends java.lang.Comparable> Ordering<S> 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
public <E extends java.lang.Comparable> E min(E a, E b)
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.Java 8 users: Use
Stream.of(a, b).min(thisComparator).get()
instead (but note that it does not guarantee which tied minimum element is returned).
-
min
public <E extends java.lang.Comparable> E min(E a, E b, E c, E... rest)
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
Stream.of(a, b, c...).min(thisComparator).get()
instead (but note that it does not guarantee which tied minimum element is returned).
-
min
public <E extends java.lang.Comparable> E min(java.util.Iterator<E> iterator)
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: Continue to use this method for now. After the next release of Guava, use
Streams.stream(iterator).min(thisComparator).get()
instead (but note that it does not guarantee which tied minimum element is returned).
-
min
public <E extends java.lang.Comparable> E min(java.lang.Iterable<E> iterable)
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, continue to use this method for now. After the next release of Guava, useStreams.stream(iterable).min(thisComparator).get()
instead. Note that these alternatives do not guarantee which tied minimum element is returned)
-
max
public <E extends java.lang.Comparable> E max(E a, E b)
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.Java 8 users: Use
Stream.of(a, b).max(thisComparator).get()
instead (but note that it does not guarantee which tied maximum element is returned).
-
max
public <E extends java.lang.Comparable> E max(E a, E b, E c, E... rest)
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
Stream.of(a, b, c...).max(thisComparator).get()
instead (but note that it does not guarantee which tied maximum element is returned).
-
max
public <E extends java.lang.Comparable> E max(java.util.Iterator<E> iterator)
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: Continue to use this method for now. After the next release of Guava, use
Streams.stream(iterator).max(thisComparator).get()
instead (but note that it does not guarantee which tied maximum element is returned).
-
max
public <E extends java.lang.Comparable> E max(java.lang.Iterable<E> iterable)
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, continue to use this method for now. After the next release of Guava, useStreams.stream(iterable).max(thisComparator).get()
instead. Note that these alternatives do not guarantee which tied maximum element is returned)
-
readResolve
private java.lang.Object readResolve()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-