Top Description Fields Constructors Methods
com.google.common.collect

pack-priv final Class ReverseNaturalOrdering

extends Ordering<Comparable<?>>
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Annotations
@GwtCompatible
serializable:true
@SuppressWarnings:unchecked, rawtypes
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkNotNull

An ordering that uses the reverse of the natural order of the values.

Field Summary

Modifier and TypeField and Description
pack-priv static final ReverseNaturalOrdering
private static final long
Inherited from com.google.common.collect.Ordering:
LEFT_IS_GREATERRIGHT_IS_GREATER

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public int
compare(Comparable<?>
the first object to be compared.
left
,
Comparable<?>
the second object to be compared.
right
)

Implements abstract com.google.common.collect.Ordering.compare.

Implements java.util.Comparator.compare.

Compares its two arguments for order.
public <E extends Comparable<?>> E
max(E
value to compare, returned if greater than or equal to b.
a
,
E
value to compare.
b
)

Overrides com.google.common.collect.Ordering.max.

Returns the greater of the two values according to this ordering.
public <E extends Comparable<?>> E
max(E
value to compare, returned if greater than or equal to the rest.
a
,
E
value to compare
b
,
E
value to compare
c
,
E...
values to compare
rest
)

Overrides com.google.common.collect.Ordering.max.

Returns the greatest of the specified values according to this ordering.
public <E extends Comparable<?>> E
max(Iterator<E>
the iterator whose maximum element is to be determined
iterator
)

Overrides com.google.common.collect.Ordering.max.

Returns the greatest of the specified values according to this ordering.
public <E extends Comparable<?>> E
max(Iterable<E>
the iterable whose maximum element is to be determined
iterable
)

Overrides com.google.common.collect.Ordering.max.

Returns the greatest of the specified values according to this ordering.
public <E extends Comparable<?>> E
min(E
value to compare, returned if less than or equal to b.
a
,
E
value to compare.
b
)

Overrides com.google.common.collect.Ordering.min.

Returns the lesser of the two values according to this ordering.
public <E extends Comparable<?>> E
min(E
value to compare, returned if less than or equal to the rest.
a
,
E
value to compare
b
,
E
value to compare
c
,
E...
values to compare
rest
)

Overrides com.google.common.collect.Ordering.min.

Returns the least of the specified values according to this ordering.
public <E extends Comparable<?>> E
min(Iterator<E>
the iterator whose minimum element is to be determined
iterator
)

Overrides com.google.common.collect.Ordering.min.

Returns the least of the specified values according to this ordering.
public <E extends Comparable<?>> E
min(Iterable<E>
the iterable whose minimum element is to be determined
iterable
)

Overrides com.google.common.collect.Ordering.min.

Returns the least of the specified values according to this ordering.
private Object
public <S extends Comparable<?>> Ordering<S>
reverse()

Overrides com.google.common.collect.Ordering.reverse.

Returns the reverse of this ordering; the Ordering equivalent to Collections#reverseOrder(Comparator).
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from com.google.common.collect.Ordering:
allEqualarbitrarybinarySearchcompoundcompoundexplicitexplicitfromfromgreatestOfgreatestOfimmutableSortedCopyisOrderedisStrictlyOrderedleastOfleastOflexicographicalnaturalnullsFirstnullsLastonKeysonResultOfsortedCopyusingToString

Field Detail

INSTANCEback to summary
pack-priv static final ReverseNaturalOrdering INSTANCE
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

ReverseNaturalOrderingback to summary
private ReverseNaturalOrdering()

Method Detail

compareback to summary
public int compare(Comparable<?> left, Comparable<?> right)

Implements abstract com.google.common.collect.Ordering.compare.

Implements java.util.Comparator.compare.

Doc from java.util.Comparator.compare.

Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

The implementor must ensure that signum(compare(x, y)) == -signum(compare(y, x)) for all x and y. (This implies that compare(x, y) must throw an exception if and only if compare(y, x) throws an exception.)

The implementor must also ensure that the relation is transitive: ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.

Finally, the implementor must ensure that compare(x, y)==0 implies that signum(compare(x, z))==signum(compare(y, z)) for all z.

