To sort the elements of the List in the reverse natural order of the strings, get a reverse Comparator from the Collections class with reverseOrder(). Then, pass the reverse Comparator to the sort() method.
List list = new ArrayList();
Comparator comp = Collections.reverseOrder();
Collections.sort(list, comp)
List list = new ArrayList();
Comparator comp = Collections.reverseOrder();
Collections.sort(list, comp)
No comments:
Post a Comment
Please Provide your feedback here