Pitfals of Cloneable in Java
JAVA 14 Oct 2018 1346How to create a deep copy of ArrayList via clone() ? Find out that there are some interesting default Java behaviors in regards to cloning. Create unclonable object to prevent from cloning something which shouldn't' be cloned by any other.
Compare cloned objects between each other and look at Clonable interface which is not always implemented by lists in Java.
"Some time ago, I described a couple of surprising design choices in the JDK functional interfaces API. Lately, during a lesson, a student of mine proposed to shallow-copy an ArrayList by using th..."
More info
#1st
in TOP Native articles
Level
Junior
Author
A Java geek
For further author's articles please visit the author's website.
https://blog.frankel.ch/