Java List Reverse reverseList(List list)

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

Description

reverse List

License

Open Source License

Declaration

public static List reverseList(List list) 

Method Source Code

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

import java.util.List;

public class Main {

    public static List reverseList(List list) {
        if (list == null || list.size() == 0) {
            return list;
        }/*from w w w .j  a  va 2 s. c  om*/
        int count = list.size() - 1;
        Object obj = null;
        for (int i = 0; i <= count / 2; i++) {
            obj = list.get(i);
            list.set(i, list.get(count - i));
            list.set(count - i, obj);
        }
        return list;
    }
}

Related

  1. reverseIterable(final List list)
  2. reverseIterator(final List list)
  3. reverseIterator(List list)
  4. reverseIterator(ListIterator iterator)
  5. reverseList(final List list)
  6. reverseList(List list)
  7. reverseList(List list, boolean shallowCopy)
  8. reverseList2(List list)
  9. reverseListShallowCopy(List list)