| | |
| | | package com.zy.asrs.common.utils; |
| | | |
| | | import java.io.*; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/10/17 |
| | | */ |
| | | public class ListUtils { |
| | | |
| | | public static List<Map> deepCopy(List<Map> 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); |
| | | @SuppressWarnings("unchecked") |
| | | List<Map> dest = (List<Map>) in.readObject(); |
| | | return dest; |
| | | } |
| | | |
| | | } |
| | | package com.zy.asrs.common.utils;
|
| | |
|
| | | import java.io.*;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | /**
|
| | | * Created by vincent on 2020/10/17
|
| | | */
|
| | | public class ListUtils {
|
| | |
|
| | | public static List<Map> deepCopy(List<Map> 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);
|
| | | @SuppressWarnings("unchecked")
|
| | | List<Map> dest = (List<Map>) in.readObject();
|
| | | return dest;
|
| | | }
|
| | |
|
| | | }
|