Update of exercises

kts
Thomas Smits 2023-06-15 11:54:30 +02:00
parent 5150715f8d
commit 231c0b6fbd
1 changed files with 37 additions and 0 deletions

View File

@ -26,4 +26,41 @@ public class Wesen {
this.staerke = staerke; this.staerke = staerke;
} }
/**
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + staerke;
return result;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Wesen other = (Wesen) obj;
if (name == null) {
if (other.name != null) {
return false;
}
}
else if (!name.equals(other.name)) {
return false;
}
return staerke == other.staerke;
}
} }