Collections.sort(testList);
Collections.reverse(testList);

That will do what you want. Remember to import Collections though!

Here is the documentation for Collections.

Answer from tckmn on Stack Overflow
🌐
W3Schools
w3schools.com › Java › java_sort_list.asp
Java Sort a List - List Sorting
Sort a Java list alphabetically or numerically with Collections.sort().
🌐
Medium
medium.com › @AlexanderObregon › sorting-lists-in-java-using-collections-sort-14b150ac8682
Sorting Lists in Java Using Collections.sort | Medium
June 4, 2025 - Sorting is a basic task in any programming language, but the way it’s done can reveal a lot about how things work behind the scenes. Java provides several tools for sorting, but one of the most commonly used is Collections.sort(). It works with lists of numbers, strings, or even custom objects when you provide it with a way to compare them.
🌐
GeeksforGeeks
geeksforgeeks.org › java › collections-sort-java-examples
Collections.sort() in Java with Examples - GeeksforGeeks
The Collections.sort() method in Java is used to sort elements of a List in ascending order. It is part of the java.util.Collections class and works with List implementations like ArrayList and LinkedList.
Published: April 30, 2026
🌐
freeCodeCamp
freecodecamp.org › news › how-to-sort-a-list-in-java
How to Sort a List in Java – Java List Sorting Example
January 24, 2023 - One of the most common ways to sort data in Java is to use the Collections.sort() method. It sorts a list in ascending order by default.
🌐
Sentry
sentry.io › sentry answers › java › how to sort a list in java?
Sort a List in Java Using Collections, Comparator, or Stream | Sentry
3 weeks ago - If you want to change the ordering of your sort, use the overloaded sort(List<T> list, Comparator<? super T> c) method and provide a comparator: import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; public class Example { public static void main(String[] args) { List<Integer> test = new ArrayList<>(Arrays.asList(8, 6, 3, 7, 2)); Collections.sort(test, Comparator.reverseOrder()); for (Integer i : test) { System.out.print(i); } } }
🌐
DigitalOcean
digitalocean.com › community › tutorials › java-sort-list
How to Sort a List in Java | DigitalOcean
Technical tutorials, Q&A, events — This is an inclusive place where developers can find or lend support and discover new ways to contribute to the community.
🌐
Medium
medium.com › @samrat.alam › default-library-sorting-in-java-list-set-and-map-42e9f172d86b
Default Library Sorting in Java: List, Set, and Map | by Samrat Alam | Medium
November 28, 2025 - List<Map.Entry<String, Integer>> entries = new ArrayList<>(map.entrySet()); entries.sort(Map.Entry.comparingByValue()); //ascending entries.sort(Map.Entry.comparingByValue(Comparator.reverseOrder())); //descending for (Map.Entry<String,Integer> ...
Find elsewhere
🌐
CodeGym
codegym.cc › java blog › java collections › how to sort a list in java
How to Sort a List in Java
January 8, 2025 - There are several ways to sort a list in Java. The most common (and logical!) way is to use the Collections.sort() method. This method sorts the elements of a list in ascending order by default.
🌐
DEV Community
dev.to › satyam_gupta_0d1ff2152dcc › master-java-list-sorting-a-2025-guide-to-collectionssort-comparators-more-3b52
Master Java List Sorting: A 2025 Guide to Collections.sort(), Comparators & More - DEV Community
October 26, 2025 - Before we sort, we need to know what we're dealing with. In Java, a List is like a dynamic, stretchy array. It's an ordered collection (meaning sequence matters) that can hold duplicates.
🌐
Baeldung
baeldung.com › home › java › java list › why there is no sorted list in java?
Why There Is No Sorted List in Java? | Baeldung
March 7, 2025 - In this article, we’ve seen that the absence of a built-in sorted list implementation in Java’s collection framework is a thoughtful decision that upholds the List interface contract.
🌐
Java67
java67.com › 2021 › 09 › 3-ways-to-sort-list-in-java-8-and-11.html
3 ways to sort a List in Java 8 and 11 - Example Tutorial | Java67
... There are multiple ways to sort a list in Java 8, for example, you can get a stream from the List and then use the sorted() method of Stream class to sort a list like ArrayList, LinkedList, or Vector and then convert back it to List.
🌐
GitHub
gist.github.com › SheldonWangRJT › cdd2c1d0bfe092dea30a3e929aba325f
How to sort a List<Object> in JAVA in the best way? · GitHub
Collections.sort(list, new Comparator<Student>() { @Override public int compare(Student o1, Student o2) { return o1.getAge().compareTo(o2.getAge()); } });
🌐
W3Schools
w3schools.com › java › ref_arraylist_sort.asp
Java ArrayList sort() Method
The sort() method sorts items in the list. A Comparator can be used to compare pairs of elements.
🌐
CodeJava
codejava.net › java-core › collections › sorting-list-collections-examples
Java Sort List Collections Examples
[Master REST API Development and Java and Spring Boot] In Java, it’s pretty easy to sort elements in a list collection using the Collections.sort() static utility method.
🌐
JanBask Training
janbasktraining.com › community › java › how-to-sort-a-listarraylist
How to sort a List/ArrayList? | JanBask Training Community
May 21, 2025 - Whether you want to sort numbers, strings, or custom objects, Java has you covered. ... The simplest way to sort a List or ArrayList is by using the static method Collections.sort().
🌐
Medium
medium.com › @rmg007 › how-to-sort-a-list-in-java-732baf528e0
How to sort a list in Java. Sorting a list in Java using the… | by Ryan Gonzalez | Medium
October 16, 2022 - ArrayList class is the most used class in the collections framework for multiple reasons: Maintains Insertion Order. ... The List interface has the method sort that takes a Comparator.
🌐
Baeldung
baeldung.com › home › java › java collections › sorting in java
Sorting in Java | Baeldung
February 3, 2026 - Java 8 comes with two new APIs useful for sorting – comparing() and thenComparing() in the Comparator interface. These are quite handy for the chaining of multiple conditions of the Comparator. Let’s consider a scenario where we may want to compare Employee by age and then by name: @Test public void givenArrayObjects_whenUsingComparing_thenSortedArrayObjects() { List<Employee> employeesList = Arrays.asList(employees); employees.sort(Comparator.comparing(Employee::getAge)); assertTrue(Arrays.toString(employees.toArray()) .equals(sortedArrayString)); }
🌐
Vultr
docs.vultr.com › java › standard library › java › util › arraylist › sort()
Java ArrayList sort() - Order Elements
November 15, 2024 - The sort() method in Java's ArrayList class is a versatile tool for organizing elements in a specified order, whether ascending, descending, or by a custom-defined criteria.