Java List Reverse reverse(List list)

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

Description

reverse

License

Apache License

Declaration

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

Method Source Code

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

import java.util.*;

public class Main {

    public static <T> List<T> reverse(List<T> list) {
        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;
            }/*from  www. j  ava 2 s . c o m*/
            T ah = list.get(ih);
            T swap = list.get(it);
            list.set(ih, swap);
            list.set(it, ah);
        }
        return list;
    }
}

Related

  1. reverse(List a)
  2. reverse(List l)
  3. reverse(List list)
  4. reverse(List list)
  5. reverse(List list)
  6. reverse(List list)
  7. reverse(List list)
  8. reverse(List src, List dst)
  9. reverse(List xs)