All pastes #69111 Raw Edit

Miscellany

public text v1 · immutable
#69111 ·published 2006-06-22 15:02 UTC
rendered paste body
	@Override
	public boolean equals(Object obj) {
                if(obj == null) return false;
                if(obj == this) return true;
                if(obj.getClass() == this.getClass()) { //polymorphic getClass fixes problems with subclasses and symmetry
                   AutoLookup alObj = (AutoLookupObject) obj;
                   return this.getId().equals(alObj.getId());
                } 
                return false;
	}
	
	@Override
	public int hashCode() {
		return getId();
	}