Parameters
left:Comparable<?>

the first object to be compared.

right:Comparable<?>

the second object to be compared.

Returns:int

a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

Annotations
@Override
maxback to summary
public <E extends Comparable<?>> E max(E a, E b)

Overrides com.google.common.collect.Ordering.max.

Doc from com.google.common.collect.Ordering.max.

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. If thisComparator is Ordering#natural, then use Comparators.max(a, b).

Parameters
a:E

value to compare, returned if greater than or equal to b.

b:E

value to compare.

Annotations
@Override
maxback to summary
public <E extends Comparable<?>> E max(E a, E b, E c, E... rest)

Overrides com.google.common.collect.Ordering.max.

Doc from com.google.common.collect.Ordering.max.

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).

Parameters
a:E

value to compare, returned if greater than or equal to the rest.

b:E

value to compare

c:E

value to compare

rest:E[]

values to compare

Annotations
@Override
maxback to summary
public <E extends Comparable<?>> E max(Iterator<E> iterator)

Overrides com.google.common.collect.Ordering.max.

Doc from com.google.common.collect.Ordering.max.

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: its hasNext() method will return false.

Java 8+ users: Use Streams.stream(iterator).max(thisComparator).get() instead (but note that it does not guarantee which tied maximum element is returned).

Parameters
iterator:Iterator<E>

the iterator whose maximum element is to be determined

Annotations
@Override
maxback to summary
public <E extends Comparable<?>> E max(Iterable<E> iterable)

Overrides com.google.common.collect.Ordering.max.

Doc from com.google.common.collect.Ordering.max.

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 a Collection, use Collections.max(collection, thisComparator) instead. Otherwise, use Streams.stream(iterable).max(thisComparator).get() instead. Note that these alternatives do not guarantee which tied maximum element is returned.

Parameters
iterable:Iterable<E>

the iterable whose maximum element is to be determined

Annotations
@Override
minback to summary
public <E extends Comparable<?>> E min(E a, E b)

Overrides com.google.common.collect.Ordering.min.

Doc from com.google.common.collect.Ordering.min.

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. If thisComparator is Ordering#natural, then use Comparators.min(a, b).

Parameters
a:E

value to compare, returned if less than or equal to b.

b:E

value to compare.

Annotations
@Override
minback to summary
public <E extends Comparable<?>> E min(E a, E b, E c, E... rest)

Overrides com.google.common.collect.Ordering.min.

Doc from com.google.common.collect.Ordering.min.

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).

Parameters
a:E

value to compare, returned if less than or equal to the rest.

b:E

value to compare

c:E

value to compare

rest:E[]

values to compare

Annotations
@Override
minback to summary
public <E extends Comparable<?>> E min(Iterator<E> iterator)

Overrides com.google.common.collect.Ordering.min.

Doc from com.google.common.collect.Ordering.min.

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: its hasNext() method will return false.

Java 8+ users: Use Streams.stream(iterator).min(thisComparator).get() instead (but note that it does not guarantee which tied minimum element is returned).

Parameters
iterator:Iterator<E>

the iterator whose minimum element is to be determined

Annotations
@Override
minback to summary
public <E extends Comparable<?>> E min(Iterable<E> iterable)

Overrides com.google.common.collect.Ordering.min.

Doc from com.google.common.collect.Ordering.min.

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 a Collection, use Collections.min(collection, thisComparator) instead. Otherwise, use Streams.stream(iterable).min(thisComparator).get() instead. Note that these alternatives do not guarantee which tied minimum element is returned.

Parameters
iterable:Iterable<E>

the iterable whose minimum element is to be determined

Annotations
@Override
readResolveback to summary
private Object readResolve()
reverseback to summary
public <S extends Comparable<?>> Ordering<S> reverse()

Overrides com.google.common.collect.Ordering.reverse.

Doc from com.google.common.collect.Ordering.reverse.

Returns the reverse of this ordering; the Ordering equivalent to Collections#reverseOrder(Comparator).

Java 8+ users: Use thisComparator.reversed() instead.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override