深拷贝工具

public class ObjectUtil { public ObjectUtil() { }public static Object deepCopy(Object orig) throws IOException, ClassNotFoundException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(orig); oos.flush(); ByteArrayInputStream bin = new ByteArrayInputStream(bos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bin); return ois.readObject(); } }

【深拷贝工具】

    推荐阅读