| Author |
What is the difference between Comparator and Comparable
|
Hemant Agarwal
Ranch Hand
Joined: Nov 21, 2005
Posts: 138
|
|
What is the difference between Comparator and Comparable?
|
 |
Renato Losio
Ranch Hand
Joined: Nov 23, 2005
Posts: 99
|
|
A detailed explanation (with examples) on ONJava Extract from the article: Implementing the Comparable interface enables you to define one way to compare instances of your class. However, objects are sometimes comparable in many ways. For example, two Person objects may need to be compared by age or by last/first name. In cases like this, create a Comparator that defines how to compare two objects. To make objects comparable in two ways, then you need two comparators.
|
Renato Losio - www.arsenio.it - renatoweb@arsenio.it
|
 |
Sri Ram
Ranch Hand
Joined: Oct 03, 2005
Posts: 118
|
|
U can get the details from here
|
 |
 |
|
|
subject: What is the difference between Comparator and Comparable
|
|
|