Why compareTo () should be consistent to equals () method in Java?

2) CompareTo must be in consistent with equals method e.g. if two objects are equal via equals() , there compareTo() must return zero otherwise if those objects are stored in SortedSet or SortedMap they will not behave properly .

Sizin İçin Seçtik  Does Apple use server side Swift?

Leave a Reply

Your email address will not be published. Required fields are marked *

Why compareTo () should be consistent to equals () method in Java?

2) CompareTo must be in consistent with equals method e.g. if two objects are equal via equals() , there compareTo() must return zero otherwise if those objects are stored in SortedSet or SortedMap they will not behave properly .

Sizin İçin Seçtik  9 sınıfta sadece matematikten kalırsak ne olur?

Leave a Reply

Your email address will not be published. Required fields are marked *