Java Collections Java Java API
java.util.Collections
public static void reverse(List<?> list)
Reverses the order of the elements in the specified list.
package com.logicbig.example.collections;import java.util.Arrays;import java.util.Collections;import java.util.List;public class ReverseExample { public static void main(String... args) { List<String> list = Arrays.asList("one", "two", "three", "tour"); Collections.reverse(list); System.out.println(list); }}
[tour, three, two, one]