The main difference between Comparator and Comparable in Java is that Comparable is an interface that defines the natural order of objects based on their own properties, while Comparator is an interface that defines an external order of objects based on a specified key.
Here are some more specific differences between Comparator and Comparable:
No comments:
Post a Comment