Sort hashtags alphabetically in ChangeNotes

Change-Id: Ifa85623b80ef4f36d4c0dd288e5d3b3fea2d522f
This commit is contained in:
Sven Selberg
2014-09-17 13:52:51 +02:00
parent a4640fb15c
commit 6524774b4f
2 changed files with 7 additions and 2 deletions

View File

@@ -40,6 +40,6 @@ public class GetHashtags implements RestReadView<ChangeResource> {
if (hashtags == null) { if (hashtags == null) {
hashtags = Collections.emptySet(); hashtags = Collections.emptySet();
} }
return Response.ok(new TreeSet<String>(hashtags)); return Response.ok(hashtags);
} }
} }

View File

@@ -24,6 +24,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSetMultimap; import com.google.common.collect.ImmutableSetMultimap;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Ordering; import com.google.common.collect.Ordering;
import com.google.common.collect.Table; import com.google.common.collect.Table;
import com.google.common.primitives.Ints; import com.google.common.primitives.Ints;
@@ -165,8 +166,12 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
return reviewers; return reviewers;
} }
/**
*
* @return a ImmutableSet of all hashtags for this change sorted in alphabetical order.
*/
public ImmutableSet<String> getHashtags() { public ImmutableSet<String> getHashtags() {
return hashtags; return ImmutableSortedSet.copyOf(hashtags);
} }
/** /**