Java Utililty Methods Array Range Copy

List of utility methods to do Array Range Copy

Description

The list of methods to do Array Range Copy are organized into topic(s).

Method

int[]copyOf(int[] old, int length)
Identical to Arrays.copyOf , but GWT compatible.
int[] newArray = new int[length];
int minLength = Math.min(old.length, length);
System.arraycopy(old, 0, newArray, 0, minLength);
return newArray;
int[]copyOf(int[] source, int length)
Copy an array of ints by creating a new instance and copying every elements from 0.
int[] dest = new int[length];
System.arraycopy(source, 0, dest, 0, length);
return dest;
int[]copyOf(int[] src, int size)
copy Of
int[] dst = new int[size];
System.arraycopy(src, 0, dst, 0, Math.min(src.length, size));
return dst;
int[][]copyOf(int[][] pixels)
copy Of
int[][] copy;
if (pixels == null) {
    copy = null;
} else {
    int w = pixels.length;
    if (w == 0) {
        copy = new int[0][];
    } else {
...
Integer[]copyOf(Integer[] original)
copy Of
int len = original.length;
Integer[] copy = new Integer[len];
System.arraycopy(original, 0, copy, 0, len);
return copy;
ObjectcopyOf(Object src, int newLength)
copy Of
Object copy = newArray(src, newLength);
transfer(src, 0, copy, 0, Math.min(length(src), newLength));
return copy;
Object[]copyOf(Object[] array, int newLength)
copy Of
final Object[] copy = new Object[newLength];
System.arraycopy(array, 0, copy, 0, Math.min(array.length, newLength));
return copy;
Object[]copyOf(Object[] values, int nlen)
Create a copy of the specified Object[] array, with the specified new length.
Object[] out = new Object[nlen];
if (nlen < values.length) {
    System.arraycopy(values, 0, out, 0, nlen);
} else {
    System.arraycopy(values, 0, out, 0, values.length);
return out;
String[]copyOf(String[] data, int newLength)
copy Of
String[] tmp = new String[newLength];
System.arraycopy(data, 0, tmp, 0, Math.min(data.length, newLength));
return tmp;
String[]copyOf(String[] original, int newLength)
copy Of
return copyOfRange(original, 0, newLength);