package yi.util.data;

public class CloneUtil {
  public static int[][] clone(int[][] source) {
    if (source == null) return null;
    int[][] cloned = new int[source.length][];
    for (int i=0; i<source.length; i++) {
      if (source[i] == null) cloned[i] = null;
      else cloned[i] = (int[]) source[i].clone();
    }
    return cloned;
  }

  public static double[][] clone(double[][] source) {
    if (source == null) return null;
    double[][] cloned = new double[source.length][];
    for (int i=0; i<source.length; i++) {
      if (source[i] == null) cloned[i] = null;
      else cloned[i] = (double[]) source[i].clone();
    }
    return cloned;
  }


}