final class AllEqualOrdering extends Ordering<java.lang.Object> implements java.io.Serializable
Ordering.ArbitraryOrdering, Ordering.IncomparableValueException
Modifier and Type | Field and Description |
---|---|
(package private) static AllEqualOrdering |
INSTANCE |
private static long |
serialVersionUID |
LEFT_IS_GREATER, RIGHT_IS_GREATER
Constructor and Description |
---|
AllEqualOrdering() |
Modifier and Type | Method and Description |
---|---|
int |
compare(java.lang.Object left,
java.lang.Object right) |
<E> ImmutableList<E> |
immutableSortedCopy(java.lang.Iterable<E> iterable)
Returns an immutable list containing
elements sorted by this ordering. |
private java.lang.Object |
readResolve() |
<S> Ordering<S> |
reverse()
Returns the reverse of this ordering; the
Ordering equivalent to Collections.reverseOrder(Comparator) . |
<E> java.util.List<E> |
sortedCopy(java.lang.Iterable<E> iterable)
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 . |
java.lang.String |
toString() |
allEqual, arbitrary, binarySearch, compound, compound, explicit, explicit, from, from, greatestOf, greatestOf, isOrdered, isStrictlyOrdered, leastOf, leastOf, lexicographical, max, max, max, max, min, min, min, min, natural, nullsFirst, nullsLast, onKeys, onResultOf, usingToString
static final AllEqualOrdering INSTANCE
private static final long serialVersionUID
public int compare(@CheckForNull java.lang.Object left, @CheckForNull java.lang.Object right)
public <E> java.util.List<E> sortedCopy(java.lang.Iterable<E> iterable)
Ordering
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, Ordering.immutableSortedCopy(java.lang.Iterable<E>)
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)
.
sortedCopy
in class Ordering<java.lang.Object>
public <E> ImmutableList<E> immutableSortedCopy(java.lang.Iterable<E> iterable)
Ordering
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.
immutableSortedCopy
in class Ordering<java.lang.Object>
public <S> Ordering<S> reverse()
Ordering
Ordering
equivalent to Collections.reverseOrder(Comparator)
.
Java 8 users: Use thisComparator.reversed()
instead.
private java.lang.Object readResolve()
public java.lang.String toString()
toString
in class java.lang.Object