Here you can find the source of reverse(List
Parameter | Description |
---|---|
list | list of String |
public static List<String> reverse(List<String> list)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { /**//from w w w . j a va 2 s .c om * Create a new instance of list which has elements in reverse order * @param list list of String * @return reversed list */ public static List<String> reverse(List<String> list) { List<String> reversedList = new ArrayList<String>(list); Collections.reverse(reversedList); return reversedList; } }