TSK-664: added hash and equals methods to KeyDomain.

This commit is contained in:
Holger Hagen 2018-08-09 13:49:35 +02:00 committed by Martin Rojas Miguel Angel
parent a77780a997
commit c750e00b32
1 changed files with 31 additions and 0 deletions

View File

@ -42,4 +42,35 @@ public class KeyDomain {
return builder.toString(); return builder.toString();
} }
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((domain == null) ? 0 : domain.hashCode());
result = prime * result + ((key == null) ? 0 : key.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
KeyDomain other = (KeyDomain) obj;
if (domain == null) {
if (other.domain != null)
return false;
} else if (!domain.equals(other.domain))
return false;
if (key == null) {
if (other.key != null)
return false;
} else if (!key.equals(other.key))
return false;
return true;
}
} }