News

How Java’s compareTo() works. ... We had to override the compareTo() method twice for the same logic. If there were more elements we would have to replicate the logic for each object.