Package io.deephaven.util.compare
Class ObjectComparisons
java.lang.Object
io.deephaven.util.compare.ObjectComparisons
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
Compares two Objects according to the following rules:null
is less than all other values Otherwise,Comparable.compareTo(Object)
is usedstatic boolean
Compare two Objects for equality consistent withcompare(Object, Object)
; that iscompare(lhs, rhs) == 0 ⇒ eq(lhs, rhs)
andcompare(lhs, rhs) != 0 ⇒ !eq(lhs, rhs)
.static boolean
Logically equivalent tocompare(lhs, rhs) >= 0
.static boolean
Logically equivalent tocompare(lhs, rhs) > 0
.static int
Returns a hash code for anObject
value consistent witheq(Object, Object)
; that is,eq(x, y) ⇒ hashCode(x) == hashCode(y)
.static boolean
Logically equivalent tocompare(lhs, rhs) <= 0
.static boolean
Logically equivalent tocompare(lhs, rhs) < 0
.
-
Constructor Details
-
ObjectComparisons
public ObjectComparisons()
-
-
Method Details
-
compare
Compares two Objects according to the following rules:null
is less than all other values- Otherwise,
Comparable.compareTo(Object)
is used
- Parameters:
lhs
- the first valuerhs
- the second value- Returns:
- the value
0
iflhs
is equal torhs
; a value less than0
iflhs
is less thanrhs
; and a value greater than0
iflhs
is 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:
true
if the values are equal,false
otherwise
-
hashCode
Returns a hash code for anObject
value 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
Object
value
-
gt
Logically equivalent tocompare(lhs, rhs) > 0
.- Parameters:
lhs
- the first valuerhs
- the second value- Returns:
true
ifflhs
is greater thanrhs
-
lt
Logically equivalent tocompare(lhs, rhs) < 0
.- Parameters:
lhs
- the first valuerhs
- the second value- Returns:
true
ifflhs
is less thanrhs
-
geq
Logically equivalent tocompare(lhs, rhs) >= 0
.- Parameters:
lhs
- the first valuerhs
- the second value- Returns:
true
ifflhs
is greater than or equal torhs
-
leq
Logically equivalent tocompare(lhs, rhs) <= 0
.- Parameters:
lhs
- the first valuerhs
- the second value- Returns:
true
ifflhs
is less than or equal torhs
-