How to deep copy 2 dimensional array (different row sizes)

前端 未结 4 1762
一向
一向 2020-12-06 13:24

This is my first question in a community like this, so my format in question may not be very good sorry for that in the first place.

Now that my problem is I want to

4条回答
  •  囚心锁ツ
    2020-12-06 13:48

    I think what you mean is that the column size isn't fixed. Anyway a simple straightforward way would be:

    public int[][] copy(int[][] input) {
          int[][] target = new int[input.length][];
          for (int i=0; i 

提交回复
热议问题