It's a "deep copy" in that changes to the original object's linked list (via next
) will not be seen in the copy or vice versa. Compare that with the "shallow copy" which would be taken if the new object just copied the original next
reference.
It's a shallow copy in terms of the key and value though - if those are mutable types and are mutated then yes, the mutation will be seen via both the original and the "cloned" version.
So ultimately, it's a deeper copy than the naive "copy all references" approach - but it's not a fully deep copy.