Improve performance of equals

This commit is contained in:
Sam Harwell 2012-07-18 14:24:47 -05:00
parent 45e42d7243
commit 4c1e9b4119
1 changed files with 1 additions and 3 deletions

View File

@ -52,11 +52,9 @@ public abstract class ContextGetterDecl extends Decl {
*/ */
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if ( obj==null ) return false; if ( this==obj ) return true;
// A() and label A are different // A() and label A are different
if ( !(obj instanceof ContextGetterDecl) ) return false; if ( !(obj instanceof ContextGetterDecl) ) return false;
if ( this==obj ) return true;
if ( this.hashCode() != obj.hashCode() ) return false;
return return
name.equals(((Decl) obj).name) && name.equals(((Decl) obj).name) &&
getArgType().equals(((ContextGetterDecl) obj).getArgType()); getArgType().equals(((ContextGetterDecl) obj).getArgType());