There are three static reverse-related, and one rotate-related, methods in the class Collections:
- void reverse(List<?> list): Reverses the current order of elements
- void rotate(List<?> list, int distance) : Rotates the order of the elements by moving each of them to the right for the specified number of positions (distance)
- Comparator<T> reverseOrder(): Returns a comparator that creates an order that is the reverse of the natural ordering; applies only to elements that implement the Comparable interface
- Comparator<T> reverseOrder(Comparator<T> comparator): Returns a comparator that reverses the order defined by the passed-in comparator
And here is the code that demonstrates the listed methods:
Person p1 = new Person( ...