- public List deepCopy(List src) throws IOException, ClassNotFoundException{
- ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(byteOut);
- out.writeObject(src);
- ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut.toByteArray());
- ObjectInputStream in =new ObjectInputStream(byteIn);
- List dest = (List)in.readObject();
- return dest;
- }
Array List 深拷贝
最新推荐文章于 2024-07-03 12:46:25 发布