Java Array Copy copy2DArray(char[][] original)

Here you can find the source of copy2DArray(char[][] original)

Description

copy D Array

License

Open Source License

Declaration

public static char[][] copy2DArray(char[][] original) 

Method Source Code


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

import java.util.Arrays;

public class Main {
    public static char[][] copy2DArray(char[][] original) {
        char[][] result = new char[original.length][];
        for (int i = 0; i < original.length; i++) {
            result[i] = Arrays.copyOf(original[i], original[i].length);
        }/*  w w  w.  j av  a2 s . co  m*/
        return result;
    }

    public static int[][] copy2DArray(int[][] original) {
        int[][] result = new int[original.length][];
        for (int i = 0; i < original.length; i++) {
            result[i] = Arrays.copyOf(original[i], original[i].length);
        }
        return result;
    }
}

Related

  1. copy(int[][] input)
  2. copy(long[] array)
  3. copy(long[] v)
  4. copy(T[] array)
  5. copy(T[] array)
  6. copy5DArray(char[][][][][] original)
  7. copyAndFillOf(T[] original, int newLength, T padding)
  8. copyArray()
  9. copyArray(byte[] dest, int off, byte[] src)