Posts Tagged ‘compareto’
‘compareTo()’ is incompatible with ‘equals()’
If a class implements Comparable
, compareTo()
method must return zero if and only if equals()
returns true
for the same non-null argument (and vice versa). Violating this rule may cause unexpected behavior of the objects.