How to copy ArrayList without copying the references
I am facing an issue to copy a ArrayList without copying its references.
Suppose arrayList contains some lineItems present in object.
Below is the code snippet I used.
List arrayList= new ArrayList();
List newArrayList = new ArrayList();
If I delete any lineItems from the newly created list (newArrayList). Same lineItems are also getting deleted from the main list (arrayList).
Is there any way to copy the arraylist without the references being copied?
If itís possible to do so. Could anyone please provide the code snippet.
Thanks in advance.