问题
Is it possible to make a deep copy/clone of a Java object without using serialization ? If so then how ?
回答1:
You could use the Java Deep-Cloning Library to make deep copies of objects. It is really useful when you can't (or don't want) to make your classes serializable. The use is straight-forward:
Cloner cloner = new Cloner();
MyClass clone = cloner.deepClone(o);
// clone is a deep-clone of o
来源:https://stackoverflow.com/questions/25472281/how-to-make-deep-copy-of-java-object-without-using-serialization