JavaAntiPatterns

Collection of bad coding practices

Posts Tagged ‘compareto

‘compareTo()’ is incompatible with ‘equals()’

with one comment

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.

Read the rest of this entry »

Advertisements

Written by Alex

November 22, 2007 at 1:53 pm

Posted in Objects

Tagged with , ,