Top "Shallow-copy" questions

A shallow copy of an object is a duplicate that may not be fully independent of the original, in the sense that any references / pointers it holds to other objects refer to the same objects that the original's do.

AngularJS : copy vs extend

Explanation : we come across some situation in which we need to copy one object to another object. In that case, …

javascript angularjs deep-copy shallow-copy
Shallow copy of a hashset

Whats the best way of doing it? var set2 = new HashSet<reference_type>(); Traverse the set with a …

c# collections union traversal shallow-copy
Is clone() in java shallow copy?

Is clone() in java a shallow copy? Eventually this gets to the clone() method of Object (the uppermost class), which …

java deep-copy shallow-copy
Why are objects automatically passed by reference?

I have a general question about deep- and shallow-copy in the context of the pass-by-reference- and pass-by-value-concept of C#: In …

c# clone pass-by-reference pass-by-value shallow-copy
Shallow/deep copy of std::map

How would I best implement these? I thought of something like this: using namespace std; shape_container shape_container::clone_…

c++ deep-copy stdmap shallow-copy
Creating a shallow copy of structures in C#

I tried to search for my answer and found them in regards to C and not C# so thought of …

c# .net clone deep-copy shallow-copy
How do I make a shallow copy of a Perl hash reference?

I want to push a reference to a hash. By that I mean I want to push a reference to …

perl hash shallow-copy
How do strings work when shallow copying something in C#?

Strings are considered reference types yet can act like values. When shallow copying something either manually or with the MemberwiseClone(), …

c# .net shallow-copy
JS Recursive object assign

I learned that when using Object.assign() it extends only the top level object. How can I deeply extend the …

javascript javascript-objects shallow-copy shallow-clone
Shallow copy for arrays, why can't simply do newArr = oldArr?

Let's say I have an array of integers, "orig" I want to shallow copy it, so can't I just do …

java deep-copy shallow-copy