diff options
Diffstat (limited to 'juick-common/src/main/java')
-rw-r--r-- | juick-common/src/main/java/com/juick/Message.java | 6 | ||||
-rw-r--r-- | juick-common/src/main/java/com/juick/Tag.java | 5 | ||||
-rw-r--r-- | juick-common/src/main/java/com/juick/User.java | 8 |
3 files changed, 14 insertions, 5 deletions
diff --git a/juick-common/src/main/java/com/juick/Message.java b/juick-common/src/main/java/com/juick/Message.java index 45a0fdd49..b462e9b2d 100644 --- a/juick-common/src/main/java/com/juick/Message.java +++ b/juick-common/src/main/java/com/juick/Message.java @@ -29,6 +29,7 @@ import java.time.Instant; import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import java.util.Objects; import java.util.Set; /** @@ -317,4 +318,9 @@ public class Message implements Comparable { public void setReactions(Set<Reaction> reactions) { this.reactions = reactions; } + + @Override + public int hashCode() { + return Objects.hash(mid, rid); + } } diff --git a/juick-common/src/main/java/com/juick/Tag.java b/juick-common/src/main/java/com/juick/Tag.java index 29e5c767d..b93d0e760 100644 --- a/juick-common/src/main/java/com/juick/Tag.java +++ b/juick-common/src/main/java/com/juick/Tag.java @@ -57,6 +57,11 @@ public class Tag implements Comparable<Tag> { } @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override public String toString() { return name; } diff --git a/juick-common/src/main/java/com/juick/User.java b/juick-common/src/main/java/com/juick/User.java index 478c6a480..5edfe7823 100644 --- a/juick-common/src/main/java/com/juick/User.java +++ b/juick-common/src/main/java/com/juick/User.java @@ -18,7 +18,6 @@ package com.juick; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import javax.annotation.Nonnull; @@ -29,13 +28,14 @@ import javax.xml.bind.annotation.XmlTransient; import java.io.Serializable; import java.util.ArrayList; import java.util.List; +import java.util.Objects; /** * @author Ugnich Anton */ @XmlRootElement(name = "user", namespace = "http://juick.com/user") @XmlAccessorType() -public class User implements Serializable { +public class User { private int uid; private String name; private Object avatar; @@ -59,9 +59,7 @@ public class User implements Serializable { @Override public int hashCode() { - return new HashCodeBuilder() - .append(getUid()) - .toHashCode(); + return Objects.hash(uid); } @Override |