aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/util')
-rw-r--r--src/main/java/com/juick/util/TagUtils.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/com/juick/util/TagUtils.java b/src/main/java/com/juick/util/TagUtils.java
index 2ec03e48..5069ae6f 100644
--- a/src/main/java/com/juick/util/TagUtils.java
+++ b/src/main/java/com/juick/util/TagUtils.java
@@ -22,6 +22,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
+import java.util.Set;
import java.util.stream.Collectors;
/**
@@ -39,4 +40,10 @@ public class TagUtils {
return tags.stream().map(t -> "*" + t.getName())
.collect(Collectors.joining(" "));
}
+ public static boolean hasTag(final Set<Tag> tags, String name) {
+ return tags.stream().anyMatch(tag -> tag.getName().equals(name));
+ }
+ public static boolean hasNoTag(final Set<Tag> tags, String name) {
+ return tags.stream().noneMatch(tag -> tag.getName().equals(name));
+ }
}