【发布时间】:2021-01-07 06:45:48
【问题描述】:
我有一个对象,这个对象还包括其他对象,比如这个
学生:
public class Student implements Cloneable {
public int id;
public String name;
public List<Integer> score;
public Address address;
......
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
}
地址:
public class Address implements Serializable,Cloneable{
public String type;
public String value;
......
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
}
现在我有一个List\<Student> studentsList我如何深拷贝studentsList?如果Address中有其他对象,我如何复制studentList?
【问题讨论】:
标签: java spring spring-boot object clone