@SuppressWarnings("unchecked")
public static <T> List<T> deepCopy(List<T> srcList) {
try {
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(byteOut);
out.writeObject(srcList);
out.close();
ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut.toByteArray());
ObjectInputStream in = new ObjectInputStream(byteIn);
return (List<T>) in.readObject();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
List<String> newList= deepCopy(oldList);