Package com.google.common.collect
Class NullsFirstOrdering<T>
java.lang.Object
com.google.common.collect.Ordering<T>
com.google.common.collect.NullsFirstOrdering<T>
- All Implemented Interfaces:
Serializable
,Comparator<T>
An ordering that treats
null
as less than all other values.-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.common.collect.Ordering
Ordering.ArbitraryOrdering, Ordering.IncomparableValueException
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate 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
boolean
int
hashCode()
Returns an ordering that treatsnull
as less than all other values and usesthis
to compare non-null values.Returns an ordering that treatsnull
as greater than all other values and uses this ordering to compare non-null values.reverse()
Returns the reverse of this ordering; theOrdering
equivalent toCollections.reverseOrder(Comparator)
.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, max, max, max, max, min, min, min, min, natural, onKeys, onResultOf, sortedCopy, usingToString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
ordering
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
NullsFirstOrdering
-
-
Method Details
-
compare
-
reverse
Description copied from class:Ordering
Returns the reverse of this ordering; theOrdering
equivalent toCollections.reverseOrder(Comparator)
.Java 8+ users: Use
thisComparator.reversed()
instead. -
nullsFirst
Description copied from class:Ordering
Returns an ordering that treatsnull
as less than all other values and usesthis
to compare non-null values.The returned object is serializable if this object is serializable.
Java 8+ users: Use
Comparator.nullsFirst(thisComparator)
instead.- Overrides:
nullsFirst
in classOrdering<T>
-
nullsLast
Description copied from class:Ordering
Returns an ordering that treatsnull
as greater than all other values and uses this ordering to compare non-null values.The returned object is serializable if this object is serializable.
Java 8+ users: Use
Comparator.nullsLast(thisComparator)
instead. -
equals
- Specified by:
equals
in interfaceComparator<T>
- Overrides:
equals
in classObject
-
hashCode
public int hashCode() -
toString
-