From 7b50ba95727ad130e734802d8f0772107d984a76 Mon Sep 17 00:00:00 2001 From: Daniele Gobbetti Date: Mon, 17 Apr 2017 21:07:50 +0200 Subject: [PATCH] Implement hashCode() as equals has been implemented. --- .../gadgetbridge/model/CalendarEvents.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/CalendarEvents.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/CalendarEvents.java index 6918eae6b..8172dc138 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/CalendarEvents.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/CalendarEvents.java @@ -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; + } } }