Java Array Two Dimension to One Dimension array2dcopy(final String[][] src, final String[][] target)

Here you can find the source of array2dcopy(final String[][] src, final String[][] target)

Description

Copies the content of to_copy into target.

License

Open Source License

Parameter

Parameter Description
src a parameter
target a parameter

Declaration

public static void array2dcopy(final String[][] src,
        final String[][] target) 

Method Source Code

//package com.java2s;
/**/*from  www .j  av a  2s .c o m*/
 * Copyright (c) 2011, Marc R?ttig, Stephan Aiche.
 *
 * This file is part of GenericKnimeNodes.
 * 
 * GenericKnimeNodes 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 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 program.  If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    /**
     * Copies the content of to_copy into target. Assumes that src and target
     * have the same size.
     * 
     * @param src
     * @param target
     */
    public static void array2dcopy(final String[][] src,
            final String[][] target) {
        assert (target.length == src.length);

        for (int i = 0; i < target.length; ++i) {
            int array_length = src[i].length;
            target[i] = new String[src[i].length];
            System.arraycopy(src[i], 0, target[i], 0, array_length);
        }
    }
}

Related

  1. array2dCopy(Object[][] src, Object[][] dest)
  2. array2DTo1D(double[][] In)
  3. array2dTo1d(float[][] in)
  4. array2Dto1D(int m, int n, double[][] a)