posted 16 years ago
Hi ranchers,
interface Comparable is used when you have access to the class and you can implement it.
interface Comparator can be used, when you want to sort any class.
You set up a Comparator for any item you want to sort.
If you want to use generics, the name of the class to be sorted goes into the < >.
Here's an example, to compare the legs of animals.
Write your own comparators using that scheme (e.g. to sort the animals name or to sort your pojos).
Yours,
Bu.
all events occur in real time