Java对象的深拷贝和浅拷贝、集合的交集并集
http://blog.csdn.net/lian_1988/article/details/45970927
http://www.cnblogs.com/yxnchinahlj/archive/2010/09/20/1831615.html
深拷贝的有效代码:
public Object deepClone() throws IOException, OptionalDataException,ClassNotFoundException { // 将对象写到流里 ByteArrayOutputStream bo = new ByteArrayOutputStream(); ObjectOutputStream oo = new ObjectOutputStream(bo); oo.writeObject(this); // 从流里读出来 ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray()); ObjectInputStream oi = new ObjectInputStream(bi); return (oi.readObject()); }
集合的交集、并集
http://www.cnblogs.com/focusj/archive/2010/12/23/2057655.html