This question already has an answer here:
Why Java provides two different interfaces(Comparable/Comparator) to compare objects . Better It can go with only one. Right? I mean instead of proving a new interface(Comparator) to compare objects with multiple attribute, Java can simply extended "Comparable" interface to achieve the "Comparator" interface logic. Am I correct? . Please let me know , is there any specific reason for this.
Aucun commentaire:
Enregistrer un commentaire