Here you can find the source of copyOf(final U[] original, final int newLength, final Class extends T[]> newType)
Parameter | Description |
---|---|
T | the generic type |
U | the generic type |
original | the original |
newLength | the new length |
newType | the new type |
public static <T, U> T[] copyOf(final U[] original, final int newLength, final Class<? extends T[]> newType)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; public class Main { /**// w w w . jav a 2s . co m * Copy of. * * @param <T> * the generic type * @param <U> * the generic type * @param original * the original * @param newLength * the new length * @param newType * the new type * @return the t[] */ // object[] -> string[] // String[] stringArray = Arrays.copyOf(objectArray, objectArray.length, // String[].class); // Arrays.asList(Object_Array).toArray(new String[Object_Array.length]); public static <T, U> T[] copyOf(final U[] original, final int newLength, final Class<? extends T[]> newType) { return Arrays.copyOf(original, newLength, newType); } }