Package io.deephaven.util.compare
Class ObjectComparisons
java.lang.Object
io.deephaven.util.compare.ObjectComparisons
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intCompares two Objects according to the following rules:nullis less than all other values Otherwise,Comparable.compareTo(Object)is usedstatic booleanCompare two Objects for equality consistent withcompare(Object, Object); that iscompare(lhs, rhs) == 0 ⇒ eq(lhs, rhs)andcompare(lhs, rhs) != 0 ⇒ !eq(lhs, rhs).static booleanLogically equivalent tocompare(lhs, rhs) >= 0.static booleanLogically equivalent tocompare(lhs, rhs) > 0.static intReturns a hash code for anObjectvalue consistent witheq(Object, Object); that is,eq(x, y) ⇒ hashCode(x) == hashCode(y).static booleanLogically equivalent tocompare(lhs, rhs) <= 0.static booleanLogically equivalent tocompare(lhs, rhs) < 0.
-
Constructor Details
-
ObjectComparisons
public ObjectComparisons()
-
-
Method Details
-
compare
Compares two Objects according to the following rules:nullis less than all other values- Otherwise,
Comparable.compareTo(Object)is used
- Parameters:
lhs- the first valuerhs- the second value- Returns:
- the value
0iflhsis equal torhs; a value less than0iflhsis less thanrhs; and a value greater than0iflhsis greater thanrhs
-
eq
Compare two Objects for equality consistent withcompare(Object, Object); that iscompare(lhs, rhs) == 0 ⇒ eq(lhs, rhs)andcompare(lhs, rhs) != 0 ⇒ !eq(lhs, rhs).Logically equivalent to
compare(lhs, rhs) == 0.- Parameters:
lhs- the first valuerhs- the second value- Returns:
trueif the values are equal,falseotherwise
-
hashCode
Returns a hash code for anObjectvalue consistent witheq(Object, Object); that is,eq(x, y) ⇒ hashCode(x) == hashCode(y).- Parameters:
x- the value to hash- Returns:
- a hash code value for an
Objectvalue
-
gt
Logically equivalent tocompare(lhs, rhs) > 0.- Parameters:
lhs- the first valuerhs- the second value- Returns:
trueifflhsis greater thanrhs
-
lt
Logically equivalent tocompare(lhs, rhs) < 0.- Parameters:
lhs- the first valuerhs- the second value- Returns:
trueifflhsis less thanrhs
-
geq
Logically equivalent tocompare(lhs, rhs) >= 0.- Parameters:
lhs- the first valuerhs- the second value- Returns:
trueifflhsis greater than or equal torhs
-
leq
Logically equivalent tocompare(lhs, rhs) <= 0.- Parameters:
lhs- the first valuerhs- the second value- Returns:
trueifflhsis less than or equal torhs
-