1 8 9 package foxtrot.test; 10 11 14 public class MutableHolder 15 { 16 private Object held; 17 18 public MutableHolder(Object held) 19 { 20 this.held = held; 21 } 22 23 public Object get() 24 { 25 return held; 26 } 27 28 public void set(Object held) 29 { 30 this.held = held; 31 } 32 33 public boolean equals(Object o) 34 { 35 if (this == o) return true; 36 if (!(o instanceof MutableHolder)) return false; 37 38 final MutableHolder holder = (MutableHolder)o; 39 40 if (held != null ? !held.equals(holder.held) : holder.held != null) return false; 41 42 return true; 43 } 44 45 public int hashCode() 46 { 47 return (held != null ? held.hashCode() : 0); 48 } 49 } 50 | Popular Tags |