if you override equals you should override hashcode - beefed up impls as well

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@777492 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2009-05-22 11:57:07 +00:00
parent 644260621f
commit 3b52dd2aef
1 changed files with 21 additions and 2 deletions

View File

@ -259,8 +259,27 @@ public final class LogLevelSelection extends HttpServlet {
return name.compareTo(((LogWrapper) other).name);
}
public boolean equals(Object other) {
return name.equals(((LogWrapper) other).name);
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
LogWrapper other = (LogWrapper) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
public Level level() {