Java Array Copy copy(double[][] a)

Here you can find the source of copy(double[][] a)

Description

Returns a deep copy of the given 2D array.

License

Open Source License

Declaration

public static double[][] copy(double[][] a) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Arrays;

public class Main {
    /**//  w w  w .  java  2  s . c  o  m
     * Returns a deep copy of the given 2D array.
     */
    public static double[][] copy(double[][] a) {
        if (a.length == 0) {
            return new double[0][0];
        }
        double[][] c = new double[a.length][];
        for (int i = 0; i < a.length; i++) {
            c[i] = Arrays.copyOf(a[i], a[i].length);
        }
        return c;
    }
}

Related

  1. arrayCopyToNull(T[] source, int sourceOffset, T[] destination, int destinationOffset)
  2. arrayCopyWithRemoval(Object[] src, Object[] dst, int idxToRemove)
  3. Arrays_copyOf(int[] pos, int length)
  4. copy(byte[] bytes)
  5. copy(byte[] data, int from)
  6. copy(final boolean[] array)
  7. copy(final byte[] bytes)
  8. copy(final byte[] inBytes)
  9. copy(int[] array)