Java Utililty Methods Array Deep Copy

List of utility methods to do Array Deep Copy

Description

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

Method

voiddeepCopy(int[][] src, int[][] dest)
deep Copy
for (int i = 0; i < src.length; i++) {
    System.arraycopy(src[i], 0, dest[i], 0, src[i].length);
TdeepCopy(Object objectArray)
deep Copy
Class arrayClass = objectArray.getClass();
if (boolean[].class.equals(arrayClass)) {
    boolean[] array = (boolean[]) objectArray;
    return (T) Arrays.copyOf(array, array.length);
} else if (byte[].class.equals(arrayClass)) {
    byte[] array = (byte[]) objectArray;
    return (T) Arrays.copyOf(array, array.length);
} else if (short[].class.equals(arrayClass)) {
...
float[][]deepCopy2DArray(float[][] a)
deep Copy D Array
if (a == null) {
    return null;
float[][] result = new float[a.length][];
for (int i = 0; i < a.length; i++) {
    result[i] = Arrays.copyOf(a[i], a[i].length);
return result;
...
double[][]deepCopyOf(double[][] src)
deep Copy Of
if (src == null)
    return null;
double[][] dst = new double[src.length][];
for (int i = 0; i < src.length; i++)
    if (src[i] != null)
        dst[i] = Arrays.copyOf(src[i], src[i].length);
return dst;