An article takes you to a deeper understanding of Comparable and Comparator

Whenever a sort sensitive class is implemented, it should implement the Comparable interface so that its instances can be easily classified, searched, and used in comparison based collections Whenever you compare field values in the comparTo method, you should avoid using the < and > operators. Instead, you should use the static compare ...

Posted by jerry_louise on Fri, 29 Oct 2021 06:11:43 +0200