why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

why?

What is the need of implementing comparator interface which consist of compare method which we implement in our own way..then it is just a concept only..we r not getting anything in build

7th May 2017, 7:36 PM
Somnath Ghosh
Somnath Ghosh - avatar
1 Answer
+ 1
The language designers cannot foresee what types the programmers will be dealing with and comparing with each other. So an interface for comparing provides a GCD in the form of a compare method. One programmer might be comparing smartphone while another may be interested in working out the most cost effective route from a source to destination.
7th May 2017, 9:02 PM
Venkatesh Pitta
Venkatesh Pitta - avatar