Java Utililty Methods List Reverse

List of utility methods to do List Reverse

Description

The list of methods to do List Reverse are organized into topic(s).

Method

Listreverse(List list)
Method to reverse the list
if (list != null && list.size() > 0) {
    List<T> updatedList = new ArrayList<>();
    for (int i = list.size() - 1; i >= 0; i--) {
        updatedList.add(list.get(i));
    return updatedList;
return null;
...
Listreverse(List list)
Return a new list with the keys reversed.
List newList = list(list.size());
for (int i = list.size() - 1; i >= 0; i--) {
    newList.add(list.get(i));
return newList;
Listreverse(List list)
reverse
int size = list.size();
for (int i = 0; i < size; i++) {
    int ih = i;
    int it = size - 1 - i;
    if (ih == it || ih > it) {
        break;
    T ah = list.get(ih);
...
Listreverse(List list)
Reverse the given list and returns it.
Collections.reverse(list);
return list;
Listreverse(List list)
reverse
List<T> result = new ArrayList<T>(list.size());
ListIterator<T> it = list.listIterator(list.size());
while (it.hasPrevious()) {
    result.add(it.previous());
return result;
voidreverse(List src, List dst)
It copies list src onto dst in reversed order, eventually clearing the destination list dst beforehand.
if (!dst.isEmpty())
    dst.clear();
ListIterator<T> lstIt = src.listIterator(src.size());
while (lstIt.hasPrevious()) {
    dst.add(lstIt.previous());
Listreverse(List xs)
reverse
for (int i = 0; i < xs.size() / 2; i++) {
    T temp = xs.get(i);
    xs.set(i, xs.get(xs.size() - i - 1));
    xs.set(xs.size() - i - 1, temp);
return xs;
Listreverse(List l)
Reverse the given list and return a reference to it
Collections.reverse(l);
return l;
ArrayListreverseCopy(Iterable list)
reverse Copy
ArrayList<T> result = new ArrayList<T>();
for (T item : list) {
    result.add(0, item);
return result;
ListreverseCopy(List list)
Return a copy of the list, in reverse order.
List res = new ArrayList(list);
Collections.reverse(res);
return res;