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

pack-priv final Class AllEqualOrdering

extends Ordering<@Nullable Object>
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Annotations
@GwtCompatible
serializable:true
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtCompatible, java.io.Serializable, java.util.List, javax.annotation.CheckForNull, org.checkerframework.checker.nullness.qual.Nullable

An ordering that treats all references as equals, even nulls.
Author
Emily Soldal

Field Summary

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

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public int
compare(Object
the first object to be compared.
left
,
Object
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> ImmutableList<E>
immutableSortedCopy(Iterable<E> iterable)

Overrides com.google.common.collect.Ordering.immutableSortedCopy.

Returns an immutable list containing elements sorted by this ordering.
private Object
public <S extends @Nullable Object> Ordering<S>
reverse()

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

Returns the reverse of this ordering; the Ordering equivalent to Collections#reverseOrder(Comparator).
public <E extends @Nullable Object> List<E>
sortedCopy(Iterable<E> iterable)

Overrides com.google.common.collect.Ordering.sortedCopy.

Returns a mutable list containing elements sorted by this ordering; use this only when the resulting list may need further modification, or may contain null.
public String
toString()

Overrides java.lang.Object.toString.

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

Field Detail

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

Constructor Detail

AllEqualOrderingback to summary
pack-priv AllEqualOrdering()

Method Detail

compareback to summary
public int compare(Object left, Object 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:Object

the first object to be compared.

right:Object

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
immutableSortedCopyback to summary
public <E> ImmutableList<E> immutableSortedCopy(Iterable<E> iterable)

Overrides com.google.common.collect.Ordering.immutableSortedCopy.

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

Returns an immutable list containing elements sorted by this ordering. The input is not modified.

Unlike Sets#newTreeSet(Iterable), this method does not discard elements that are duplicates according to the comparator. The sort performed is stable, meaning that such elements will appear in the returned list in the same order they appeared in elements.

Performance note: According to our benchmarking on Open JDK 7, this method is the most efficient way to make a sorted copy of a collection.

Annotations
@Override
readResolveback to summary
private Object readResolve()
reverseback to summary
public <S extends @Nullable Object> 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
@SuppressWarnings:unchecked
@Override
sortedCopyback to summary
public <E extends @Nullable Object> List<E> sortedCopy(Iterable<E> iterable)

Overrides com.google.common.collect.Ordering.sortedCopy.

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

Returns a mutable list containing elements sorted by this ordering; use this only when the resulting list may need further modification, or may contain null. The input is not modified. The returned list is serializable and has random access.

Unlike Sets#newTreeSet(Iterable), this method does not discard elements that are duplicates according to the comparator. The sort performed is stable, meaning that such elements will appear in the returned list in the same order they appeared in elements.

Performance note: According to our benchmarking on Open JDK 7, immutableSortedCopy generally performs better (in both time and space) than this method, and this method in turn generally performs better than copying the list and calling Collections#sort(List).

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