How to Clone Collection in Java - Deep copy of ArrayList and HashSet
copy constructor of Collection in Java only provides shallow copy and not deep copy, which means objects stored in both original List and cloned List will be same and point to same memory location in Java heap.
n order to fix this, we need to deep clone Employee object by iterating over Collection and before that, we need to override clone method for Employee object.
http://ift.tt/1i32MwZ
copy constructor of Collection in Java only provides shallow copy and not deep copy, which means objects stored in both original List and cloned List will be same and point to same memory location in Java heap.
n order to fix this, we need to deep clone Employee object by iterating over Collection and before that, we need to override clone method for Employee object.
http://ift.tt/1i32MwZ
from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1Fq4BTU
via LifeLong Community
well explained . thanks for sharing good post . Good arraylist clone example visit Arraylist Clone example
ReplyDelete