Hi,
Q.No 23 of Test6 in enthuware, (its a DnD so, I couldn't copy and paste it here..)
gives an explanation like this regarding the natural ordering for strings:
3. Collections.sort(collection) method sorts the elements of the given collection in the natural order of it elements. Natural order means: as governed by the compareTo() method of the elements. I case of String elements, the natural order is: space < lower case < upper case. Here, the output is expected to be in reverse order, therefore, we need a reverse order Comparator. Collections.reverseOrder() returns such a comparator.
and the answer for the question too was based on this..
But isn't it:
space < upper case < lower case ?
Thanks,
Vishwa.
[ January 20, 2008: Message edited by: Vishwanath Murthi ]