From d2de62ee55c3fb2e7f28d769b9588dc0878ead95 Mon Sep 17 00:00:00 2001 From: Grishka Date: Wed, 27 Sep 2023 13:50:59 -0300 Subject: [PATCH] Probably fix #703 --- .../joinmastodon/android/model/Hashtag.java | 15 +++++++++++++++ .../joinmastodon/android/model/Mention.java | 18 ++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/mastodon/src/main/java/org/joinmastodon/android/model/Hashtag.java b/mastodon/src/main/java/org/joinmastodon/android/model/Hashtag.java index 4d1554faf3..35db8a208a 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/model/Hashtag.java +++ b/mastodon/src/main/java/org/joinmastodon/android/model/Hashtag.java @@ -30,4 +30,19 @@ public String toString(){ public String getID(){ return name; } + + @Override + public boolean equals(Object o){ + if(this==o) return true; + if(o==null || getClass()!=o.getClass()) return false; + + Hashtag hashtag=(Hashtag) o; + + return name.equals(hashtag.name); + } + + @Override + public int hashCode(){ + return name.hashCode(); + } } diff --git a/mastodon/src/main/java/org/joinmastodon/android/model/Mention.java b/mastodon/src/main/java/org/joinmastodon/android/model/Mention.java index 3b20bb7141..80188c771d 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/model/Mention.java +++ b/mastodon/src/main/java/org/joinmastodon/android/model/Mention.java @@ -20,4 +20,22 @@ public String toString(){ ", url='"+url+'\''+ '}'; } + + @Override + public boolean equals(Object o){ + if(this==o) return true; + if(o==null || getClass()!=o.getClass()) return false; + + Mention mention=(Mention) o; + + if(!id.equals(mention.id)) return false; + return url.equals(mention.url); + } + + @Override + public int hashCode(){ + int result=id.hashCode(); + result=31*result+url.hashCode(); + return result; + } }