While using the Collections.sort method,I know that one-arg sort method takes only the list whose items are comparable.But,does the two arg sort method also requires that
the list items must be comparable.But then,if it is so,what about this text in K&B.
You must modify the class whose
instances you want to sort.
You build a class separate from the class whose instances you
want to sort.
If the two-arg sort method also takes a comparable list as its arguement,again we will have to modify the class whose objects we wish to compare,but what if we don't have access to the class?
Please pardon if I've put up a silly question and help me out.
yes,i am sorry,it takes a comparator.
This "modification" of class,what does it mean?Does it mean the modification of the compareTo() method to perform different kinds of sorting ?and do the list argument contents needs to be comparable?