深克隆
import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream;/* 来 自 N o w J a v a . c o m - 时代Java*/ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; public class Main{ public static <T extends Serializable> T depthClone(T object) { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(object); ByteArrayInputStream bis = new ByteArrayInputStream( bos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bis); return (T) ois.readObject(); }