Implement hashCode() as equals has been implemented.

master
Daniele Gobbetti 2017-04-17 21:07:50 +02:00
parent 1e231e6129
commit 7b50ba9572
1 changed files with 14 additions and 1 deletions

View File

@ -156,7 +156,8 @@ public class CalendarEvents {
return calName;
}
@Override public boolean equals(Object other) {
@Override
public boolean equals(Object other) {
if (other instanceof CalendarEvent) {
CalendarEvent e = (CalendarEvent) other;
return (this.getId() == e.getId()) &&
@ -170,5 +171,17 @@ public class CalendarEvents {
return false;
}
}
@Override
public int hashCode() {
int result = (int) id;
result = 31 * result + title.hashCode();
result = 31 * result + Long.valueOf(begin).hashCode();
result = 31 * result + location.hashCode();
result = 31 * result + description.hashCode();
result = 31 * result + Long.valueOf(end).hashCode();
result = 31 * result + calName.hashCode();
return result;
}
}
}