Class AllEqualOrdering
- All Implemented Interfaces:
Serializable
,Comparator<Object>
-
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 AllEqualOrdering
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
<E> ImmutableList
<E> immutableSortedCopy
(Iterable<E> iterable) Returns an immutable list containingelements
sorted by this ordering.private Object
<S> Ordering
<S> reverse()
Returns the reverse of this ordering; theOrdering
equivalent toCollections.reverseOrder(Comparator)
.<E> List
<E> sortedCopy
(Iterable<E> iterable) Returns a mutable list containingelements
sorted by this ordering; use this only when the resulting list may need further modification, or may containnull
.toString()
Methods inherited from class com.google.common.collect.Ordering
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
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
-
AllEqualOrdering
AllEqualOrdering()
-
-
Method Details
-
compare
-
sortedCopy
Description copied from class:Ordering
Returns a mutable list containingelements
sorted by this ordering; use this only when the resulting list may need further modification, or may containnull
. 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 inelements
.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 callingCollections.sort(List)
.- Overrides:
sortedCopy
in classOrdering<Object>
-
immutableSortedCopy
Description copied from class:Ordering
Returns an immutable list containingelements
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 inelements
.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.
- Overrides:
immutableSortedCopy
in classOrdering<Object>
-
reverse
Description copied from class:Ordering
Returns the reverse of this ordering; theOrdering
equivalent toCollections.reverseOrder(Comparator)
.Java 8+ users: Use
thisComparator.reversed()
instead. -
readResolve
-
toString
-