clone復制對象
public Object cloneObject(Object obj) throws Exception{ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(byteOut);
out.writeObject(obj);
ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut.toByteArray());
ObjectInputStream in =new ObjectInputStream(byteIn);
return in.readObject();
}
淺克隆:List billBoxListClone = (List)BeanUtils.cloneBean(billBoxList);
posted on 2013-03-31 22:42 youngturk 閱讀(236) 評論(0) 編輯 收藏 所屬分類: Java基礎