Klitos Kyriacou
04/08/2025, 4:27 PM<
, <=
>=
and >
which all call compareTo
but they all check for inequalities. Would there be any interest in a special operator, <==>
, with the semantics that a <==> b
is equivalent to a.compareTo(b) == 0
? Let's call it the "extended spaceship operator" since the normal spaceship operator <=>
is already well-known in other languages and has different semantics (it returns an integer). The use case is when comparing BigDecimals
for value equality (where a == b
is not what is wanted because it includes scale).Sam
04/08/2025, 5:03 PM