Now, I have encountered this problem:
I have a non-empty array list declared as original
. Then I do this :
ArrayList<ArrayList<Integer>> temp = (ArrayList<ArrayList<Integer>>) original.clone();
temp.get(0).set(1,-1) ;
but the result was that unexpectedly the element at index 1
in both lists were changed.
How can I fix this problem ?