i have done this by doing a toArray() on the linked list and then using compareto() for every element in the array, can this be done without using arrays? can i sort this ArrayList of strings only using the Collection class methods?
Originally posted by Shraddha Jain: oh yes! tried this now. but i see there's a method sort(list l ,Comparator c) can i specify how i want sort() to compare objects in the arraylist? using this method?
Collection.sort(List list)will sort in natural order. sort(List list, Comparator c), The the comparator to determine the order of the list.All elements in the list must be mutually comparable.