Java Array Clone clone(double[][] source)

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

Description

Returns a clone of the specified array.

License

Open Source License

Parameter

Parameter Description
source the source array (<code>null</code> not permitted).

Return

A clone of the array.

Declaration

public static double[][] clone(double[][] source) 

Method Source Code

//package com.java2s;
/* ===========================================================
 * JFreeChart : a free chart library for the Java(tm) platform
 * ===========================================================
 *
 * (C) Copyright 2000-2009, by Object Refinery Limited and Contributors.
 *
 * Project Info:  http://www.jfree.org/jfreechart/index.html
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.//  www  .  ja va  2s.c om
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 * USA.
 *
 * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
 * in the United States and other countries.]
 *
 * ------------------
 * DataUtilities.java
 * ------------------
 * (C) Copyright 2003-2009, by Object Refinery Limited and contributors.
 *
 * Original Author:  David Gilbert (for Object Refinery Limited);
 * Contributor(s):   Peter Kolb (patch 2511330);
 *
 * Changes
 * -------
 * 05-Mar-2003 : Version 1 (DG);
 * 03-Mar-2005 : Moved createNumberArray() and createNumberArray2D() methods
 *               from the DatasetUtilities class (DG);
 * 17-May-2005 : Added calculateColumnTotal() and calculateRowTotal()
 *               methods (DG);
 * 28-Jan-2009 : Added equal(double[][], double[][]) method (DG);
 * 28-Jan-2009 : Added clone(double[][]) method (DG);
 * 04-Feb-2009 : Added calculateColumnTotal/RowTotal variants (PK);
 *
 */

public class Main {
    /**
     * Returns a clone of the specified array.
     *
     * @param source  the source array (<code>null</code> not permitted).
     *
     * @return A clone of the array.
     *
     * @since 1.0.13
     */
    public static double[][] clone(double[][] source) {
        if (source == null) {
            throw new IllegalArgumentException("Null 'source' argument.");
        }
        double[][] clone = new double[source.length][];
        for (int i = 0; i < source.length; i++) {
            if (source[i] != null) {
                double[] row = new double[source[i].length];
                System.arraycopy(source[i], 0, row, 0, source[i].length);
                clone[i] = row;
            }
        }
        return clone;
    }
}

Related

  1. clone(byte[] input)
  2. clone(byte[] orig)
  3. clone(byte[][] im)
  4. clone(double[] array)
  5. clone(double[] p)
  6. clone(final byte[] array)
  7. clone(final double[][] array)
  8. clone(final int[] original)
  9. clone(final T[] array)