|
kobogian hitis You're right, the ordering is wrong. On the other hand, return c2.getName().compareTo(c1.getName()) works only by chance. If we change SubFoo to ASubFoo it does not work either.
I think the problem is the comparator does not deal with the fact that the relation must be transitive. So if compare(Foo,Baz) == 0 and compare(Baz,SubFoo) == 0, then the sorting algorithm may assume compare(Foo,SubFoo) == 0 which is not true.
|