它是確定做這樣的java嗎?
public class CacheTree {
private Multimap<Integer, Integer> a;
private Integer b;
public void copy(CacheTree anotherObj) {
this.a = anotherObj.getA();
this.b = anotherObj.getB();
}
public Multimap<Integer, Integer> getA() {
return a;
}
public Integer getB() {
return b;
}
}
public void main() {
CacheTree x = new CacheTree();
CacheTree y = new CacheTree();
x.copy(y); // Is it ok ?
}
http://stackoverflow.com/questions/64036/你怎麼做一個在java中的對象的深拷貝 – Hubbitus 2012-05-03 17:35:49