diff options
Diffstat (limited to 'src/main/java/com/juick/Message.java')
-rw-r--r-- | src/main/java/com/juick/Message.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java index 617ed834..fb6be67c 100644 --- a/src/main/java/com/juick/Message.java +++ b/src/main/java/com/juick/Message.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2017, Juick + * Copyright (C) 2008-2019, Juick * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -24,12 +24,13 @@ import com.juick.model.Entity; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.builder.ToStringBuilder; +import javax.annotation.Nonnull; import javax.xml.bind.annotation.*; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import java.net.URI; import java.time.Instant; -import java.util.ArrayList; import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Objects; import java.util.Set; @@ -45,7 +46,7 @@ public class Message implements Comparable { private int replyto = 0; private String text = null; private User user = null; - private final List<Tag> tags; + private final Set<Tag> tags; private Instant ts; private Instant updated; private Instant updatedAt; @@ -86,7 +87,7 @@ public class Message implements Comparable { private List<Entity> entities; public Message() { - tags = new ArrayList<>(); + tags = new LinkedHashSet<>(); reactions = new HashSet<>(); } @@ -120,7 +121,7 @@ public class Message implements Comparable { } @Override - public int compareTo(Object obj) throws ClassCastException { + public int compareTo(@Nonnull Object obj) throws ClassCastException { if (obj == this) return 0; @@ -218,11 +219,11 @@ public class Message implements Comparable { @JsonProperty("tags") @XmlElement(name = "tag") - public List<Tag> getTags() { + public Set<Tag> getTags() { return tags; } - public void setTags(List<Tag> tags) { + public void setTags(Set<Tag> tags) { this.tags.clear(); if (CollectionUtils.isNotEmpty(tags)) this.tags.addAll(tags); |