The Collections class lives in java.util and provides static methods that operate on lists. To sort an ArrayList in ascending order:
import java.util.Collections;
ArrayList<Integer> nums = new ArrayList<>();
nums.add(30);
nums.add(10);
nums.add(20);
Collections.sort(nums);
System.out.println(nums); // [10, 20, 30]
This sorts the list in place. It does not return a new list. The sort uses a modified merge sort that runs in time and space.
For String elements, the sort uses alphabetical order. For your own custom objects, you would need to implement the Comparable interface, which is a topic for a later section on interfaces.