the data in the list is something like this
I want the data to be
I am not able to use Collections.sort(listOfLists)
Any help is greatly appreciated.
Thanks in advance.
Since you want to sort the lists based on the 1st String they contain (at least, this is my understanding), have a class implement Comparator<List<String>> as Christophe has suggested, in its method extract the 1st item from each list, and (since Strings are Comparable) just invoke Be sure to handle the case when either of the lists is empty.