I understand that List.of and List.copyOf create immutable clone lists of the original list, so in my understanding, the below code should print [1], [1, 2] when it actually prints [[1, 2]], [1, 2]? how does List.of take the most recent view of the initial collection, col?
Collection<Number> col = new HashSet<>();
col.add(1);
var list1 = List.of(col); //1
col.add(2); //2
var list2 = List.copyOf(col); //3
System.out.println(list1+", "+list2);