Monday, 20 July 2015

equals() method in Comparator Interface in java

Why there is equals() in Comparator Interface when it is already defined in Object class which is super class of all classes in Java??

The only reason that the equals() is defined again in the Comparator Interface is just to defined some different documentation of equals() in Comparator interface. The equals() method in Comparator interface has some extra documentation which is specific to Comparator functionality.

Have a look at the documentation of equals() method in Compartor interface here.


No comments:

Post a Comment