My need is to sort the ArrayList of Strings, based on specific index range. For example I have following items in list: ["abc", "xyz", "pqr" , "asd"]Now I want to sort this list from index 1 till last index.
One way As I think that I can create a sub-list from main list with desired index range, sort it and add the sub-list accordingly. But my question is:
Is there any API already available for that? Or any other faster way to achieve this.
You should do
Since the
List.subListmethod returns a view of the list, modifications done byCollections.sortwill affect the backing list as well.