Android List Reverse reverse(List list)

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

Description

reverse

License

Open Source License

Declaration

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

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import java.util.List;

public class Main {

    public static <T> List<T> reverse(List<T> list) {
        List<T> tmp = new ArrayList<T>(list);
        list.clear();/*from  w w  w  .j  ava  2 s .  c  om*/
        for (int index = tmp.size() - 1; index >= 0; index--) {
            list.add(tmp.get(index));
        }
        return list;
    }
}

Related

  1. invertList(List list)
  2. reverse(List list, final int begin, final int end)