Skip to content

Instantly share code, notes, and snippets.

@pmanvi
Created February 9, 2012 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmanvi/1777425 to your computer and use it in GitHub Desktop.
Save pmanvi/1777425 to your computer and use it in GitHub Desktop.
Eclipse_equals_hashcode
// IntelliJ generated
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ElementNameKey)) return false;
ElementNameKey that = (ElementNameKey) o;
if (field1 != that.field1) return false;
if (field2 != that.field2) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (someName != null ? !someName.equals(that.someName) : that.someName != null) return false;
if (field3 != null ? !field3.equals(that.field3) : that.field3 != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (someName != null ? someName.hashCode() : 0);
result = 31 * result + field1;
result = 31 * result + (field3 != null ? field3.hashCode() : 0);
result = 31 * result + field2;
return result;
}
//NetBeans generated
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final nameKey other = (nameKey) obj;
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
return false;
}
if ((this.someName == null) ? (other.someName != null) : !this.someName.equals(other.someName)) {
return false;
}
if (this.field1 != other.field1) {
return false;
}
if ((this.field3 == null) ? (other.field3 != null) : !this.field3.equals(other.field3)) {
return false;
}
if (this.field2 != other.field2) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 67 * hash + (this.name != null ? this.name.hashCode() : 0);
hash = 67 * hash + (this.someName != null ? this.someName.hashCode() : 0);
hash = 67 * hash + this.field1;
hash = 67 * hash + this.field2;
return hash;
}
//eclipse generated
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((name == null) ? 0 : name.hashCode());
result = prime * result
+ ((someName == null) ? 0 : someName.hashCode());
result = prime * result + field1;
result = prime
* result
+ ((field3 == null) ? 0 : field3
.hashCode());
result = prime * result + field2;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
nameKey other = (nameKey) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (someName == null) {
if (other.someName != null)
return false;
} else if (!someName.equals(other.someName))
return false;
if (field1 != other.field1)
return false;
if (field3 == null) {
if (other.field3 != null)
return false;
} else if (!field3.equals(other.field3))
return false;
if (field2 != other.field2)
return false;
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment