Java Array Copy copyOf(T[] original)

Here you can find the source of copyOf(T[] original)

Description

copy Of

License

Open Source License

Declaration

public static <T> T[] copyOf(T[] original) 

Method Source Code

//package com.java2s;
/**/*w  w  w.  j  a  v a2 s. c  o  m*/
 * ====================================================================
 * UPA (Unstructured Persistence API)
 * Yet another ORM Framework
 * ++++++++++++++++++++++++++++++++++
 * Unstructured Persistence API, referred to as UPA, is a genuine effort
 * to raise programming language frameworks managing relational data in
 * applications using Java Platform, Standard Edition and Java Platform,
 * Enterprise Edition and Dot Net Framework equally to the next level of
 * handling ORM for mutable data structures. UPA is intended to provide
 * a solid reflection mechanisms to the mapped data structures while
 * affording to make changes at runtime of those data structures.
 * Besides, UPA has learned considerably of the leading ORM
 * (JPA, Hibernate/NHibernate, MyBatis and Entity Framework to name a few)
 * failures to satisfy very common even known to be trivial requirement in
 * enterprise applications.
 * <p>
 * Copyright (C) 2014-2015 Taha BEN SALAH
 * <p>
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 * <p>
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * <p>
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 51
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 * ====================================================================
 */

import java.util.Arrays;

public class Main {
    public static <T> T[] copyOf(T[] original) {
        if (original == null) {
            return null;
        }
        return (T[]) Arrays.copyOf(original, original.length, original.getClass());
    }
}

Related

  1. copyOf(boolean[] t)
  2. copyOf(final U[] original, final int newLength, final Class newType)
  3. copyOf(T[] array)
  4. copyOf(T[] array, int count)
  5. copyOf(T[] original)
  6. copyOfBytes(final byte[] bytes)
  7. copyOfRange(U[] original, int from, int to, Class newType)
  8. copyStringArray(String[] str, int startingPos)
  9. getArrayCopy(byte[] array)