Rajeev Trikha wrote:Sean, whenever your Comparator is invoked it is going to reverse the collection because of the line return b.compareTo(a) If ascending order is required then a.compareTo(b) will be used.
Henry Wong wrote:
Sean Lim wrote:
How does the compare() method determine which strings it uses as a, and as b?
It doesn't. It is the sorting algorithm that determines which elements that it needs to compare -- and that is algorithm dependent.