Java Array Reverse reverse(T[] array)

Here you can find the source of reverse(T[] array)

Description

reverse

License

Open Source License

Declaration

@SuppressWarnings("unchecked")
    public static <T> T[] reverse(T[] array) 

Method Source Code

//package com.java2s;
/**/*from  w  w  w.  ja  v a 2  s  .  com*/
 * Aptana Studio
 * Copyright (c) 2005-2011 by Appcelerator, Inc. All Rights Reserved.
 * Licensed under the terms of the GNU Public License (GPL) v3 (with exceptions).
 * Please see the license.html included with this distribution for details.
 * Any modifications to this file must keep this entire header intact.
 */

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Main {
    @SuppressWarnings("unchecked")
    public static <T> T[] reverse(T[] array) {
        List<T> list = Arrays.asList(array);
        Collections.reverse(list);
        return (T[]) list.toArray();
    }
}

Related

  1. arrayReverse(T[] array)
  2. ArraysReverse(byte[] array)
  3. getReverseOffsets(long fileLength, long position, byte[] buffer, int size)
  4. reverse(T[] array)
  5. reverse(T[] array)
  6. reverse(T[] array)
  7. reverse(T[] array)
  8. reverse(T[] originalArray)
  9. reverseArray(final T[] arr)