public static void main(String[] args) {
List<List<Integer>> ll1 = new ArrayList<List<Integer>>();
ll1.add(new ArrayList<Integer>(1));
System.out.println(ll1.get(0));
//hard copy don't work
List<List<Integer>> ll2 = new ArrayList<List<Integer>>(ll1);
System.out.println(ll2.get(0) == ll1.get(0));
}
Except using for loop to do hard copy for every inner list, do we have another way to do hard copy.
Could you explain how List<List<Integer>> ll2 = new ArrayList<List<Integer>>(ll1);
work and why it fail?