public class JDK5Utils
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
private |
JDK5Utils()
Private constructor that should never be called since this is a static
utility class.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> T[] |
Arrays_copyOf(T[] original,
int newLength)
Copies the specified array, truncating or padding with nulls (if necessary)
so the copy has the specified length.
|
static <T,U> T[] |
Arrays_copyOf(U[] original,
int newLength,
java.lang.Class<? extends T[]> newType)
Copies the specified array, truncating or padding with nulls (if necessary)
so the copy has the specified length.
|
private JDK5Utils()
public static <T> T[] Arrays_copyOf(T[] original,
int newLength)
original - the array to be copiednewLength - the length of the copy to be returnedjava.lang.NegativeArraySizeException - if newLength is negativejava.lang.NullPointerException - if original is nullpublic static <T,U> T[] Arrays_copyOf(U[] original,
int newLength,
java.lang.Class<? extends T[]> newType)
original - the array to be copiednewLength - the length of the copy to be returnednewType - the class of the copy to be returnedjava.lang.NegativeArraySizeException - if newLength is negativejava.lang.NullPointerException - if original is nulljava.lang.ArrayStoreException - if an element copied from
original is not of a runtime type that can be stored in
an array of class newType