mirror of https://github.com/apache/lucene.git
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:
parent
644260621f
commit
3b52dd2aef
|
@ -259,8 +259,27 @@ public final class LogLevelSelection extends HttpServlet {
|
||||||
return name.compareTo(((LogWrapper) other).name);
|
return name.compareTo(((LogWrapper) other).name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object obj) {
|
||||||
return name.equals(((LogWrapper) other).name);
|
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() {
|
public Level level() {
|
||||||
|
|
Loading…
Reference in New Issue