I am using adding an object to a TreeSet. And I never use that in any Hash-based collection. I feel that the TreeSet need overriding of compareTo method equals method overriding is not required. Is it a good practice not to override equals method? If No then why equals method override is required as I will not be using it in Hash-based collection?
Update: javadoc says,
It is strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any class that implements the Comparable interface and violates this condition should clearly indicate this fact. The recommended language is "Note: this class has a natural ordering that is inconsistent with equals."
Honestly I did not understand the cause behind that strong recommendation of equals implementation.