M
Myriam Abramson
I have:
Vector<MyClass> v = new Vector<MyClass>();
Collections.sort(v);
Now, MyClass implements Comparable but Collections.sort seems to
ignore it. I would think that the order coded in the compareTo method
in MyClass would be the natural order of instances of this class, no?
I had to create a Comparator class to tell Collections.sort how to
sort correctly. Why having those annotations if they are not picked up
correctly? Again I have Java 1.5. Thanks for any insights.
myriam
Vector<MyClass> v = new Vector<MyClass>();
Collections.sort(v);
Now, MyClass implements Comparable but Collections.sort seems to
ignore it. I would think that the order coded in the compareTo method
in MyClass would be the natural order of instances of this class, no?
I had to create a Comparator class to tell Collections.sort how to
sort correctly. Why having those annotations if they are not picked up
correctly? Again I have Java 1.5. Thanks for any insights.
myriam