Java List Reverse reverseList2(List list)

Here you can find the source of reverseList2(List list)

Description

reverse List

License

Apache License

Declaration

public static <T> List<T> reverseList2(List<T> list) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;

import java.util.Iterator;
import java.util.List;

public class Main {
    public static <T> List<T> reverseList2(List<T> list) {

        List<T> revList = new ArrayList<T>();

        for (Iterator<T> iterator = list.iterator(); iterator.hasNext();) {
            T n = iterator.next();//  ww w.j a va2  s  .  com
            revList.add(0, n);
        }

        return revList;
    }
}

Related

  1. reverseIterator(ListIterator iterator)
  2. reverseList(final List list)
  3. reverseList(List list)
  4. reverseList(List list)
  5. reverseList(List list, boolean shallowCopy)
  6. reverseListShallowCopy(List list)
  7. reverseOrder(List list)
  8. reversePath(List pathParts)
  9. reversePermutation(final List permutation)