java的深拷贝,需要implements Cloneable,并且实现clone()方法
public class LabelBean implements Cloneable { private int type; private String name; private boolean isSelect; public LabelBean(int type, String name) { this.type = type; this.name = name; } public int getType() { return type; } public void setType(int type) { this.type = type; } public String getName() { return name; } public void setName(String name) { this.name = name; } public boolean isSelect() { return isSelect; } public void setSelect(boolean select) { isSelect = select; } @NonNull @Override public LabelBean clone() { try { LabelBean clone = (LabelBean) super.clone(); clone.setName(this.name); clone.setType(this.type); clone.setSelect(this.isSelect); return clone; } catch (CloneNotSupportedException e) { throw new AssertionError(); } } }